-
Notifications
You must be signed in to change notification settings - Fork 0
/
parse-bsa-log.py
executable file
·56 lines (42 loc) · 1.65 KB
/
parse-bsa-log.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
#!/usr/bin/python3
import sys
import yaml
with open("status-bsa.yml", encoding="utf-8") as yml:
status_bsa = yaml.safe_load(yml)
if len(sys.argv) < 3:
print("Give me: logfile corename")
sys.exit(-1)
core_name = sys.argv[2]
start_parsing = False
with open(sys.argv[1], encoding="utf-8") as bsa_acs_log:
test_id = 0
test_title = ""
while True:
line = bsa_acs_log.readline()
if not start_parsing and "Starting PE tests" in line:
start_parsing = True
if start_parsing:
if "START" in line:
# BSA ACS output changed:
# 1 : Check Arch symmetry across PE
# START
test_id, test_title = prev_line.strip().split(" : ")
test_id = int(test_id)
try:
tmp = status_bsa[test_id]
except KeyError:
status_bsa[test_id] = {"tags": "", "title": "",
"status": {core_name: ""}}
if test_id and line.strip().startswith(("B_", "ITS_", "PCI_")):
test_tags = line.strip()
status_bsa[test_id]["tags"] = test_tags
status_bsa[test_id]["title"] = test_title
if 'Result:' in line:
result = line.split(':')[-1].strip()
status_bsa[test_id]["status"][core_name] = result
if line.strip().startswith("Total Tests run"):
break
# we need previous line to extract test id/title
prev_line = line
with open("status-bsa.yml", "w", encoding="utf-8") as yml:
yaml.dump(status_bsa, yml)