fitzgen opened PR #5412 from wat-filetests
to main
:
This adds support for
.wat
tests incranelift-filetest
. The test runner translates the WAT to Wasm and then usescranelift-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 thecranelift-tools
binary crate to thecranelift-reader
crate, where I think it logically fits.Additionally, I had to make some more bits of
cranelift-wasm
's dummy environmentpub
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, removetranslate_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.
[ ] This has been discussed in issue #..., or if not, please tell us why
here.[ ] A short description of what this does, why it is needed; if the
description becomes long, the matter should probably be discussed in an issue
first.[ ] This PR contains test cases, if meaningful.
- [ ] A reviewer from the core maintainer team has been assigned for this PR.
If you don't know who could review this, please indicate so. The list of
suggested reviewers on the right can help you.Please ensure all communication adheres to the code of conduct.
-->
fitzgen requested elliottt for a review on PR #5412.
elliottt submitted PR review.
elliottt submitted PR review.
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?
fitzgen submitted PR review.
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.
fitzgen updated PR #5412 from wat-filetests
to main
.
fitzgen updated PR #5412 from wat-filetests
to main
.
fitzgen has enabled auto merge for PR #5412.
fitzgen merged PR #5412.
Last updated: Nov 22 2024 at 16:03 UTC