Stream: git-wasmtime

Topic: wasmtime / PR #5412 cranelift-filetest: Add support for W...


view this post on Zulip Wasmtime GitHub notifications bot (Dec 09 2022 at 21:58):

fitzgen opened PR #5412 from wat-filetests to main:

This adds support for .wat tests in cranelift-filetest. The test runner translates the WAT to Wasm and then uses cranelift-wasm to translate the Wasm to CLIF.

These tests are always precise output tests. The test expectations can be updated by running tests with the CRANELIFT_TEST_BLESS=1 environment variable set, similar to our compile precise output tests. The test's expected output is contained in the last comment in the test file.

The tests allow for configuring the kinds of heaps used to implement Wasm linear memory via TOML in a ;;! comment at the start of the test.

To get ISA and Cranelift flags parsing available in the filetests crate, I had to move the parse_sets_and_triple helper from the cranelift-tools binary crate to the cranelift-reader crate, where I think it logically fits.

Additionally, I had to make some more bits of cranelift-wasm's dummy environment pub so that I could properly wrap and compose it with the environment used for the .wat tests. I don't think this is a big deal, but if we eventually want to clean this stuff up, we can probably remove the dummy environments completely, remove translate_module, and fold them into these new test environments and test runner (since Wasmtime isn't using those things anyways).

Finally, I haven't ported cranelift/filetests/filetests/wasm/* to this new test format yet. That will happen in a follow up PR. There is just one example test that I used to make sure all the TOML parsing and test expectation updating was working properly.

<!--

Please ensure that the following steps are all taken care of before submitting
the PR.

Please ensure all communication adheres to the code of conduct.
-->

view this post on Zulip Wasmtime GitHub notifications bot (Dec 09 2022 at 21:58):

fitzgen requested elliottt for a review on PR #5412.

view this post on Zulip Wasmtime GitHub notifications bot (Dec 09 2022 at 23:47):

elliottt submitted PR review.

view this post on Zulip Wasmtime GitHub notifications bot (Dec 09 2022 at 23:47):

elliottt submitted PR review.

view this post on Zulip Wasmtime GitHub notifications bot (Dec 09 2022 at 23:47):

elliottt created PR review comment:

Is it worth trying to handle empty lines before the config section, or raising an error if config comments are found elsewhere in the test?

view this post on Zulip Wasmtime GitHub notifications bot (Dec 12 2022 at 17:52):

fitzgen submitted PR review.

view this post on Zulip Wasmtime GitHub notifications bot (Dec 12 2022 at 17:52):

fitzgen created PR review comment:

I was trying to keep this code as dead simple as possible, and I think it is worth riding that as far as we can. If it starts becoming annoying, then we can start beefing this up.

view this post on Zulip Wasmtime GitHub notifications bot (Dec 12 2022 at 17:59):

fitzgen updated PR #5412 from wat-filetests to main.

view this post on Zulip Wasmtime GitHub notifications bot (Dec 12 2022 at 18:57):

fitzgen updated PR #5412 from wat-filetests to main.

view this post on Zulip Wasmtime GitHub notifications bot (Dec 12 2022 at 19:13):

fitzgen has enabled auto merge for PR #5412.

view this post on Zulip Wasmtime GitHub notifications bot (Dec 12 2022 at 19:31):

fitzgen merged PR #5412.


Last updated: Nov 22 2024 at 16:03 UTC