-
Notifications
You must be signed in to change notification settings - Fork 0
/
llvm-run.py
59 lines (48 loc) · 1.88 KB
/
llvm-run.py
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
from RecBi.llvm import *
from RecBi.util import metrics
from configparser import ConfigParser
cfg = ConfigParser()
cfg.read('config/config.ini')
configFile = cfg.get('llvm-locations', 'configFile')
bugList = cfg.get('llvm-locations', 'bugList')
compilersdir = cfg.get('llvm-locations', 'compilersdir')
infodir = cfg.get('llvm-locations', 'infodir')
revisions = []
bugIds = []
rights = []
wrongs = []
checkpasses = []
revfile = open(bugList)
revlines = revfile.readlines()
revfile.close()
for i in range(len(revlines)):
bugIds.append(revlines[i].strip().split(',')[0])
revisions.append(revlines[i].strip().split(',')[1])
rights.append(revlines[i].strip().split(',')[2])
wrongs.append(revlines[i].strip().split(',')[3])
checkpasses.append(revlines[i].strip().split(',')[4])
reduced = cfg.get('llvm-rev', 'reduced').split(',')
#print(reduced)
bugIds = list(set(bugIds) - set(reduced))
mode = cfg.get('mode', 'mode')
if mode != 'verification' and mode != 'utilization':
raise Exception('Unknown mode... Please check config.ini and correct it.')
print('\033[1;35m Begin batchrun\033[0m')
batchrun(bugIds, revisions, rights, wrongs, checkpasses, configFile)
print('\033[1;35m Begin delete\033[0m')
delete(configFile)
if mode == 'verification':
print('\033[1;35m mode::verification\033[0m')
print('\033[1;35m Begin rank\033[0m')
rank(revisions, bugIds, configFile)
print('\033[1;35m Begin analyze\033[0m')
finallist = analyze(configFile)
result = metrics(finallist)
print('\033[1;35m finallist = ', finallist,'\033[0m')
print('\033[1;35m result = ', result,'\033[0m')
elif mode == 'utilization':
print('\033[1;35m mode::utilization\033[0m')
print('\033[1;35m Begin rank_\033[0m')
rank_(revisions, bugIds, configFile)
rankFile = cfg.get('llvm-locations', 'rankFile')
print('\033[1;35m Ranking list has been recorded in ', rankFile,'\033[0m')