File: findRegressions-nightly.py

package info (click to toggle)
llvm-toolchain-14 1%3A14.0.6-12
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 1,496,180 kB
  • sloc: cpp: 5,593,972; ansic: 986,872; asm: 585,869; python: 184,223; objc: 72,530; lisp: 31,119; f90: 27,793; javascript: 9,780; pascal: 9,762; sh: 9,482; perl: 7,468; ml: 5,432; awk: 3,523; makefile: 2,538; xml: 953; cs: 573; fortran: 567
file content (132 lines) | stat: -rwxr-xr-x 3,190 bytes parent folder | download | duplicates (13)
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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
#!/usr/bin/env python3
from __future__ import print_function

import re, string, sys, os, time

DEBUG = 0
testDirName = 'llvm-test'
test      = ['compile', 'llc', 'jit', 'cbe']
exectime     = ['llc-time', 'jit-time', 'cbe-time',]
comptime     = ['llc', 'jit-comptime', 'compile']

(tp, exp) = ('compileTime_', 'executeTime_')

def parse(file):
  f=open(file, 'r')
  d = f.read()
  
  #Cleanup weird stuff
  d = re.sub(r',\d+:\d','', d)
   
  r = re.findall(r'TEST-(PASS|FAIL|RESULT.*?):\s+(.*?)\s+(.*?)\r*\n', d)
   
  test = {}
  fname = ''
  for t in r:
    if DEBUG:
      print(t)
    if t[0] == 'PASS' or t[0] == 'FAIL' :
      tmp = t[2].split(testDirName)
      
      if DEBUG:
        print(tmp)
      
      if len(tmp) == 2:
        fname = tmp[1].strip('\r\n')
      else:
        fname = tmp[0].strip('\r\n')
      
      if fname not in test :
        test[fname] = {}
      
      for k in test:
        test[fname][k] = 'NA'
        test[fname][t[1]] = t[0]
        if DEBUG:
          print(test[fname][t[1]])
    else :
      try:
        n = t[0].split('RESULT-')[1]
        
        if DEBUG:
          print(n);
        
        if n == 'llc' or n == 'jit-comptime' or n == 'compile':
          test[fname][tp + n] = float(t[2].split(' ')[2])
          if DEBUG:
            print(test[fname][tp + n])
        
        elif n.endswith('-time') :
            test[fname][exp + n] = float(t[2].strip('\r\n'))
            if DEBUG:
              print(test[fname][exp + n])
        
        else :
          print("ERROR!")
          sys.exit(1)
      
      except:
          continue

  return test

# Diff results and look for regressions.
def diffResults(d_old, d_new):

  for t in sorted(d_old.keys()) :
    if DEBUG:
      print(t)
        
    if t in d_new :
    
      # Check if the test passed or failed.
      for x in test:
        if x in d_old[t]:
          if x in d_new[t]:
            if d_old[t][x] == 'PASS':
              if d_new[t][x] != 'PASS':
                print(t + " *** REGRESSION (" + x + ")\n")
            else:
              if d_new[t][x] == 'PASS':
                print(t + " * NEW PASS (" + x + ")\n")
                
          else :
            print(t + "*** REGRESSION (" + x + ")\n")
        
        # For execution time, if there is no result, its a fail.
        for x in exectime:
          if tp + x in d_old[t]:
            if tp + x not in d_new[t]:
              print(t + " *** REGRESSION (" + tp + x + ")\n")
                
          else :
            if tp + x in d_new[t]:
              print(t + " * NEW PASS (" + tp + x + ")\n")

       
        for x in comptime:
          if exp + x in d_old[t]:
            if exp + x not in d_new[t]:
              print(t + " *** REGRESSION (" + exp + x + ")\n")
                
          else :
            if exp + x in d_new[t]:
              print(t + " * NEW PASS (" + exp + x + ")\n")
              
    else :
      print(t + ": Removed from test-suite.\n")
    

#Main
if len(sys.argv) < 3 :
    print('Usage:', sys.argv[0], \
          '<old log> <new log>')
    sys.exit(-1)

d_old = parse(sys.argv[1])
d_new = parse(sys.argv[2])


diffResults(d_old, d_new)