|
| 1 | +#!/usr/bin/env python |
| 2 | + |
| 3 | +import subprocess, glob, sys, os |
| 4 | + |
| 5 | +if len(sys.argv) > 1: |
| 6 | + tests = sys.argv[1:] |
| 7 | +else: |
| 8 | + tests = filter(lambda x: x[0].isdigit(), glob.glob('*.c')) |
| 9 | +print '' |
| 10 | +print '---------------------------------- ' + os.path.basename(os.getcwd()) + '/ ----------------------------------' |
| 11 | +print 'Running ' + str(len(tests)) + ' tests: ' + str(tests) + ' in ' + os.getcwd() |
| 12 | +print '' |
| 13 | + |
| 14 | +successes = [] |
| 15 | +failures = [] |
| 16 | +indeterminate = [] |
| 17 | +skipped = [] |
| 18 | + |
| 19 | +for f in tests: |
| 20 | + out = f.replace('.c', '.html') |
| 21 | + cmd = ['emcc', f, '-lpthread', '-Wno-format-security', '-s', 'TOTAL_MEMORY=268435456', '-s', 'PTHREAD_POOL_SIZE=40', '-o', out, '-I../../../include', '--emrun'] |
| 22 | + print ' '.join(cmd) |
| 23 | + subprocess.call(cmd) |
| 24 | + cmd = ['emrun', '--kill_start', '--kill_exit', '--timeout=15', '--silence_timeout=15', '--browser=/Users/jjylanki/mozilla-inbound-2/obj-x86_64-apple-darwin14.0.0/dist/Nightly.app/Contents/MacOS/firefox', out] |
| 25 | + #print ' '.join(cmd) |
| 26 | + proc = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE) |
| 27 | + (stdout, stderr) = proc.communicate() |
| 28 | + stdout = '\n'.join(filter(lambda x: not x.startswith('2015-'), stdout.split('\n'))) |
| 29 | + stderr = '\n'.join(filter(lambda x: not x.startswith('2015-'), stderr.split('\n'))) |
| 30 | + stdout = stdout.strip() |
| 31 | + stderr = stderr.strip() |
| 32 | + if 'test skipped' in stdout.lower(): |
| 33 | + skipped += [f] |
| 34 | + reason = '\n'.join(filter(lambda x: 'Test SKIPPED' in x, stdout.split('\n'))) |
| 35 | + print reason.strip() |
| 36 | + elif proc.returncode == 0 and ('test pass' in stdout.lower() or 'Test executed successfully.' in stdout): |
| 37 | + successes += [f] |
| 38 | + print 'PASS' |
| 39 | + elif proc.returncode != 0: |
| 40 | + failures += [f] |
| 41 | + print 'FAILED:' |
| 42 | +# print 'stdout:' |
| 43 | + if len(stdout) > 0: print stdout |
| 44 | +# print '' |
| 45 | +# print 'stderr:' |
| 46 | + print stderr |
| 47 | + else: |
| 48 | + indeterminate += [f] |
| 49 | + print 'UNKNOWN:' |
| 50 | +# print 'stdout:' |
| 51 | + if len(stdout) > 0: print stdout |
| 52 | +# print '' |
| 53 | +# print 'stderr:' |
| 54 | + print stderr |
| 55 | + print '' |
| 56 | + |
| 57 | +print '=== FINISHED ===' |
| 58 | +if len(successes) > 0: |
| 59 | + print str(len(successes)) + ' tests passed: ' |
| 60 | + print ', '.join(successes) |
| 61 | + print '' |
| 62 | + |
| 63 | +if len(failures) > 0: |
| 64 | + print str(len(failures)) + ' tests failed: ' |
| 65 | + print ', '.join(failures) |
| 66 | + print '' |
| 67 | + |
| 68 | +if len(indeterminate) > 0: |
| 69 | + print str(len(indeterminate)) + ' tests finished with unknown result: ' |
| 70 | + print ', '.join(indeterminate) |
| 71 | + print '' |
| 72 | + |
| 73 | +if len(skipped) > 0: |
| 74 | + print str(len(skipped)) + ' tests skipped: ' |
| 75 | + print ', '.join(skipped) |
| 76 | + print '' |
| 77 | +print '' |
| 78 | +print '' |
0 commit comments