Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 2 additions & 18 deletions check.py
Original file line number Diff line number Diff line change
Expand Up @@ -196,16 +196,6 @@ def run_opt_test(wast, stdout=None, stderr=None):
support.run_command(cmd, stdout=stdout)


def check_expected(actual, expected, stdout=None):
if expected and os.path.exists(expected):
expected = open(expected).read()
print(' (using expected output)', file=stdout)
actual = actual.strip()
expected = expected.strip()
if actual != expected:
shared.fail(actual, expected)


def run_one_spec_test(wast: Path, stdout=None, stderr=None):
test_name = wast.name

Expand All @@ -217,23 +207,18 @@ def run_one_spec_test(wast: Path, stdout=None, stderr=None):
if test_name == 'names.wast' and shared.skip_if_on_windows('spec: ' + test_name):
return

expected = os.path.join(shared.get_test_dir('spec'), 'expected-output', test_name + '.log')

# some spec tests should fail (actual process failure, not just assert_invalid)
try:
actual = run_spec_test(str(wast), stdout=stdout, stderr=stderr)
run_spec_test(str(wast), stdout=stdout, stderr=stderr)
except Exception as e:
if ('wasm-validator error' in str(e) or 'error: ' in str(e)) and '.fail.' in test_name:
print('<< test failed as expected >>', file=stdout)
return # don't try all the binary format stuff TODO
else:
shared.fail_with_error(str(e))

check_expected(actual, expected, stdout=stdout)

# check binary format. here we can verify execution of the final
# result, no need for an output verification
actual = ''
transformed_path = base_name + ".transformed"
with open(transformed_path, 'w') as transformed_spec_file:
for i, (module, asserts) in enumerate(support.split_wast(str(wast))):
Expand All @@ -252,8 +237,7 @@ def run_one_spec_test(wast: Path, stdout=None, stderr=None):
transformed_spec_file.write(result_wast + '\n' + '\n'.join(asserts))

# compare all the outputs to the expected output
actual = run_spec_test(transformed_path, stdout=stdout, stderr=stderr)
check_expected(actual, os.path.join(shared.get_test_dir('spec'), 'expected-output', test_name + '.log'), stdout=stdout)
run_spec_test(transformed_path, stdout=stdout, stderr=stderr)


def run_spec_test_with_wrapped_stdout(output_queue, wast: Path):
Expand Down
19 changes: 0 additions & 19 deletions scripts/auto_update_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,24 +124,6 @@ def update_reduce_tests():
support.run_command(shared.WASM_DIS + ['c.wasm', '-o', expected])


def update_spec_tests():
print('\n[ updating wasm-shell spec testcases... ]\n')

for t in shared.options.spec_tests:
print('..', os.path.basename(t))

cmd = shared.WASM_SHELL + [t]
expected = os.path.join(shared.get_test_dir('spec'), 'expected-output', os.path.basename(t) + '.log')
if os.path.isfile(expected):
stdout = support.run_command(cmd, stderr=subprocess.PIPE)
# filter out binaryen interpreter logging that the spec suite
# doesn't expect
filtered = [line for line in stdout.splitlines() if not line.startswith('[trap')]
stdout = '\n'.join(filtered) + '\n'
with open(expected, 'w') as o:
o.write(stdout)


def update_lit_tests():
print('\n[ updating lit testcases... ]\n')
script = os.path.join(shared.options.binaryen_root,
Expand Down Expand Up @@ -170,7 +152,6 @@ def update_lit_tests():
('ctor-eval', update_ctor_eval_tests),
('wasm-metadce', update_metadce_tests),
('wasm-reduce', update_reduce_tests),
('spec', update_spec_tests),
('lld', lld.update_lld_tests),
('wasm2js', wasm2js.update_wasm2js_tests),
('binaryenjs', binaryenjs.update_binaryen_js_tests),
Expand Down
4 changes: 1 addition & 3 deletions scripts/test/shared.py
Original file line number Diff line number Diff line change
Expand Up @@ -400,9 +400,7 @@ def get_tests(test_dir, extensions=[], recursive=False):
# skip-list and preserved old ones by renaming them to 'old_[FILENAME].wast'
# not to lose coverage. When the cause of the error is fixed or the unsupported
# construct gets support so the new test passes, we can delete the
# corresponding 'old_[FILENAME].wast' file. When you fix the new file and
# delete the old file, make sure you rename the corresponding .wast.log file in
# expected-output/ if any.
# corresponding 'old_[FILENAME].wast' file.
# Paths are relative to the test/spec directory
SPEC_TESTS_TO_SKIP = [
# Requires us to write our own floating point parser
Expand Down
6 changes: 0 additions & 6 deletions scripts/test/wasm2js.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,12 +126,6 @@ def test_wasm2js_output():
all_out += out

shared.fail_if_not_identical_to_file(''.join(all_js), expected_file)
expected_out = os.path.join(shared.get_test_dir('spec'), 'expected-output', os.path.basename(t) + '.log')
if os.path.exists(expected_out):
expected_out = open(expected_out).read()
else:
expected_out = ''
shared.fail_if_not_identical(all_out, expected_out)


def test_asserts_output():
Expand Down
1 change: 0 additions & 1 deletion test/spec/expected-output/func_ptrs.wast.log
Comment thread
sbc100 marked this conversation as resolved.

This file was deleted.

2 changes: 0 additions & 2 deletions test/spec/expected-output/names.wast.log

This file was deleted.

10 changes: 0 additions & 10 deletions test/spec/expected-output/old_imports.wast.log

This file was deleted.

2 changes: 0 additions & 2 deletions test/spec/expected-output/old_start.wast.log

This file was deleted.

Loading