Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(50)

Unified Diff: pydir/wasm-run-torture-tests.py

Issue 1890283002: Subzero, Wasm: Link and run torture tests; bug fixes. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: Code review feedback Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « fetch-torture-tests.sh ('k') | runtime/wasm-runtime.c » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pydir/wasm-run-torture-tests.py
diff --git a/pydir/wasm-run-torture-tests.py b/pydir/wasm-run-torture-tests.py
index c55d94a50c424f04abbe1332acf41c967d4b16bc..7ad50c92667075e5e96c2e4ca75c0bfdcf5b988c 100755
--- a/pydir/wasm-run-torture-tests.py
+++ b/pydir/wasm-run-torture-tests.py
@@ -11,19 +11,68 @@
import glob
import os
+import shutil
import sys
-success_count = 0
-fail_count = 0
-failures = []
+IGNORED_TESTS = [
+ 'loop-2f.c.wasm', # mmap not in MVP
+ 'loop-2g.c.wasm', # mmap not in MVP
+
+ '960521-1.c.wasm', # sbrk not in MVP
+
+ 'pr36765.c.wasm', # __builtin_malloc not allowed
+
+ 'pr24716.c.wasm', # infinite loop
+ 'vla-dealloc-1.c.wasm', # infinite loop
+ '20040811-1.c.wasm', # infinite loop
+ '961125-1.c.wasm', # infinite loop
+ '980506-1.c.wasm', # infinite loop
+ '20070824-1.c.wasm', # infinite loop
+ '20140212-1.c.wasm', # infinite loop
+ 'pr59014.c.wasm', # infinite loop
+ 'pr58277-2.c.wasm', # infinite loop
+ 'pr43560.c.wasm', # infinite loop
+ '20000818-1.c.wasm', # infinite loop
+ '20010409-1.c.wasm', # infinite loop
+ 'loop-7.c.wasm', # infinite loop
+ 'pr34415.c.wasm', # infinite loop
+ '20011126-2.c.wasm', # infinite loop
+ 'postmod-1.c.wasm', # infinite loop
+ 'pr17133.c.wasm', # infinite loop
+ '20021024-1.c.wasm', # infinite loop
+ 'pr15296.c.wasm', # infinite loop
+ '990524-1.c.wasm', # infinite loop
+ 'loop-12.c.wasm', # infinite loop
+ '961125-1.c.wasm', # infinite loop
+]
+
+OUT_DIR = "./build/wasm-torture"
+
+compile_count = 0
+compile_failures = []
+
+run_count = 0
+run_failures = []
def run_test(test_file, verbose=False):
- global success_count
- global fail_count
+ global compile_count
+ global compile_failures
+ global run_count
+ global run_failures
+ global OUT_DIR
+ global IGNORED_TESTS
+
+ test_name = os.path.basename(test_file)
+ obj_file = os.path.join(OUT_DIR, test_name + ".o")
+ exe_file = os.path.join(OUT_DIR, test_name + ".exe")
+
+ if not verbose and test_name in IGNORED_TESTS:
+ print("\033[1;34mSkipping {}\033[1;m".format(test_file))
+ return
cmd = """LD_LIBRARY_PATH=../../../../v8/out/native/lib.target ./pnacl-sz \
- -filetype=asm -target=x8632 {} -threads=0 -O2 \
- -verbose=wasm""".format(test_file)
+ -filetype=obj -target=x8632 {} -threads=0 -O2 \
+ -verbose=wasm -o {}""".format(test_file, obj_file)
if not verbose:
cmd += " &> /dev/null"
@@ -31,13 +80,24 @@ def run_test(test_file, verbose=False):
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)
+ print('\033[1;31m[compile fail]\033[1;m')
+ compile_failures.append(test_file)
else:
- success_count += 1
- print('\033[1;32m[ok]\033[1;m')
+ compile_count += 1
+ # Try to link and run the program.
+ cmd = "clang -g -m32 {} -o {} ./runtime/wasm-runtime.c".format(obj_file,
+ exe_file)
+ if os.system(cmd) == 0:
+ if os.system(exe_file) == 0:
+ run_count += 1
+ print('\033[1;32m[ok]\033[1;m')
+ else:
+ run_failures.append(test_file)
+ print('\033[1;33m[run fail]\033[1;m')
+ else:
+ run_failures.append(test_file)
+ print('\033[1;33m[run fail]\033[1;m')
verbose = False
@@ -45,13 +105,29 @@ if len(sys.argv) > 1:
test_files = sys.argv[1:]
verbose = True
else:
- test_files = glob.glob("./torture-s2wasm-sexpr-wasm/*.wasm")
+ test_files = glob.glob("./emwasm-torture-out/*.wasm")
+
+if os.path.exists(OUT_DIR):
+ shutil.rmtree(OUT_DIR)
+os.mkdir(OUT_DIR)
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))
+if len(compile_failures) > 0:
+ print
+ print("Compilation failures:")
+ print("=====================\n")
+ for f in compile_failures:
+ print(" \033[1;31m" + f + "\033[1;m")
+
+if len(run_failures) > 0:
+ print
+ print("Run failures:")
+ print("=============\n")
+ for f in run_failures:
+ print(" \033[1;33m" + f + "\033[1;m")
+
+print("\n\033[1;32m{}\033[1;m / \033[1;33m{}\033[1;m / {} tests passed"
+ .format(run_count, compile_count - run_count,
+ run_count + len(compile_failures) + len(run_failures)))
« no previous file with comments | « fetch-torture-tests.sh ('k') | runtime/wasm-runtime.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698