testgen: emit the upstream json-from-wast schema - #293
Merged
Conversation
Replace testgen's hand-written wast->JSON emitter (~700 lines, its own
`kind` tag and component-value encoding) with the upstream `json-from-wast`
crate at the pinned wasm-tools release train (0.258) - the implementation
of `wasm-tools json-from-wast` and the same conversion wasmtime's wast
runner performs in-process. The reasons recorded for owning the emitter
no longer hold: the parser lag was version skew (fixed by linking the
crate, not owning a copy), and upstream's value encoding is specified by
its serde derives.
Harness migrates to upstream's schema unmodified: `schema.ts` mirrors the
exercised subset of json-from-wast's lib.rs; `value-mapping.ts` handles
bool-as-boolean, record `[name, v][]`, variant `{case, payload?}`,
result `{Ok|Err}`; the runner classifies core module vs component from
the binary preamble (`artifactKind`) since the JSON no longer says.
Upstream's `line` for module-/action-bearing asserts is the inner form's
line, so the (file, line)-keyed xfail entries and the webkit lane overlay
were remapped by command index against the previous output (same
directive order; 509 of 1511 lines moved). Ten xfail entries in
async/trap-if-sync-and-waitable-set.json referenced lines that had not
existed in the corpus since the file grew upstream; deleted.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
crates/testgennow drives the upstreamjson-from-wastcrate (0.258, thewasm-tools json-from-wastimplementation, also what wasmtime's own wast runner uses in-process) instead of its bespoke emitter.convert.rsandjson.rsare deleted; the JSON schema is upstream's, unmodified.Why
The README's reasons for owning the emitter were stale: the wasm-tools CLI's parser lag was version skew (linking the crate at the pinned release train fixes it — 67/67 files parse), and upstream's component-value encoding is specified by its serde derives. The
kind: module|componentextension is replaced by a preamble sniff in the runner (artifactKind); the executor routing is unchanged.Harness migration
schema.ts/value-mapping.ts: upstream shapes (bool as boolean, record[name, v][], variant{case, payload?}, result{Ok|Err}, signed core ints).linesemantics: upstream keys module-/action-bearing asserts by the inner form's line.xfail.tsandharness/browser/expectations/webkit.tswere remapped mechanically by command index against the previous output (same command count and type sequence per file; 509/1511 lines moved). The webkit overlay remap is verified mechanically only — no local browser cache; the post-merge browser lane is the check.async/trap-if-sync-and-waitable-set.jsonold lines 281–299, which the file's own comment says were displaced when it grew) deleted. The stale-xfail detector only catches xfails that pass, not entries matching no command — follow-up candidate.Gates
just gha::coreexit 0 locally (corpus 67 files/1511 commands/0 failures; conformance 1284 passed / 0 failed / 127 xfail / 95 pending-runtime / 5 unsupported-directive — same as before modulo the 10 dead entries; test-rust drift check, test-runtime 702, sched-seeds, shells sm/node/bun all green). Independent review round applied (accretion deletions in schema.ts, comment fixes).No published surface touched; no lockstep bump. Automerge armed.