From 4bc58fc5cc29a5deae8ede984ab8e68e7874f615 Mon Sep 17 00:00:00 2001 From: yanxk Date: Sun, 14 Aug 2022 11:49:05 +0800 Subject: agl-test-framework: enable ptest of 'openssl' Base on the agl-test-framework, the ptest results of 'openssl' can now be collected, analyzed and then reported. Here are 3 samples that the output result might look like: tests/openssl/run_tests.py::test_openssl[30-test_evp_fetch_prov] PASSED tests/openssl/run_tests.py::test_openssl[30-test_evp_kdf] PASSED tests/openssl/run_tests.py::test_openssl[30-test_evp_libctx] PASSED Bug-AGL: SPEC-4345 Signed-off-by: yanxk Change-Id: Id28a36ce081e8cfb49dcb7af8db369244f1fd258 --- tests/openssl/parser.py | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 tests/openssl/parser.py (limited to 'tests/openssl/parser.py') diff --git a/tests/openssl/parser.py b/tests/openssl/parser.py new file mode 100644 index 0000000..9bf8f67 --- /dev/null +++ b/tests/openssl/parser.py @@ -0,0 +1,41 @@ +# +# this is a parser function specially designed for the 'openssl.log' +# +import re + +def log_parse(log_file): + # set up rule for regex, default one, failed cases are not collected + reObj = re.compile('^(PASS|SKIP+?):\\s.*(\\d{2}-test_.+)[.]t', re.MULTILINE) + + # init a dictionary, it stores the return result + case_list = dict() + + # open file + test_log = open(log_file, 'r') + + # start to read the new line + line = test_log.readline() + + while line: + # specially switch regex rule to a new one in fit of the 'FAILED' cases + if("Test Summary Report" in line): + reObj = re.compile('^(\\d{2}-test_.+)[.]t', re.MULTILINE) + + # checking regex status in line + matchs = reObj.search(line) + + # if the line fits the regex rule + if matchs: + # spliting elements into a tuple + groups = matchs.groups() + if(len(groups) == 1): + case_list[groups[0]] = [groups[0], "FAIL", ""] + else: + case_list[groups[1]] = [groups[1], groups[0], ""] + + # jump out if-else, read next line + line = test_log.readline() + + test_log.close() + + return case_list -- cgit