1
0
mirror of https://git.yoctoproject.org/poky synced 2026-06-01 13:09:50 +00:00

oeqa/logparser: Improve results handling

Merge the results handling into the ptest log parser as a seperate
method.

Drop the weird "pass.skip.fail." prefix to the results filename, its
just bizarre.

Drop the code turning a list into a regex then searching the regex for
an item, "x in y" is perfectly capable.

Use a dict, sort the keys as needed and drop the list sorting code.

(From OE-Core rev: f317800e950b4a37b4034133bc52e0c47f04dc29)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
Richard Purdie
2019-01-29 15:08:58 +00:00
parent 3731033435
commit 54d4694f32
2 changed files with 19 additions and 40 deletions
+8 -6
View File
@@ -49,8 +49,9 @@ class PtestRunnerTest(OERuntimeTestCase):
extras['ptestresult.rawlogs'] = {'log': output}
# Parse and save results
parse_result, sections = PtestParser().parse(ptest_runner_log)
parse_result.log_as_files(ptest_log_dir, test_status = ['pass','fail', 'skip'])
parser = PtestParser()
results, sections = parser.parse(ptest_runner_log)
parser.results_as_files(ptest_log_dir, test_status = ['pass','fail', 'skip'])
if os.path.exists(ptest_log_dir_link):
# Remove the old link to create a new one
os.remove(ptest_log_dir_link)
@@ -60,14 +61,15 @@ class PtestRunnerTest(OERuntimeTestCase):
trans = str.maketrans("()", "__")
resmap = {'pass': 'PASSED', 'skip': 'SKIPPED', 'fail': 'FAILED'}
for section in parse_result.result_dict:
for test, result in parse_result.result_dict[section]:
for section in results:
for test in results[section]:
result = results[section][test]
testname = "ptestresult." + (section or "No-section") + "." + "_".join(test.translate(trans).split())
extras[testname] = {'status': resmap[result]}
failed_tests = {}
for section in parse_result.result_dict:
failed_testcases = [ "_".join(test.translate(trans).split()) for test, result in parse_result.result_dict[section] if result == 'fail' ]
for section in results:
failed_testcases = [ "_".join(test.translate(trans).split()) for test in results[section] if results[section][test] == 'fail' ]
if failed_testcases:
failed_tests[section] = failed_testcases