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