[Asterisk-code-review] testsuite: Add two new options to facilitate automation (testsuite[master])
George Joseph
asteriskteam at digium.com
Sun May 21 15:23:05 CDT 2017
George Joseph has uploaded a new change for review. ( https://gerrit.asterisk.org/5674 )
Change subject: testsuite: Add two new options to facilitate automation
......................................................................
testsuite: Add two new options to facilitate automation
Added '-T, --skip-tests' option to specify a list of tests to
skip. After any '-t, --tests' processing is done, any test starting
with the specified string is skipped. Can be used multiple times.
Added '--list-terse' to print a one-line output of each test in the
form:
nnnn A testname [ unmet_dependency[,unmet_dependency]...]
Where:
nnnn: is a sequential number left-padded with zeros.
A: 'S':Skipped, 'D':Unmet dependency, 'E':Enabled
testname: testname
unmet_dependency: A CSV list of unmet dependencies
Change-Id: I1b1dc699c444726719bb19756a1b03687361c102
---
M runtests.py
1 file changed, 42 insertions(+), 1 deletion(-)
git pull ssh://gerrit.asterisk.org:29418/testsuite refs/changes/74/5674/1
diff --git a/runtests.py b/runtests.py
index c8c225e..a748b07 100755
--- a/runtests.py
+++ b/runtests.py
@@ -487,6 +487,11 @@
for test in self.options.tests)):
continue
+ if (self.options.skip_tests and
+ any((path + '/').startswith(test)
+ for test in self.options.skip_tests)):
+ continue
+
tests.append(TestRun(path, ast_version, self.options,
self.global_config, self.options.timeout))
elif val == "dir":
@@ -543,6 +548,29 @@
else:
print " --> Dependency: %s -- Met: %s" % (d.name, str(d.met))
+ i += 1
+
+ def list_terse(self):
+ i = 1
+ for t in self.tests:
+ flag = "E"
+ deps = ""
+ if t.test_config.skip:
+ flag = "S"
+ else:
+ for d in t.test_config.deps:
+ if not d.met:
+ if flag == "D":
+ deps += ","
+ else:
+ deps += " "
+ flag = "D"
+ if d.version:
+ deps += ("%s" % d.version)
+ else:
+ deps += ("%s" % d.name)
+
+ print "%04d %s %s%s" % (i, flag, t.test_config.test_name, deps)
i += 1
def run(self):
@@ -768,6 +796,12 @@
parser.add_option("-l", "--list-tests", action="store_true",
dest="list_tests", default=False,
help="List tests instead of running them.")
+ parser.add_option("--list-terse", action="store_true",
+ dest="list_terse", default=False,
+ help="List tests in 'nnnn A testname [ unmet_dependency[,unmet_dependency]...]' format "
+ "where 'nnnn' = number, 'A' = 'S':Skipped, 'D':Dependency not met, 'E':Enabled, "
+ "'unmet_dependency': A CSV list of unmet dependencies, if any"
+ )
parser.add_option("-L", "--list-tags", action="store_true",
dest="list_tags", default=False,
help="List available tags")
@@ -778,6 +812,10 @@
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",
+ help="Exclude tests based on regex. "
+ "May be specified more than once.")
parser.add_option("-v", "--version",
dest="version", default=None,
help="Specify the version of Asterisk rather then detecting it.")
@@ -807,7 +845,7 @@
ast_version = AsteriskVersion(default=options.version)
- if options.list_tests or options.list_tags:
+ if options.list_tests or options.list_tags or options.list_terse :
test_suite = TestSuite(ast_version, options)
if options.list_tests:
@@ -816,6 +854,9 @@
if options.list_tags:
test_suite.list_tags()
+ if options.list_terse:
+ test_suite.list_terse()
+
return 0
if options.timeout > 0:
--
To view, visit https://gerrit.asterisk.org/5674
To unsubscribe, visit https://gerrit.asterisk.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I1b1dc699c444726719bb19756a1b03687361c102
Gerrit-PatchSet: 1
Gerrit-Project: testsuite
Gerrit-Branch: master
Gerrit-Owner: George Joseph <gjoseph at digium.com>
More information about the asterisk-code-review
mailing list