summaryrefslogtreecommitdiff
path: root/test/update-spec-tests.py
diff options
context:
space:
mode:
authorBen Smith <binjimin@gmail.com>2018-08-14 11:23:02 -0700
committerGitHub <noreply@github.com>2018-08-14 11:23:02 -0700
commit0d683b182258b1e04cbbcfb319f0107b6790df36 (patch)
tree737e0df849e285f8d50649144963e7403be0360a /test/update-spec-tests.py
parent69a7704723176ad656db8b79cd2146f456d36fbd (diff)
downloadwabt-0d683b182258b1e04cbbcfb319f0107b6790df36.tar.gz
wabt-0d683b182258b1e04cbbcfb319f0107b6790df36.tar.bz2
wabt-0d683b182258b1e04cbbcfb319f0107b6790df36.zip
[wasm2c] Add spec tests; fix update-spec-tests.py (#891)
`update-spec-tests.py` now will update the tests in the `test/wasm2c/spec` directory.
Diffstat (limited to 'test/update-spec-tests.py')
-rwxr-xr-xtest/update-spec-tests.py33
1 files changed, 20 insertions, 13 deletions
diff --git a/test/update-spec-tests.py b/test/update-spec-tests.py
index 070ae77d..8de5147a 100755
--- a/test/update-spec-tests.py
+++ b/test/update-spec-tests.py
@@ -25,6 +25,9 @@ TEST_DIR = SCRIPT_DIR
REPO_ROOT_DIR = os.path.dirname(SCRIPT_DIR)
TESTSUITE_DIR = os.path.join(REPO_ROOT_DIR, 'third_party', 'testsuite')
SPEC_TEST_DIR = os.path.join(TEST_DIR, 'spec')
+WASM2C_SPEC_TEST_DIR = os.path.join(TEST_DIR, 'wasm2c', 'spec')
+
+options = None
def GetFilesWithExtension(src_dir, want_ext):
@@ -36,17 +39,11 @@ def GetFilesWithExtension(src_dir, want_ext):
return result
-def main(args):
- parser = argparse.ArgumentParser()
- parser.add_argument('-v', '--verbose', help='print more diagnotic messages.',
- action='store_true')
- options = parser.parse_args(args)
-
- testsuite_tests = set(GetFilesWithExtension(TESTSUITE_DIR, '.wast'))
- spec_tests = set(GetFilesWithExtension(SPEC_TEST_DIR, '.txt'))
+def ProcessDir(dirname, testsuite_tests, tool):
+ spec_tests = set(GetFilesWithExtension(dirname, '.txt'))
for removed_test_name in spec_tests - testsuite_tests:
- test_filename = os.path.join(SPEC_TEST_DIR, removed_test_name + '.txt')
+ test_filename = os.path.join(dirname, removed_test_name + '.txt')
if options.verbose:
print('Removing %s' % test_filename)
os.remove(test_filename)
@@ -55,15 +52,25 @@ def main(args):
wast_filename = os.path.join(
os.path.relpath(TESTSUITE_DIR, REPO_ROOT_DIR),
added_test_name + '.wast')
- test_filename = os.path.join(SPEC_TEST_DIR, added_test_name + '.txt')
+ test_filename = os.path.join(dirname, added_test_name + '.txt')
if options.verbose:
print('Adding %s' % test_filename)
with open(test_filename, 'w') as f:
- if added_test_name.endswith('.fail'):
- f.write(';;; ERROR: 1\n')
- f.write(';;; TOOL: run-interp-spec\n')
+ f.write(';;; TOOL: %s\n' % tool)
f.write(';;; STDIN_FILE: %s\n' % wast_filename)
+
+def main(args):
+ parser = argparse.ArgumentParser()
+ parser.add_argument('-v', '--verbose', help='print more diagnotic messages.',
+ action='store_true')
+ global options
+ options = parser.parse_args(args)
+
+ testsuite_tests = set(GetFilesWithExtension(TESTSUITE_DIR, '.wast'))
+ ProcessDir(SPEC_TEST_DIR, testsuite_tests, 'run-interp-spec')
+ ProcessDir(WASM2C_SPEC_TEST_DIR, testsuite_tests, 'run-spec-wasm2c')
+
return 0