From 54d4694f328a4ae07955aa68dcb6d3c183ed2edd Mon Sep 17 00:00:00 2001 From: Richard Purdie Date: Tue, 29 Jan 2019 15:08:58 +0000 Subject: 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 --- meta/lib/oeqa/runtime/cases/ptest.py | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'meta/lib/oeqa/runtime') diff --git a/meta/lib/oeqa/runtime/cases/ptest.py b/meta/lib/oeqa/runtime/cases/ptest.py index 3cfd7af7e2..2843953b38 100644 --- a/meta/lib/oeqa/runtime/cases/ptest.py +++ b/meta/lib/oeqa/runtime/cases/ptest.py @@ -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 -- cgit v1.2.3-54-g00ecf