Chromium Code Reviews| Index: wasm-run-torture-tests.py |
| diff --git a/wasm-run-torture-tests.py b/wasm-run-torture-tests.py |
| new file mode 100755 |
| index 0000000000000000000000000000000000000000..13aca8ccd3e68e6811903d3054e529a92349bcc4 |
| --- /dev/null |
| +++ b/wasm-run-torture-tests.py |
| @@ -0,0 +1,46 @@ |
| +#!/usr/bin/python3 |
|
JF
2016/03/28 18:17:14
I think the following is more common:
#!/usr/bin/e
Eric Holk
2016/03/29 19:54:12
Done.
|
| + |
| +import glob |
| +import os |
| +import sys |
| + |
| +success_count = 0 |
| +fail_count = 0 |
| +failures = [] |
| + |
| +def run_test(test_file, verbose=False): |
| + global success_count |
| + global fail_count |
| + |
| + cmd = "LD_LIBRARY_PATH=~/nacl/v8/out/native/lib.target ./pnacl-sz -filetype=asm -target=arm32 {} -threads=0 -O2 -verbose=wasm".format(test_file) |
|
Jim Stichnoth
2016/03/29 17:49:57
80-col
Yucky absolute paths.
-target=arm32???
M
Eric Holk
2016/03/29 22:58:07
Done.
|
| + |
| + if not verbose: |
| + cmd += " &> /dev/null" |
| + |
| + sys.stdout.write(test_file + "..."); |
| + status = os.system(cmd); |
| + if status != 0: |
| + fail_count += 1 |
| + print('\033[1;31m[fail]\033[1;m') |
| + failures.append(test_file) |
| + else: |
| + success_count += 1 |
| + print('\033[1;32m[ok]\033[1;m') |
| + |
| + |
| +verbose = False |
| + |
| +if len(sys.argv) > 1: |
| + test_files = sys.argv[1:] |
| + verbose = True |
| +else: |
| + test_files = glob.glob("./torture-s2wasm-sexpr-wasm/*.wasm") |
| + |
| +for test_file in test_files: |
| + run_test(test_file, verbose) |
| + |
| +if len(failures) > 0: |
| + print("Failures:") |
| + for f in failures: |
| + print(" \033[1;31m" + f + "\033[1;m") |
| +print("{} / {} tests passed".format(success_count, success_count + fail_count)) |