1 | """Validate_all.py |
---|
2 | """ |
---|
3 | |
---|
4 | import os, time, sys |
---|
5 | |
---|
6 | |
---|
7 | #dirs_to_skip = ['.', 'okushiri_tank_validation_ver1', 'patong_beach_validation'] |
---|
8 | dirs_to_skip = ['.', 'okushiri_tank_validation_ver1'] |
---|
9 | validation_dirs_and_files = [] |
---|
10 | |
---|
11 | |
---|
12 | for dirpath, dirnames, filenames in os.walk('.'): |
---|
13 | |
---|
14 | if '.svn' in dirnames: |
---|
15 | dirnames.remove('.svn') # don't visit SVN directories |
---|
16 | |
---|
17 | dir = os.path.split(dirpath)[-1] |
---|
18 | if dir in dirs_to_skip: |
---|
19 | #print 'Skipping %s' % dirpath |
---|
20 | continue |
---|
21 | |
---|
22 | #print 'Searching dir', dirpath |
---|
23 | |
---|
24 | |
---|
25 | for filename in filenames: |
---|
26 | if filename.startswith('validate') and filename.endswith('.py'): |
---|
27 | #print 'Found %s in %s' %(filename, dirpath) |
---|
28 | validation_dirs_and_files.append((dirpath, filename)) |
---|
29 | |
---|
30 | # get repeatable order on different machines |
---|
31 | validation_dirs_and_files.sort() |
---|
32 | |
---|
33 | |
---|
34 | print |
---|
35 | print '---------------------------------------------------------' |
---|
36 | print 'Running all validation tests - some may take several days' |
---|
37 | print 'and some may require memory in the order of 8-16GB ' |
---|
38 | print '---------------------------------------------------------' |
---|
39 | |
---|
40 | print 'Validation test suites:' |
---|
41 | for path, filename in validation_dirs_and_files: |
---|
42 | print ' ', os.path.join(path, filename) |
---|
43 | print |
---|
44 | print |
---|
45 | |
---|
46 | t0 = time.time() |
---|
47 | for path, filename in validation_dirs_and_files: |
---|
48 | # print 'filename path', path, filename |
---|
49 | |
---|
50 | os.chdir(path) |
---|
51 | s = 'python %s' % filename |
---|
52 | print s |
---|
53 | os.system(s) |
---|
54 | |
---|
55 | # Back to parent directory |
---|
56 | os.chdir(os.pardir) |
---|
57 | |
---|
58 | # print 'current dir', os.getcwd() |
---|
59 | |
---|
60 | print 'That took %.2f seconds in total' %(time.time()-t0) |
---|
61 | |
---|
62 | |
---|
63 | |
---|
64 | |
---|
65 | if sys.platform == 'win32': |
---|
66 | raw_input('Press any key') |
---|