diff options
author | Richard Purdie <richard.purdie@linuxfoundation.org> | 2018-07-09 15:20:34 +0000 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2018-07-18 10:18:41 +0100 |
commit | ebd97e728ae1bd9442299c871a07a1b3b9f9efdf (patch) | |
tree | a76fec3b71434a64d9a9b8310434b78bceafdc89 /meta/lib/oeqa/core/runner.py | |
parent | 05c32d2de1ee4681cc78cb107a158e9ab22c9619 (diff) | |
download | poky-ebd97e728ae1bd9442299c871a07a1b3b9f9efdf.tar.gz |
oeqa: Add selftest parallelisation support
This allows oe-selftest to take a -j option which specifies how much test
parallelisation to use. Currently this is "module" based with each module
being split and run in a separate build directory. Further splitting could
be done but this seems a good compromise between test setup and parallelism.
You need python-testtools and python-subunit installed to use this but only
when the -j option is specified.
See notes posted to the openedmbedded-architecture list for more details
about the design choices here.
Some of this functionality may make more sense in the oeqa core ultimately.
(From OE-Core rev: 326ababfd620ae5ea29bf486b9d68ba3d60cad30)
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/lib/oeqa/core/runner.py')
-rw-r--r-- | meta/lib/oeqa/core/runner.py | 24 |
1 files changed, 20 insertions, 4 deletions
diff --git a/meta/lib/oeqa/core/runner.py b/meta/lib/oeqa/core/runner.py index 219102c6b0..6adbe3827b 100644 --- a/meta/lib/oeqa/core/runner.py +++ b/meta/lib/oeqa/core/runner.py | |||
@@ -43,11 +43,17 @@ class OETestResult(_TestResult): | |||
43 | super(OETestResult, self).__init__(*args, **kwargs) | 43 | super(OETestResult, self).__init__(*args, **kwargs) |
44 | 44 | ||
45 | self.successes = [] | 45 | self.successes = [] |
46 | self.starttime = {} | ||
47 | self.endtime = {} | ||
48 | self.progressinfo = {} | ||
46 | 49 | ||
47 | self.tc = tc | 50 | self.tc = tc |
48 | self._tc_map_results() | 51 | self._tc_map_results() |
49 | 52 | ||
50 | def startTest(self, test): | 53 | def startTest(self, test): |
54 | # May have been set by concurrencytest | ||
55 | if test.id() not in self.starttime: | ||
56 | self.starttime[test.id()] = time.time() | ||
51 | super(OETestResult, self).startTest(test) | 57 | super(OETestResult, self).startTest(test) |
52 | 58 | ||
53 | def _tc_map_results(self): | 59 | def _tc_map_results(self): |
@@ -57,6 +63,12 @@ class OETestResult(_TestResult): | |||
57 | self.tc._results['expectedFailures'] = self.expectedFailures | 63 | self.tc._results['expectedFailures'] = self.expectedFailures |
58 | self.tc._results['successes'] = self.successes | 64 | self.tc._results['successes'] = self.successes |
59 | 65 | ||
66 | def stopTest(self, test): | ||
67 | self.endtime[test.id()] = time.time() | ||
68 | super(OETestResult, self).stopTest(test) | ||
69 | if test.id() in self.progressinfo: | ||
70 | print(self.progressinfo[test.id()]) | ||
71 | |||
60 | def logSummary(self, component, context_msg=''): | 72 | def logSummary(self, component, context_msg=''): |
61 | elapsed_time = self.tc._run_end_time - self.tc._run_start_time | 73 | elapsed_time = self.tc._run_end_time - self.tc._run_start_time |
62 | self.tc.logger.info("SUMMARY:") | 74 | self.tc.logger.info("SUMMARY:") |
@@ -141,12 +153,16 @@ class OETestResult(_TestResult): | |||
141 | if hasattr(d, 'oeid'): | 153 | if hasattr(d, 'oeid'): |
142 | oeid = d.oeid | 154 | oeid = d.oeid |
143 | 155 | ||
156 | t = "" | ||
157 | if case.id() in self.starttime and case.id() in self.endtime: | ||
158 | t = " (" + "{0:.2f}".format(self.endtime[case.id()] - self.starttime[case.id()]) + "s)" | ||
159 | |||
144 | if fail: | 160 | if fail: |
145 | self.tc.logger.info("RESULTS - %s - Testcase %s: %s" % (case.id(), | 161 | self.tc.logger.info("RESULTS - %s - Testcase %s: %s%s" % (case.id(), |
146 | oeid, desc)) | 162 | oeid, desc, t)) |
147 | else: | 163 | else: |
148 | self.tc.logger.info("RESULTS - %s - Testcase %s: %s" % (case.id(), | 164 | self.tc.logger.info("RESULTS - %s - Testcase %s: %s%s" % (case.id(), |
149 | oeid, 'UNKNOWN')) | 165 | oeid, 'UNKNOWN', t)) |
150 | 166 | ||
151 | class OEListTestsResult(object): | 167 | class OEListTestsResult(object): |
152 | def wasSuccessful(self): | 168 | def wasSuccessful(self): |