2 import re, string, sys, os, time, math
6 (tp, exp) = ('compile', 'exec')
13 d = re.sub(r',\d+:\d', '', d)
15 r = re.findall(r'TEST-(PASS|FAIL|RESULT.*?):\s+(.*?)\s+(.*?)\r*\n', d)
23 if t[0] == 'PASS' or t[0] == 'FAIL' :
24 tmp = t[2].split('llvm-test/')
30 fname = tmp[1].strip('\r\n')
32 fname = tmp[0].strip('\r\n')
34 if not test.has_key(fname):
37 test[fname][t[1] + ' state'] = t[0]
38 test[fname][t[1] + ' time'] = float('nan')
41 n = t[0].split('RESULT-')[1]
46 if n == 'compile-success':
47 test[fname]['compile time'] = float(t[2].split('program')[1].strip('\r\n'))
49 elif n == 'exec-success':
50 test[fname]['exec time'] = float(t[2].split('program')[1].strip('\r\n'))
52 print test[fname][string.replace(n, '-success', '')]
63 # Diff results and look for regressions.
64 def diffResults(d_old, d_new):
66 for t in sorted(d_old.keys()) :
69 # Check if the test passed or failed.
70 for x in ['compile state', 'compile time', 'exec state', 'exec time']:
72 if not d_old[t].has_key(x) and not d_new[t].has_key(x):
75 if d_old[t].has_key(x):
76 if d_new[t].has_key(x):
78 if d_old[t][x] == 'PASS':
79 if d_new[t][x] != 'PASS':
80 print t + " *** REGRESSION (" + x + " now fails)"
82 if d_new[t][x] == 'PASS':
83 print t + " * NEW PASS (" + x + " now fails)"
86 print t + "*** REGRESSION (" + x + " now fails)"
88 if x == 'compile state' or x == 'exec state':
91 # For execution time, if there is no result it's a fail.
92 if not d_old[t].has_key(x) and not d_new[t].has_key(x):
94 elif not d_new[t].has_key(x):
95 print t + " *** REGRESSION (" + x + ")"
96 elif not d_old[t].has_key(x):
97 print t + " * NEW PASS (" + x + ")"
99 if math.isnan(d_old[t][x]) and math.isnan(d_new[t][x]):
102 elif math.isnan(d_old[t][x]) and not math.isnan(d_new[t][x]):
103 print t + " * NEW PASS (" + x + ")"
105 elif not math.isnan(d_old[t][x]) and math.isnan(d_new[t][x]):
106 print t + " *** REGRESSION (" + x + ")"
108 if d_new[t][x] > d_old[t][x] and d_old[t][x] > 0.0 and \
109 (d_new[t][x] - d_old[t][x]) / d_old[t][x] > .05:
110 print t + " *** REGRESSION (" + x + ")"
113 print t + ": Removed from test-suite."
116 if len(sys.argv) < 3 :
117 print 'Usage:', sys.argv[0], '<old log> <new log>'
120 d_old = parse(sys.argv[1])
121 d_new = parse(sys.argv[2])
123 diffResults(d_old, d_new)