alexcrichton opened PR #15152 from alexcrichton:cli-flags-in-wast to bytecodealliance:main:
This commit adds support for a feature that I've long wanted the ability to specify, which is arbitrary CLI flags in
*.wasts. Such tests aren't the most applicable to other runtimes but they're still quite applicable to our own runtime and testing. While ideally tests don't specify these they're quite useful for one-off scenarios and such. With this commit all of our*.wasttests can now additionally specifyflags = "..."likedisastests can which will always be enabled when running the test (or fuzzing with it).This feature is coupled in this commit with refactoring to make it more natural to implement. The main change is to centralize around the
CommonOptionstype in thewasmtime_cli_flagsas opposed to trying to maintain a separate set of feature getters/setters/etc. This means that all test configuration options are wholly representable in aCommonOptions, and additionally required adding minor features there (such as-Wlegacy-exceptions).Note though that test configuration is not entirely folded into
flags. Like before all tests assume virtually no wasm features are enabled and start from a blank slate. Individual wasm features are still enabled one-by-one in a structured manner, and this enablesshould_failcalculations to understand the set of wasm features needed for a test. This means we can continue to support lots of*.wastfiles that are automatically expected to fail on unsupported compilers, but are still run on those compilers, all by just managing a few top-level directives.Additionally some refactoring is added here to be able to validate that
flagsdoesn't actually specify anything that should otherwise be structurally specified. For exampleflagscannot contain-Ccompilerbecause this is an important factor inshould_fail, and that predicate needs to be able to run without thewasmtimecrate (aka without CLI parsing). The purpose offlagsis to contain one-off settings in tests to specifically test one configuration option or such.Finally fuzzing is additionally updated here. When fuzzing
flagsspecified in tests take precedent over whatever the fuzz configuration says, but otherwise fuzzing will still frob every other possible configuration flag.The end result of this refactoring is intended to be such that more tests can be migrated from
tests/all/*.rsunit tests to*.wasttests without needing harness work for wasts themselves. Insteadflags = "..."can be specified and pretty much be done with it.<!--
Please make sure you include the following information:
If this work has been discussed elsewhere, please include a link to that
conversation. If it was discussed in an issue, just mention "issue #...".Explain why this change is needed. If the details are in an issue already,
this can be brief.Our development process is documented in the Wasmtime book:
https://docs.wasmtime.dev/contributing-development-process.htmlPlease review the Bytecode Alliance's AI tool usage policy at
https://github.com/bytecodealliance/governance/blob/main/AI_TOOL_POLICY.mdPlease ensure all communication follows the code of conduct:
https://github.com/bytecodealliance/wasmtime/blob/main/CODE_OF_CONDUCT.md
-->
alexcrichton removed the review request for wasmtime-fuzz-reviewers from PR #15152.
alexcrichton requested fitzgen for a review on PR #15152.
alexcrichton requested wasmtime-fuzz-reviewers for a review on PR #15152.
alexcrichton requested wasmtime-core-reviewers for a review on PR #15152.
alexcrichton requested wasmtime-default-reviewers for a review on PR #15152.
alexcrichton updated PR #15152.
github-actions[bot] added the label fuzzing on PR #15152.
github-actions[bot] commented on PR #15152:
Subscribe to Label Action
cc @fitzgen
<details>
This issue or pull request has been labeled: "fuzzing"Thus the following users have been cc'd because of the following labels:
- fitzgen: fuzzing
To subscribe or unsubscribe from this label, edit the <code>.github/subscribe-to-label.json</code> configuration file.
Learn more.
</details>
:thumbs_up: fitzgen submitted PR review.
:speech_balloon: fitzgen created PR review comment:
Should this be either
doc(hidden)ordeprecatedor something?
:speech_balloon: fitzgen created PR review comment:
Surprised that CI isn't failing due to lack of docs on a
pubitem here -- do we not havedeny(missing_docs)for this crate? We should probably move that into the workspace lints...
:speech_balloon: fitzgen created PR review comment:
rustfmt:-/
:memo: alexcrichton submitted PR review.
:speech_balloon: alexcrichton created PR review comment:
It could be, but as a CLI flag or a deserialization option it'll still show up. It's deprecated in
Configwhich I think should be sufficient.
alexcrichton updated PR #15152.
:memo: alexcrichton submitted PR review.
:speech_balloon: alexcrichton created PR review comment:
Oh looks like this was
pubpreviously but probably unintentionally so, so I've removed that. We don't havemissing_docsin our workspace lints by default, and IMO we should keep it that way since it's a bit too onerous to document everything public everywhere, but opting-in to specific crates makes sense to me, and it's not opted-in in this crate, yes.
alexcrichton has enabled auto merge for PR #15152.
alexcrichton added PR #15152 Support arbitrary CLI flags in *.wast tests to the merge queue.
:memo: fitzgen submitted PR review.
:speech_balloon: fitzgen created PR review comment:
I feel like it is a better default though, so I think it would be better to opt crates out of it than into it.
github-merge-queue[bot] removed PR #15152 Support arbitrary CLI flags in *.wast tests from the merge queue.
alexcrichton updated PR #15152.
alexcrichton has enabled auto merge for PR #15152.
alexcrichton added PR #15152 Support arbitrary CLI flags in *.wast tests to the merge queue.
:check: alexcrichton merged PR #15152.
alexcrichton removed PR #15152 Support arbitrary CLI flags in *.wast tests from the merge queue.
Last updated: Nov 19 2026 at 20:05 UTC