[3706] | 1 | """Validate_all.py |
---|
| 2 | """ |
---|
| 3 | |
---|
[6417] | 4 | import os, time, sys |
---|
[3929] | 5 | |
---|
| 6 | |
---|
[7652] | 7 | #dirs_to_skip = ['.', 'okushiri_tank_validation_ver1', 'patong_beach_validation'] |
---|
| 8 | dirs_to_skip = ['.', 'okushiri_tank_validation_ver1'] |
---|
[3929] | 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: |
---|
[7652] | 19 | #print 'Skipping %s' % dirpath |
---|
[3929] | 20 | continue |
---|
| 21 | |
---|
[7652] | 22 | #print 'Searching dir', dirpath |
---|
[3929] | 23 | |
---|
| 24 | |
---|
| 25 | for filename in filenames: |
---|
| 26 | if filename.startswith('validate') and filename.endswith('.py'): |
---|
[7652] | 27 | #print 'Found %s in %s' %(filename, dirpath) |
---|
[3929] | 28 | validation_dirs_and_files.append((dirpath, filename)) |
---|
| 29 | |
---|
[7291] | 30 | # get repeatable order on different machines |
---|
| 31 | validation_dirs_and_files.sort() |
---|
[3929] | 32 | |
---|
[7291] | 33 | |
---|
[5290] | 34 | print |
---|
[7652] | 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 '---------------------------------------------------------' |
---|
[3929] | 39 | |
---|
[7652] | 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 | |
---|
[5291] | 46 | t0 = time.time() |
---|
[3929] | 47 | for path, filename in validation_dirs_and_files: |
---|
[4842] | 48 | # print 'filename path', path, filename |
---|
[4409] | 49 | |
---|
[4183] | 50 | os.chdir(path) |
---|
[7652] | 51 | s = 'python %s' % filename |
---|
[5290] | 52 | print s |
---|
[3929] | 53 | os.system(s) |
---|
[4403] | 54 | |
---|
[4810] | 55 | # Back to parent directory |
---|
[4409] | 56 | os.chdir(os.pardir) |
---|
| 57 | |
---|
[4842] | 58 | # print 'current dir', os.getcwd() |
---|
[4403] | 59 | |
---|
[5291] | 60 | print 'That took %.2f seconds in total' %(time.time()-t0) |
---|
[4409] | 61 | |
---|
[4403] | 62 | |
---|
[3929] | 63 | |
---|
[6417] | 64 | |
---|
| 65 | if sys.platform == 'win32': |
---|
| 66 | raw_input('Press any key') |
---|