-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathget_races.py
More file actions
38 lines (32 loc) · 979 Bytes
/
get_races.py
File metadata and controls
38 lines (32 loc) · 979 Bytes
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
import os
import re
import yaml
pattern = r'revision="([a-f0-9]{40})"'
pattern2 = r'^tools/run-tests\.py.*$'
pattern3 = r'^SUMMARY: ThreadSanitizer:.*$'
tests = {}
for f in os.listdir("logs"):
log = open(f"logs/{f}").read()
match = re.search(pattern, log)
if match:
commit = match.group(1)
else:
print(f"No commit found when parsing {f}")
cmds = re.findall(pattern2, log, re.MULTILINE)
if len(cmds) != 1:
print(f)
assert(len(cmds) == 1)
cmd = cmds[0]
races = list(set(re.findall(pattern3, log, re.MULTILINE)))
for race in races:
if commit not in tests.keys():
tests[commit] = { cmd: [race] }
else:
if cmd not in tests[commit].keys():
tests[commit][cmd] = [race]
else:
tests[commit][cmd].append(race)
# print(tests)
print("Num commits:", len(tests.keys()))
# print(list(tests.keys()))
yaml.dump(tests, open("races.yaml", "w"))