2 from __future__
import print_function
4 import re
, string
, sys
, os
, time
7 testDirName
= 'llvm-test'
8 test
= ['compile', 'llc', 'jit', 'cbe']
9 exectime
= ['llc-time', 'jit-time', 'cbe-time',]
10 comptime
= ['llc', 'jit-comptime', 'compile']
12 (tp
, exp
) = ('compileTime_', 'executeTime_')
19 d
= re
.sub(r
',\d+:\d','', d
)
21 r
= re
.findall(r
'TEST-(PASS|FAIL|RESULT.*?):\s+(.*?)\s+(.*?)\r*\n', d
)
28 if t
[0] == 'PASS' or t
[0] == 'FAIL' :
29 tmp
= t
[2].split(testDirName
)
35 fname
= tmp
[1].strip('\r\n')
37 fname
= tmp
[0].strip('\r\n')
39 if fname
not in test
:
44 test
[fname
][t
[1]] = t
[0]
46 print(test
[fname
][t
[1]])
49 n
= t
[0].split('RESULT-')[1]
54 if n
== 'llc' or n
== 'jit-comptime' or n
== 'compile':
55 test
[fname
][tp
+ n
] = float(t
[2].split(' ')[2])
57 print(test
[fname
][tp
+ n
])
59 elif n
.endswith('-time') :
60 test
[fname
][exp
+ n
] = float(t
[2].strip('\r\n'))
62 print(test
[fname
][exp
+ n
])
73 # Diff results and look for regressions.
74 def diffResults(d_old
, d_new
):
76 for t
in sorted(d_old
.keys()) :
82 # Check if the test passed or failed.
86 if d_old
[t
][x
] == 'PASS':
87 if d_new
[t
][x
] != 'PASS':
88 print(t
+ " *** REGRESSION (" + x
+ ")\n")
90 if d_new
[t
][x
] == 'PASS':
91 print(t
+ " * NEW PASS (" + x
+ ")\n")
94 print(t
+ "*** REGRESSION (" + x
+ ")\n")
96 # For execution time, if there is no result, its a fail.
98 if tp
+ x
in d_old
[t
]:
99 if tp
+ x
not in d_new
[t
]:
100 print(t
+ " *** REGRESSION (" + tp
+ x
+ ")\n")
103 if tp
+ x
in d_new
[t
]:
104 print(t
+ " * NEW PASS (" + tp
+ x
+ ")\n")
108 if exp
+ x
in d_old
[t
]:
109 if exp
+ x
not in d_new
[t
]:
110 print(t
+ " *** REGRESSION (" + exp
+ x
+ ")\n")
113 if exp
+ x
in d_new
[t
]:
114 print(t
+ " * NEW PASS (" + exp
+ x
+ ")\n")
117 print(t
+ ": Removed from test-suite.\n")
121 if len(sys
.argv
) < 3 :
122 print('Usage:', sys
.argv
[0], \
123 '<old log> <new log>')
126 d_old
= parse(sys
.argv
[1])
127 d_new
= parse(sys
.argv
[2])
130 diffResults(d_old
, d_new
)