aboutsummaryrefslogtreecommitdiffstats
path: root/meta/lib/oeqa/core/context.py
diff options
context:
space:
mode:
authorAníbal Limón <anibal.limon@linux.intel.com>2017-05-26 15:37:44 -0500
committerRichard Purdie <richard.purdie@linuxfoundation.org>2017-05-30 10:15:22 +0100
commit7e803f1a855d3091a772b13efd3cc8e9c0c766e9 (patch)
tree7d0c7c5f6e2db971069879f20cc72ed23571a779 /meta/lib/oeqa/core/context.py
parent598c6579932c2ca1dbdb022c8bec8af2e6c21e6b (diff)
downloadopenembedded-core-contrib-7e803f1a855d3091a772b13efd3cc8e9c0c766e9.tar.gz
oeqa/core: Add list tests support in context and runner
A common operation is to list tests, currently only selftest support it, this changes enables this functionality into the core framework. Signed-off-by: Aníbal Limón <anibal.limon@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/lib/oeqa/core/context.py')
-rw-r--r--meta/lib/oeqa/core/context.py22
1 files changed, 17 insertions, 5 deletions
diff --git a/meta/lib/oeqa/core/context.py b/meta/lib/oeqa/core/context.py
index 54958add07..bc958d0dfe 100644
--- a/meta/lib/oeqa/core/context.py
+++ b/meta/lib/oeqa/core/context.py
@@ -58,6 +58,10 @@ class OETestContext(object):
return result
+ def listTests(self, display_type):
+ self.runner = self.runnerClass(self, verbosity=2)
+ return self.runner.list_tests(self.suites, display_type)
+
class OETestContextExecutor(object):
_context_class = OETestContext
@@ -79,9 +83,14 @@ class OETestContextExecutor(object):
self.parser.add_argument('--output-log', action='store',
default=self.default_output_log,
help="results output log, default: %s" % self.default_output_log)
- self.parser.add_argument('--run-tests', action='store',
+
+ group = self.parser.add_mutually_exclusive_group()
+ group.add_argument('--run-tests', action='store',
default=self.default_tests,
help="tests to run in <module>[.<class>[.<name>]] format. Just works for modules now")
+ group.add_argument('--list-tests', action='store',
+ choices=('module', 'class', 'name'),
+ help="lists available tests")
if self.default_test_data:
self.parser.add_argument('--test-data-file', action='store',
@@ -126,7 +135,6 @@ class OETestContextExecutor(object):
else:
self.tc_kwargs['init']['td'] = {}
-
if args.run_tests:
self.tc_kwargs['load']['modules'] = args.run_tests.split()
else:
@@ -139,9 +147,13 @@ class OETestContextExecutor(object):
self.tc = self._context_class(**self.tc_kwargs['init'])
self.tc.loadTests(self.module_paths, **self.tc_kwargs['load'])
- rc = self.tc.runTests(**self.tc_kwargs['run'])
- rc.logSummary(self.name)
- rc.logDetails()
+
+ if args.list_tests:
+ rc = self.tc.listTests(args.list_tests, **self.tc_kwargs['run'])
+ else:
+ rc = self.tc.runTests(**self.tc_kwargs['run'])
+ rc.logSummary(self.name)
+ rc.logDetails()
output_link = os.path.join(os.path.dirname(args.output_log),
"%s-results.log" % self.name)