Skip to content

Externalize the binary encoding unit tests as .bin.wast - #666

Open
titzer wants to merge 1 commit into
masterfrom
bin_tests
Open

Externalize the binary encoding unit tests as .bin.wast#666
titzer wants to merge 1 commit into
masterfrom
bin_tests

Conversation

@titzer

@titzer titzer commented Jul 27, 2026

Copy link
Copy Markdown
Owner

The bin: unit tests decode hundreds of hand-built binary modules and assert whether each is accepted, but those expectations were only ever checked against Wizard itself. BinParserTester now records every module a test decodes, along with the result the test expects, into test/regress/binary/.bin.wast, so the corpus can be run through the reference interpreter or any other engine; recording is off unless --record-binary is passed. The externalized assertion records the phase the specification should reject a module in, and fill-messages.sh substitutes the message the reference interpreter itself reports wherever the two agree. Of 762 trials, 64 of 79 files agree with the reference outright and 18 trials do not; check.sh attributes them per trial, and test/regress/binary/disagree holds hand-written text sources, encoded by the reference interpreter rather than by Wizard, confirming the two that are real: readElemDecl never type checks a flags=0 element segment against its table, and for flags=4 it derives the expected type from the table itself, so the check can never fail. Three unit tests assert those modules are valid, so their expectations are wrong; not fixed here. The corpus also runs under regress.sh, where seven files are expected failures because they were recorded without the extensions that a regress run enables by default.

The bin: unit tests decode hundreds of hand-built binary modules and assert
whether each is accepted, but those expectations were only ever checked against
Wizard itself. BinParserTester now records every module a test decodes, along
with the result the test expects, into test/regress/binary/<test>.bin.wast, so
the corpus can be run through the reference interpreter or any other engine;
recording is off unless --record-binary is passed. The externalized assertion
records the phase the specification should reject a module in, and
fill-messages.sh substitutes the message the reference interpreter itself
reports wherever the two agree. Of 762 trials, 64 of 79 files agree with the
reference outright and 18 trials do not; check.sh attributes them per trial, and
test/regress/binary/disagree holds hand-written text sources, encoded by the
reference interpreter rather than by Wizard, confirming the two that are real:
readElemDecl never type checks a flags=0 element segment against its table, and
for flags=4 it derives the expected type from the table itself, so the check can
never fail. Three unit tests assert those modules are valid, so their
expectations are wrong; not fixed here. The corpus also runs under regress.sh,
where seven files are expected failures because they were recorded without the
extensions that a regress run enables by default.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant