-
Notifications
You must be signed in to change notification settings - Fork 31
Expand file tree
/
Copy pathfindAndRunNextTests
More file actions
executable file
·55 lines (47 loc) · 1.49 KB
/
findAndRunNextTests
File metadata and controls
executable file
·55 lines (47 loc) · 1.49 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
#! /usr/bin/python
from subprocess import call
import os
# searchRoot = './plt'
searchRoot = '.'
def getCmd(tst):
return ['ant', '-Dtest-spec={}'.format(tst), 'test']
def backup_found_list():
with open('testsRunSoFar', 'r') as f, open('testsRunSoFar_backup', 'w') as g:
g.write(f.read())
def add_skipped_test(tst):
with open('skippedTests', 'a') as f:
f.write(tst + '\n')
def find_next_test():
with open('testsRunSoFar', 'r') as f:
alreadyRun = [t for t in f.read().split('\n') if t]
if not alreadyRun:
print 'error fetching list of tests which have already been run...'
else:
for (path, dirs, files) in os.walk(searchRoot):
for f in files:
if f.endswith('Test.java') and f.replace('.java','') not in alreadyRun:
if f.lower().find('indent') == -1 and path.lower().find('indent') == -1:
return f.replace('.java', '')
# temporary hack to avoid all indentation-related tests
else:
add_skipped_test(f)
print "couldn't find any more tests to run..."
return 0
def run_next_test():
tst = find_next_test()
if tst:
print 'testing:', tst
res = call(getCmd(tst))
if res:
print tst, 'FAILED.'
else:
with open('testsRunSoFar', 'a') as f:
f.write(tst + '\n')
print tst, 'PASSED. adding it to list of tests already run'
return 1
return 0
open('skippedTests', 'w').close()
backup_found_list()
keep_going = 1
while keep_going:
keep_going = run_next_test()