Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[test] Port tests in test/ to test/lit/basic/ #6160

Merged
merged 10 commits into from
Dec 13, 2023

Conversation

aheejin
Copy link
Member

@aheejin aheejin commented Dec 8, 2023

This ports all tests from test/ to test/lit/basic/. The set of commands and CHECK lines used are the same as the ones in #6159. Now we use lit to test these, this also deletes all .wast, .wast.from-wast, .wast.fromBinary, and
.wast.fromBinary.noDebugInfo files from test/ and all related test routines from the python scripts.

All CHECK lines are generated by update_lit_checks.py --all-items.

This also deletes these three multi-memory tests in test/lit/, because they seem to contain the same code with the ones in test/, which have been ported to test/lit/basic/ along with other tests.

  • test/lit/multi-memories-atomics64.wast
  • test/lit/multi-memories-basics.wast
  • test/lit/multi-memories-simd.wast

This also adds newlines between (funcs in case there are none to make CHECK lines easy to view, and removes some extra existing newlines here and there.

This ports all tests from `test/` to `test/lit/basic/`. The set of
commands and `CHECK` lines used are the same as the ones in WebAssembly#6159. Now
we use `lit` to test these, this also deletes all `.wast`,
`.wast.from-wast`, `.wast.fromBinary`, and
`.wast.fromBinary.noDebugInfo` files from `test/`.

All tests lines are generated by `update_lit_checks.py --all-items`.

This also deletes these three multi-memory tests in `test/lit/`, because
they seem to contain the same code with the ones in `test/`, which have
been ported to `test/lit/basic/` along with other tests.
- `test/lit/multi-memories-atomics64.wast`
- `test/lit/multi-memories-basics.wast`
- `test/lit/multi-memories-simd.wast`

This also adds newlines between `(func`s in case there are none, to make
`CHECK` lines easy to view and removes some extra existing newlines here
and there.
@kripken
Copy link
Member

kripken commented Dec 9, 2023

Looks like some test/externref.wast.* files are removed here without adding a new file to replace them - are those just unneeded files being removed? (I don't see any externref.wast base file for them.) Same for gc.wast, hello_world.wast, tail-call.wast, unit.wast.

@aheejin
Copy link
Member Author

aheejin commented Dec 9, 2023

I also see some dangling tests in test/wasm2js which are causing wasm2js test failures. Probably will submit a separate PR to clean up some dangling tests...

@aheejin
Copy link
Member Author

aheejin commented Dec 9, 2023

I didn't know this, but it looks wasm2js tests use some source files from test/ and test/spec/, and not only from test/wasm2js/:

for t in tests + spec_tests + wasm2js_tests:

I guess I just need to redirect them to test/lit/basic/...

@aheejin
Copy link
Member Author

aheejin commented Dec 9, 2023

  • Removed test checking/updating routines for .wast.from-wast, .wast.fromBinary, and .wast.fromBinary.noDebugInfo.

  • Ported two wat tests (hello_world.wat and unit.wat) to test/lit/basic/, but left the original hello_world.wat in place in test/, because wasm_opt.py does some special tests with it and one of them requires the output to be the same as the input:

    for extra_args in [[], ['--no-validation']]:
    wast = os.path.join(shared.options.binaryen_test, 'hello_world.wat')
    shared.delete_from_orbit('a.wat')
    out = 'a.wat'
    cmd = shared.WASM_OPT + [wast, '-o', out, '-S', '-q'] + extra_args
    support.run_command(cmd)
    shared.fail_if_not_identical_to_file(open(out).read(), wast)
    print('\n[ checking wasm-opt binary reading/writing... ]\n')
    shutil.copyfile(os.path.join(shared.options.binaryen_test, 'hello_world.wat'), 'a.wat')
    shared.delete_from_orbit('a.wasm')
    shared.delete_from_orbit('b.wast')
    support.run_command(shared.WASM_OPT + ['a.wat', '-o', 'a.wasm', '-q'])
    assert open('a.wasm', 'rb').read()[0] == 0, 'we emit binary by default'
    support.run_command(shared.WASM_OPT + ['a.wasm', '-o', 'b.wast', '-S', '-q'])
    assert open('b.wast', 'rb').read()[0] != 0, 'we emit text with -S'

    print('\n[ checking wasm-opt -o notation... ]\n')
    wast = os.path.join(shared.options.binaryen_test, 'hello_world.wat')
    cmd = shared.WASM_OPT + [wast, '-o', 'a.wast', '-S']
    support.run_command(cmd)
    open(wast, 'w').write(open('a.wast').read())

@aheejin aheejin requested a review from sbc100 December 10, 2023 20:30
@aheejin
Copy link
Member Author

aheejin commented Dec 10, 2023

The wasm2js failure in the CI will be fixed after #6164 lands.


def update_wasm_opt_tests():
print('\n[ checking wasm-opt -o notation... ]\n')
print('\n[ updating wasm-opt -o notation... ]\n')
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Drive-by fix: checking->updating in update_wasm_opt_tests messages


shared.minify_check(t)

print('\n[ checking wasm-opt debugInfo read-write... ]\n')
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This line should've been removed in #6162

@aheejin
Copy link
Member Author

aheejin commented Dec 12, 2023

Any more concerns on landing this PR?

aheejin added a commit to aheejin/binaryen that referenced this pull request Dec 13, 2023
We ported basic tests to `test/lit/basic/` in WebAssembly#6160, but comparing
`CHECK` lines with the test code for long functions is not easy, even
though it wouldn't necessarily be worse than the the separate files we
used to have in `test/`. This slices `exception-handling.wast` into
functions so that the `CHECK` lines are easy to check.
Copy link
Member

@tlively tlively left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@aheejin aheejin merged commit 0024c8b into WebAssembly:main Dec 13, 2023
14 checks passed
@aheejin aheejin deleted the port_basic_tests branch December 13, 2023 18:53
aheejin added a commit to aheejin/binaryen that referenced this pull request Dec 13, 2023
We ported basic tests to `test/lit/basic/` in WebAssembly#6160, but comparing
`CHECK` lines with the test code for long functions is not easy, even
though it wouldn't necessarily be worse than the the separate files we
used to have in `test/`. This slices `exception-handling.wast` into
functions so that the `CHECK` lines are easy to check.
aheejin added a commit that referenced this pull request Dec 13, 2023
We ported basic tests to `test/lit/basic/` in #6160, but comparing
`CHECK` lines with the test code for long functions is not easy, even
though it wouldn't necessarily be worse than the the separate files we
used to have in `test/`. This slices `exception-handling.wast` into
functions so that the `CHECK` lines are easy to check.
radekdoulik pushed a commit to dotnet/binaryen that referenced this pull request Jul 12, 2024
This ports all tests from `test/` to `test/lit/basic/`. The set of
commands and `CHECK` lines used are the same as the ones in WebAssembly#6159. Now
 we use `lit` to test these, this also deletes all `.wast`,
`.wast.from-wast`, `.wast.fromBinary`, and
`.wast.fromBinary.noDebugInfo` files from `test/` and all related test
routines from the python scripts.

All `CHECK` lines are generated by `update_lit_checks.py --all-items`.

This also deletes these three multi-memory tests in `test/lit/`, because
they seem to contain the same code with the ones in `test/`, which have
been ported to `test/lit/basic/` along with other tests.
- `test/lit/multi-memories-atomics64.wast`
- `test/lit/multi-memories-basics.wast`
- `test/lit/multi-memories-simd.wast`

This also adds newlines between `(func`s in case there are none to make
`CHECK` lines easy to view, and removes some extra existing newlines
here and there.
radekdoulik pushed a commit to dotnet/binaryen that referenced this pull request Jul 12, 2024
We ported basic tests to `test/lit/basic/` in WebAssembly#6160, but comparing
`CHECK` lines with the test code for long functions is not easy, even
though it wouldn't necessarily be worse than the the separate files we
used to have in `test/`. This slices `exception-handling.wast` into
functions so that the `CHECK` lines are easy to check.
@gkdn gkdn mentioned this pull request Aug 31, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants