diff options
author | Stefan Kral <sk@typedivision.de> | 2020-03-11 17:37:30 +0100 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2020-03-12 22:49:28 +0000 |
commit | b10131ea746efe6b7056dc670ac9839c17cba578 (patch) | |
tree | 40716e3d81ef7e02eee7feddb669380891806342 /meta/lib/oeqa/core/runner.py | |
parent | 4719298e34b7098465fd87355ed6d899583654d0 (diff) | |
download | poky-b10131ea746efe6b7056dc670ac9839c17cba578.tar.gz |
oeqa: enable testresults.json for testexport
Add the option --json-result-dir to oeqa core context to enable
testresults.json creation for test runs via testexport.
Eg. oe-test runtime --json-result-dir .
(From OE-Core rev: 9d8edf33d1f5d89b310923b0aa3cc967317c7c49)
Signed-off-by: Stefan Kral <sk@typedivision.de>
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 | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/meta/lib/oeqa/core/runner.py b/meta/lib/oeqa/core/runner.py index f656e1a9c5..1284295c34 100644 --- a/meta/lib/oeqa/core/runner.py +++ b/meta/lib/oeqa/core/runner.py | |||
@@ -319,10 +319,17 @@ class OETestResultJSONHelper(object): | |||
319 | the_file.write(file_content) | 319 | the_file.write(file_content) |
320 | 320 | ||
321 | def dump_testresult_file(self, write_dir, configuration, result_id, test_result): | 321 | def dump_testresult_file(self, write_dir, configuration, result_id, test_result): |
322 | bb.utils.mkdirhier(write_dir) | 322 | try: |
323 | lf = bb.utils.lockfile(os.path.join(write_dir, 'jsontestresult.lock')) | 323 | import bb |
324 | has_bb = True | ||
325 | bb.utils.mkdirhier(write_dir) | ||
326 | lf = bb.utils.lockfile(os.path.join(write_dir, 'jsontestresult.lock')) | ||
327 | except ImportError: | ||
328 | has_bb = False | ||
329 | os.makedirs(write_dir, exist_ok=True) | ||
324 | test_results = self._get_existing_testresults_if_available(write_dir) | 330 | test_results = self._get_existing_testresults_if_available(write_dir) |
325 | test_results[result_id] = {'configuration': configuration, 'result': test_result} | 331 | test_results[result_id] = {'configuration': configuration, 'result': test_result} |
326 | json_testresults = json.dumps(test_results, sort_keys=True, indent=4) | 332 | json_testresults = json.dumps(test_results, sort_keys=True, indent=4) |
327 | self._write_file(write_dir, self.testresult_filename, json_testresults) | 333 | self._write_file(write_dir, self.testresult_filename, json_testresults) |
328 | bb.utils.unlockfile(lf) | 334 | if has_bb: |
335 | bb.utils.unlockfile(lf) | ||