-
Notifications
You must be signed in to change notification settings - Fork 0
/
bash_process.py
123 lines (112 loc) · 2.96 KB
/
bash_process.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
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
import json
import js2py
import os, sys
import divide_ob
import copy
import simulation
import time
def jsjiami_recover():
names = os.listdir('./jsdata/rand_jsjiami')
totTime = [0, 0, 0, 0]
counter = 0
for name in names:
if not name.endswith('.js'):
continue
try:
tempTime = simulation.simulate(name)
for i in range(4):
totTime[i] = totTime[i] + tempTime[i]
counter = counter + 1
except:
print(name)
print('Res :')
print(totTime)
print(counter)
def ob_recover():
names = os.listdir('./jsdata/rand_ob')
totTime = [0, 0, 0, 0, 0, 0]
counter = 0
for name in names:
if not name.endswith('.js'):
continue
try:
tempTime = simulation.simulate2(name)
# tempTime = simulation.simulate(name)
for i in range(6):
totTime[i] = totTime[i] + tempTime[i]
counter = counter + 1
except:
print(name)
print('Res :')
print(totTime)
print(counter)
def eval_js1():
inputPath = './test/beautify/'
files = os.listdir(inputPath)
for item in files:
if not item.endswith('.js'):
continue
try:
os.system('node eval_beautify.js ./test/beautify/' + item + ' > ./test/beautify-res/' + item)
except:
print('Fail name : ' + item)
continue
def eval_eso():
names = os.listdir('./esoteric/esoteric/')
totTime = [0, 0, 0, 0]
counter = 0
for name in names:
if not name.endswith('.js'):
continue
try:
tempTime = simulation.simulate(name)
for i in range(4):
totTime[i] = totTime[i] + tempTime[i]
counter = counter + 1
except:
print(name)
print('Res :')
print(totTime)
print(counter)
names = os.listdir('./esoteric/fk/')
totTime = [0, 0, 0, 0]
counter = 0
for name in names:
if not name.endswith('.js'):
continue
try:
tempTime = simulation.simulate(name)
for i in range(4):
totTime[i] = totTime[i] + tempTime[i]
counter = counter + 1
except:
print(name)
print('Res :')
print(totTime)
print(counter)
def eval_ugly():
names = os.listdir('./ugly/ugly')
totTime = [0, 0, 0, 0]
counter = 0
for name in names:
if not name.endswith('.js'):
continue
try:
tempTime = simulation.simulate(name)
for i in range(4):
totTime[i] = totTime[i] + tempTime[i]
counter = counter + 1
except:
print(name)
print('Res :')
print(totTime)
print(counter)
if __name__ == '__main__':
st = time.time()
jsjiami_recover()
ob_recover()
eval_js1()
eval_ugly()
eval_eso()
end = time.time()
print('time: ', end - st)