-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathparse_litmus_test_results.py
78 lines (68 loc) · 3.19 KB
/
parse_litmus_test_results.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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
#!/usr/bin/env python
################################################################################
## PipeCheck: Specifying and Verifying Microarchitectural ##
## Enforcement of Memory Consistency Models ##
## ##
## Copyright (c) 2014 Daniel Lustig, Princeton University ##
## All rights reserved. ##
## ##
## This library is free software; you can redistribute it and/or ##
## modify it under the terms of the GNU Lesser General Public ##
## License as published by the Free Software Foundation; either ##
## version 2.1 of the License, or (at your option) any later version. ##
## ##
## This library is distributed in the hope that it will be useful, ##
## but WITHOUT ANY WARRANTY; without even the implied warranty of ##
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ##
## Lesser General Public License for more details. ##
## ##
## You should have received a copy of the GNU Lesser General Public ##
## License along with this library; if not, write to the Free Software ##
## Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 ##
## USA ##
################################################################################
import sys
import re
idens = {}
results = {}
expecteds = {}
for ln in sys.stdin:
match = re.search("(^[0-9]*)_([A-Za-z0-9-]*_*[A-Za-z0-9*]*)__([A-Za-z0-9-]*_*[A-Za-z0-9-]*)_.*label=.(....).*exp: (....)", ln)
if not match:
sys.stderr.write("Could not parse line: %s" % ln)
continue
iden = match.group(1)
proc = match.group(2)
test = match.group(3)
result = match.group(4)
expected = match.group(5)
#sys.stdout.write("Line: %sResult: %s: %s: %s (%s)\n" % (ln, proc, test, result, expected))
if proc not in results:
idens[proc] = {}
results[proc] = {}
expecteds[proc] = {}
if test in results[proc]:
if result <> results[proc][test]:
sys.stderr.write("Inconsistency! %s" % ln)
results[proc][test] = "?"
else:
idens[proc][test] = iden
results[proc][test] = result
expecteds[proc][test] = expected
for (proc, s) in results.items():
try:
for (test, result) in sorted(s.items()):
expected = expecteds[proc][test]
iden = idens[proc][test]
if expected == "Forb" and result == "Perm":
sys.stdout.write("(bug?) \t")
elif expected == "Perm" and result == "Forb":
sys.stdout.write("(strict)\t")
elif expected <> result:
sys.stdout.write("?? \t")
else:
sys.stdout.write(" \t")
sys.stdout.write("%s: %s: %s (test %s) (expected: %s)\n" %
(proc, test, result, iden, expected))
except:
print s