diff options
author | 2022-08-14 11:49:05 +0800 | |
---|---|---|
committer | 2022-08-14 11:49:05 +0800 | |
commit | 4bc58fc5cc29a5deae8ede984ab8e68e7874f615 (patch) | |
tree | 06d92e1f36c4af4da169e36141bff0c607905e63 /tests/openssl/parser.py | |
parent | 4f19f467865cd3b6b49ce5c39502a031525cfc16 (diff) |
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 <yanxk.fnst@fujitsu.com>
Change-Id: Id28a36ce081e8cfb49dcb7af8db369244f1fd258
Diffstat (limited to 'tests/openssl/parser.py')
-rw-r--r-- | tests/openssl/parser.py | 41 |
1 files changed, 41 insertions, 0 deletions
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 |