[Asterisk-code-review] testsuite: Add --test-regex and change --skip-test to take ... (testsuite[master])

George Joseph asteriskteam at digium.com
Mon May 22 17:30:48 CDT 2017


George Joseph has submitted this change and it was merged. ( https://gerrit.asterisk.org/5682 )

Change subject: testsuite:  Add --test-regex and change --skip-test to take regex
......................................................................


testsuite:  Add --test-regex and change --skip-test to take regex

Added --tests-regex and updated the recently added -T,--skip-test
to --skip-test-regex

Change-Id: I33c1b553569c5b383d1840500eb7ca1a10d8ca84
---
M runtests.py
1 file changed, 15 insertions(+), 5 deletions(-)

Approvals:
  George Joseph: Looks good to me, approved; Approved for Submit
  Jenkins2: Verified



diff --git a/runtests.py b/runtests.py
index a748b07..b73d5af 100755
--- a/runtests.py
+++ b/runtests.py
@@ -21,6 +21,7 @@
 import select
 import signal
 import syslog
+import re
 
 try:
     import lxml.etree as ET
@@ -487,9 +488,14 @@
                                     for test in self.options.tests)):
                         continue
 
-                    if (self.options.skip_tests and
-                            any((path + '/').startswith(test)
-                                    for test in self.options.skip_tests)):
+                    if (self.options.tests_regex and
+                            not any(re.search(test, path + '/')
+                                    for test in self.options.tests_regex)):
+                        continue
+
+                    if (self.options.skip_tests_regex and
+                            any(re.search(test, path + '/')
+                                    for test in self.options.skip_tests_regex)):
                         continue
 
                     tests.append(TestRun(path, ast_version, self.options,
@@ -812,8 +818,12 @@
                       dest="tests",
                       help="Run a single specified test (directory) instead "
                            "of all tests.  May be specified more than once.")
-    parser.add_option("-T", "--skip-test", action="append", default=[],
-                      dest="skip_tests",
+    parser.add_option("--test-regex", action="append", default=[],
+                      dest="tests_regex",
+                      help="Run tests matching the supplied regex."
+                           "May be specified more than once.")
+    parser.add_option("-T", "--skip-test-regex", action="append", default=[],
+                      dest="skip_tests_regex",
                       help="Exclude tests based on regex. "
                            "May be specified more than once.")
     parser.add_option("-v", "--version",

-- 
To view, visit https://gerrit.asterisk.org/5682
To unsubscribe, visit https://gerrit.asterisk.org/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I33c1b553569c5b383d1840500eb7ca1a10d8ca84
Gerrit-PatchSet: 1
Gerrit-Project: testsuite
Gerrit-Branch: master
Gerrit-Owner: George Joseph <gjoseph at digium.com>
Gerrit-Reviewer: George Joseph <gjoseph at digium.com>
Gerrit-Reviewer: Jenkins2



More information about the asterisk-code-review mailing list