[llvm-exegesis] Fix missing std::move.
[llvm-complete.git] / utils / release / findRegressions-nightly.py
blobddf89835e2c2d9631972dbbe39aeea4e2b7eee8a
1 #!/usr/bin/env python
2 import re, string, sys, os, time
4 DEBUG = 0
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_')
12 def parse(file):
13 f=open(file, 'r')
14 d = f.read()
16 #Cleanup weird stuff
17 d = re.sub(r',\d+:\d','', d)
19 r = re.findall(r'TEST-(PASS|FAIL|RESULT.*?):\s+(.*?)\s+(.*?)\r*\n', d)
21 test = {}
22 fname = ''
23 for t in r:
24 if DEBUG:
25 print t
26 if t[0] == 'PASS' or t[0] == 'FAIL' :
27 tmp = t[2].split(testDirName)
29 if DEBUG:
30 print tmp
32 if len(tmp) == 2:
33 fname = tmp[1].strip('\r\n')
34 else:
35 fname = tmp[0].strip('\r\n')
37 if not test.has_key(fname) :
38 test[fname] = {}
40 for k in test:
41 test[fname][k] = 'NA'
42 test[fname][t[1]] = t[0]
43 if DEBUG:
44 print test[fname][t[1]]
45 else :
46 try:
47 n = t[0].split('RESULT-')[1]
49 if DEBUG:
50 print n;
52 if n == 'llc' or n == 'jit-comptime' or n == 'compile':
53 test[fname][tp + n] = float(t[2].split(' ')[2])
54 if DEBUG:
55 print test[fname][tp + n]
57 elif n.endswith('-time') :
58 test[fname][exp + n] = float(t[2].strip('\r\n'))
59 if DEBUG:
60 print test[fname][exp + n]
62 else :
63 print "ERROR!"
64 sys.exit(1)
66 except:
67 continue
69 return test
71 # Diff results and look for regressions.
72 def diffResults(d_old, d_new):
74 for t in sorted(d_old.keys()) :
75 if DEBUG:
76 print t
78 if d_new.has_key(t) :
80 # Check if the test passed or failed.
81 for x in test:
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"
87 else:
88 if d_new[t][x] == 'PASS':
89 print t + " * NEW PASS (" + x + ")\n"
91 else :
92 print t + "*** REGRESSION (" + x + ")\n"
94 # For execution time, if there is no result, its a fail.
95 for x in exectime:
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"
100 else :
101 if d_new[t].has_key(tp + x):
102 print t + " * NEW PASS (" + tp + x + ")\n"
105 for x in comptime:
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"
110 else :
111 if d_new[t].has_key(exp + x):
112 print t + " * NEW PASS (" + exp + x + ")\n"
114 else :
115 print t + ": Removed from test-suite.\n"
118 #Main
119 if len(sys.argv) < 3 :
120 print 'Usage:', sys.argv[0], \
121 '<old log> <new log>'
122 sys.exit(-1)
124 d_old = parse(sys.argv[1])
125 d_new = parse(sys.argv[2])
128 diffResults(d_old, d_new)