2 import re
, string
, sys
, os
, time
5 testDirName
= 'llvm-test'
6 test
= ['compile', 'llc', 'jit', 'cbe']
7 exectime
= ['llc-time', 'jit-time', 'cbe-time',]
8 comptime
= ['llc', 'jit-comptime', 'compile']
10 (tp
, exp
) = ('compileTime_', 'executeTime_')
17 d
= re
.sub(r
',\d+:\d','', d
)
19 r
= re
.findall(r
'TEST-(PASS|FAIL|RESULT.*?):\s+(.*?)\s+(.*?)\r*\n', d
)
26 if t
[0] == 'PASS' or t
[0] == 'FAIL' :
27 tmp
= t
[2].split(testDirName
)
33 fname
= tmp
[1].strip('\r\n')
35 fname
= tmp
[0].strip('\r\n')
37 if not test
.has_key(fname
) :
42 test
[fname
][t
[1]] = t
[0]
44 print test
[fname
][t
[1]]
47 n
= t
[0].split('RESULT-')[1]
52 if n
== 'llc' or n
== 'jit-comptime' or n
== 'compile':
53 test
[fname
][tp
+ n
] = float(t
[2].split(' ')[2])
55 print test
[fname
][tp
+ n
]
57 elif n
.endswith('-time') :
58 test
[fname
][exp
+ n
] = float(t
[2].strip('\r\n'))
60 print test
[fname
][exp
+ n
]
71 # Diff results and look for regressions.
72 def diffResults(d_old
, d_new
):
74 for t
in sorted(d_old
.keys()) :
80 # Check if the test passed or failed.
82 if d_old
[t
].has_key(x
):
83 if d_new
[t
].has_key(x
):
84 if d_old
[t
][x
] == 'PASS':
85 if d_new
[t
][x
] != 'PASS':
86 print t
+ " *** REGRESSION (" + x
+ ")\n"
88 if d_new
[t
][x
] == 'PASS':
89 print t
+ " * NEW PASS (" + x
+ ")\n"
92 print t
+ "*** REGRESSION (" + x
+ ")\n"
94 # For execution time, if there is no result, its a fail.
96 if d_old
[t
].has_key(tp
+ x
):
97 if not d_new
[t
].has_key(tp
+ x
):
98 print t
+ " *** REGRESSION (" + tp
+ x
+ ")\n"
101 if d_new
[t
].has_key(tp
+ x
):
102 print t
+ " * NEW PASS (" + tp
+ x
+ ")\n"
106 if d_old
[t
].has_key(exp
+ x
):
107 if not d_new
[t
].has_key(exp
+ x
):
108 print t
+ " *** REGRESSION (" + exp
+ x
+ ")\n"
111 if d_new
[t
].has_key(exp
+ x
):
112 print t
+ " * NEW PASS (" + exp
+ x
+ ")\n"
115 print t
+ ": Removed from test-suite.\n"
119 if len(sys
.argv
) < 3 :
120 print 'Usage:', sys
.argv
[0], \
121 '<old log> <new log>'
124 d_old
= parse(sys
.argv
[1])
125 d_new
= parse(sys
.argv
[2])
128 diffResults(d_old
, d_new
)