-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrun_test.py
More file actions
executable file
·67 lines (57 loc) · 1.69 KB
/
run_test.py
File metadata and controls
executable file
·67 lines (57 loc) · 1.69 KB
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
#!/usr/bin/env python3
import sys
import os
test_di = '.'
if len(sys.argv) > 1:
test_di = sys.argv[1]
if not os.path.exists(test_di):
print('Bad path given: {} does not exist'.format(test_di))
sys.exit(1)
ref = 0
if len(sys.argv) > 2:
key = sys.argv[2]
if not key == 'ref':
print('{} is not the valid keyword to change the references (ref)'.format(key))
sys.exit(1)
ref = 1
list_test = os.popen('find {} -name run.sh'.format(test_di) + ' -exec dirname "{}" \\;').read().strip('\n').split()
cwd = os.getcwd()
exit_code = 0
for test in list_test:
print(20*'-')
print(test)
os.chdir(test)
code = os.system('./run.sh')
if code != 0:
exit_code = 1
print('')
if ref:
print('=> RUN FAILED, UPDATE IMPOSSIBLE')
else:
print('=> RUN FAILED')
else:
failed = False
list_ref = os.popen('find ref/ -type f').read().strip('\n').split()
for fi in list_ref:
fi_new = fi[4:]
if not os.path.exists(fi_new):
if not failed: failed = True
command = 'diff {} {}'.format(fi_new, fi)
diff = os.popen(command).read().strip('\n')
if len(diff):
if not failed: failed = True
print('')
print(command)
print(diff)
if ref:
command = 'cp {} {}'.format(fi_new, fi)
os.system(command)
if failed:
exit_code = 1
print('')
if ref:
print('=> FAILED, UPDATED')
else:
print('=> FAILED')
os.chdir(cwd)
sys.exit(exit_code)