summaryrefslogtreecommitdiffstats
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-06-02 13:36:14 +0100
commit49223c47fc20ed4215cf82831a07dae6a1793dd0 (patch)
tree0e88aaa39cda1c00483364e33d6facfebb40aeff /meta/lib/oeqa/core/context.py
parentadc434c0636b7dea2ef70c8d2c8e61cdb5c703b1 (diff)
downloadpoky-49223c47fc20ed4215cf82831a07dae6a1793dd0.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. (From OE-Core rev: 7e803f1a855d3091a772b13efd3cc8e9c0c766e9) 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):
58 58
59 return result 59 return result
60 60
61 def listTests(self, display_type):
62 self.runner = self.runnerClass(self, verbosity=2)
63 return self.runner.list_tests(self.suites, display_type)
64
61class OETestContextExecutor(object): 65class OETestContextExecutor(object):
62 _context_class = OETestContext 66 _context_class = OETestContext
63 67
@@ -79,9 +83,14 @@ class OETestContextExecutor(object):
79 self.parser.add_argument('--output-log', action='store', 83 self.parser.add_argument('--output-log', action='store',
80 default=self.default_output_log, 84 default=self.default_output_log,
81 help="results output log, default: %s" % self.default_output_log) 85 help="results output log, default: %s" % self.default_output_log)
82 self.parser.add_argument('--run-tests', action='store', 86
87 group = self.parser.add_mutually_exclusive_group()
88 group.add_argument('--run-tests', action='store',
83 default=self.default_tests, 89 default=self.default_tests,
84 help="tests to run in <module>[.<class>[.<name>]] format. Just works for modules now") 90 help="tests to run in <module>[.<class>[.<name>]] format. Just works for modules now")
91 group.add_argument('--list-tests', action='store',
92 choices=('module', 'class', 'name'),
93 help="lists available tests")
85 94
86 if self.default_test_data: 95 if self.default_test_data:
87 self.parser.add_argument('--test-data-file', action='store', 96 self.parser.add_argument('--test-data-file', action='store',
@@ -126,7 +135,6 @@ class OETestContextExecutor(object):
126 else: 135 else:
127 self.tc_kwargs['init']['td'] = {} 136 self.tc_kwargs['init']['td'] = {}
128 137
129
130 if args.run_tests: 138 if args.run_tests:
131 self.tc_kwargs['load']['modules'] = args.run_tests.split() 139 self.tc_kwargs['load']['modules'] = args.run_tests.split()
132 else: 140 else:
@@ -139,9 +147,13 @@ class OETestContextExecutor(object):
139 147
140 self.tc = self._context_class(**self.tc_kwargs['init']) 148 self.tc = self._context_class(**self.tc_kwargs['init'])
141 self.tc.loadTests(self.module_paths, **self.tc_kwargs['load']) 149 self.tc.loadTests(self.module_paths, **self.tc_kwargs['load'])
142 rc = self.tc.runTests(**self.tc_kwargs['run']) 150
143 rc.logSummary(self.name) 151 if args.list_tests:
144 rc.logDetails() 152 rc = self.tc.listTests(args.list_tests, **self.tc_kwargs['run'])
153 else:
154 rc = self.tc.runTests(**self.tc_kwargs['run'])
155 rc.logSummary(self.name)
156 rc.logDetails()
145 157
146 output_link = os.path.join(os.path.dirname(args.output_log), 158 output_link = os.path.join(os.path.dirname(args.output_log),
147 "%s-results.log" % self.name) 159 "%s-results.log" % self.name)