Conversation
|
Cool! So can the test harness then take every text-.wast, convert it to a binary-.wast and run that too? |
|
You could, but you'd need to implement some infrastructure in the harness to parse & split up scripts and reassemble them (and you could already have done that before, since you can just Not sure that is the best direction to go, though. Moving forward, I think it makes more sense to restructure our tests to be self-contained modules, instead of increasing the infrastructure requirements. Use the power that is already inherently there. The more immediate benefit of this feature is that we can now write tests exercising specifics of the encoding, or more interestingly, malformed binaries. :) |
|
It seems like it'd be pretty easy, though: parse in the text-.wast, convert each |
|
@lukewagner, yes, it's straightforward to implement an execution flag that causes each module definition to roundtrip through binary when running the script. But that would only benefit testing ml-proto itself, not other consumers, AFAICS. Running the test suite should not require every consumer to implement a random combination of an S-expr script interpreter, with a bunch of ad-hoc command line flags, and a harness exploiting those in specific ways. That's too much upfront complexity for my taste. If we instead move towards self-contained test modules, then every Wasm consumer can immediately run them without additional infrastructure. In particular, consumers that only understand the binary format. The main reason I originally introduced the script assertion language was that it was not otherwise possible to express self-contained tests at the time, because we did not have a start function yet. Now that's moot, and a technically leaner approach is more attractive, IMO. |
|
You're right, for the purpose of producing tests that run on different engines we need something different; I was mostly thinking about validating ml-proto itself using existing tests "for free". |
|
(anyhow, lgtm!) |
This got lost in the rebase too, and WebAssembly#277 only partially fixed it.
This PR adds support for defining modules directly in terms of a binary string in the text format:
To ease formatting, strings can be split up into several literals, which are simply concatenated:
The same string splitting is now allowed in
segmentnodes.Further changes:
(type i)syntax for their signature, in order to not implicitly change the content of the type section. (One step closer to (parse o format) being an identity.)outputcommand can now be used without an argument, which just dumps the current module to stdout.