Skip to content

Commit

Permalink
Bug 1617827 - Wasm: Switch to 'wasm-generate-testsuite' tooling for i…
Browse files Browse the repository at this point in the history
…mporting spec test-suite. r=lth

This switches our test import Makefile to use the wasm-generate-testsuite tool
for importing spec-tests. A new config file declaring the proposals to import,
along with tests to skip, is added to jit-test/etc.

There was an ability to apply a .patch file to paper over a back-compat issue
is types.wast.js. It appears that newer spec/tests don't include a types.wast,
so I don't think this patch is necessary anymore. We can add this ability back
later if needed.

Differential Revision: https://phabricator.services.mozilla.com/D65195

--HG--
extra : moz-landing-system : lando
  • Loading branch information
eqrion committed Mar 11, 2020
1 parent dcfba1a commit c13f6b0
Show file tree
Hide file tree
Showing 3 changed files with 84 additions and 19 deletions.
4 changes: 2 additions & 2 deletions .hgignore
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,8 @@ _OPT\.OBJ/
# SpiderMonkey test result logs
^js/src/tests/results-.*\.(html|txt)$
^js/src/devtools/rootAnalysis/t/out
# SpiderMonkey clone of the webassembly spec repository
^js/src/wasm/spec
# SpiderMonkey clone of the wasm-generate-testsuite repository
^js/src/wasm/wasm-generate-testsuite

# Java HTML5 parser classes
^parser/html/java/(html|java)parser/
Expand Down
58 changes: 58 additions & 0 deletions js/src/jit-test/etc/wasm-config.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
# Standard 'directives.txt' prologues for jit-tests
harness_directive = "|jit-test| skip-if: true"
directive = "|jit-test| test-also=--wasm-compiler=ion; test-also=--wasm-compiler=baseline; test-also=--test-wasm-await-tier2; test-also=--disable-wasm-huge-memory; skip-variant-if: --disable-wasm-huge-memory, !wasmHugeMemoryIsSupported(); include:wasm-testharness.js; local-include:harness/sync_index.js"

# Failing tests across all testsuites
excluded_tests = ["align.wast", "memory_trap.wast", "imports.wast", "exports.wast", "linking.wast", "data.wast", "names.wast", "utf8-custom-section-id.wast"]

[[repos]]
name = "spec"
url = "https://github.com/WebAssembly/spec"

[[repos]]
name = "sign-extension-ops"
url = "https://github.com/WebAssembly/sign-extension-ops"
parent = "spec"

[[repos]]
name = "nontrapping-float-to-int-conversions"
url = "https://github.com/WebAssembly/nontrapping-float-to-int-conversions"
parent = "spec"

[[repos]]
name = "multi-value"
url = "https://github.com/WebAssembly/multi-value"
parent = "spec"
excluded_tests = ["call_indirect.wast", "block.wast", "fac.wast", "if.wast"]
# Skip in WPT where we can't guard on features being enabled
skip_wpt = true
# Skip in jit-test when it's not enabled
directive = "; skip-if: !wasmMultiValueEnabled()"

[[repos]]
name = "threads"
url = "https://github.com/WebAssembly/threads"
parent = "spec"
# Skip in WPT where we can't guard on features being enabled
skip_wpt = true
# Skip in jit-test when it's not enabled
directive = "; skip-if: !wasmThreadsSupported()"

[[repos]]
name = "bulk-memory-operations"
url = "https://github.com/WebAssembly/bulk-memory-operations"
parent = "spec"
# Skip in WPT where we can't guard on features being enabled
skip_wpt = true
# Skip in jit-test when it's not enabled
directive = "; skip-if: !wasmBulkMemSupported()"

[[repos]]
name = "reference-types"
url = "https://github.com/WebAssembly/reference-types"
parent = "spec"
excluded_tests = ["table_fill.wast", "select.wast", "float_memory.wast", "call_indirect.wast"]
# Skip in WPT where we can't guard on features being enabled
skip_wpt = true
# Skip in jit-test when it's not enabled
directive = "; skip-if: !wasmBulkMemSupported() || !wasmReftypesEnabled()"
41 changes: 24 additions & 17 deletions js/src/wasm/Makefile
Original file line number Diff line number Diff line change
@@ -1,31 +1,38 @@
.PHONY: help update run expectations

help:
@echo "Script to regenerate wasm test cases (JS and WPT) from the spec repository."
@echo "Script to regenerate wasm test cases (JS and WPT) using the wasm-generate-testsuite tool."
@echo ""
@echo "- 'make update' runs wasm-generate-testsuite and puts the results in"
@echo " the right directories, then updates the WPT manifest, if needed."
@echo ""
@echo " The wasm-generate-testsuite repo is needed under js/src/wasm (not"
@echo " checked in). It can be a symbolic link or a real directory; if it's"
@echo " not there, the Makefile will clone the repo from the sources."
@echo ""
@echo " Generation of a testsuite is driven by js/src/jit-test/etc/wasm-config.toml"
@echo " If you need to exclude a test, change test directives, or add a"
@echo " proposal; that is the file to modify."
@echo ""
@echo "- a spec directory is needed under js/src/wasm (not checked in). It can be a"
@echo " symbolic link or a real directory; if it's not there, the Makefile will clone"
@echo " the repository from the sources."
@echo "- 'make update' makes sure the spec wast interpreter is up to date, regenerates"
@echo " all the JS and WPT test cases, and put them in the right directories, then"
@echo " updates the WPT manifest, if needed."
@echo "- 'MOZCONFIG=/path/to/bin/firefox make run' runs the WPT test cases and prints a"
@echo " summary of the failures in the console."
@echo ""
@echo "- 'MOZCONFIG=/path/to/bin/firefox make expectations' runs the WPT test cases and"
@echo " updates the expectations (known failures)."
@echo ""
@echo "Choose a rule: update or expectations."
@echo "Choose a rule: update, run, or expectations."

update:
[ -d ./spec ] || git clone https://github.com/webassembly/spec ./spec
(cd ./spec/interpreter && make)
./spec/test/build.py \
--use-sync \
--js ../jit-test/tests/wasm/spec \
--html ../../../testing/web-platform/mozilla/tests/wasm
(cd ../jit-test/tests/wasm/spec && patch -u -p7 < ../../../etc/wasm-spec-tests.patch)
echo "|jit-test| test-also=--wasm-compiler=ion; test-also=--wasm-compiler=baseline; test-also=--test-wasm-await-tier2; test-also=--disable-wasm-huge-memory; include:wasm-testharness.js" > ../jit-test/tests/wasm/spec/directives.txt
echo "|jit-test| skip-if:true" > ../jit-test/tests/wasm/spec/harness/directives.txt
[ -d ./wasm-generate-testsuite ] || git clone https://github.com/eqrion/wasm-generate-testsuite ./wasm-generate-testsuite
cp ../jit-test/etc/wasm-config.toml ./wasm-generate-testsuite/config.toml
(cd ./wasm-generate-testsuite && cargo run)
rm -r ../jit-test/tests/wasm/spec
cp -R wasm-generate-testsuite/tests/js ../jit-test/tests/wasm/spec
[ ! -d ../jit-test/etc/wasm-spec-test.patch ] || (cd ../jit-test/tests/wasm/spec && patch -u -p7 < ../../../etc/wasm-spec-test.patch)
cp wasm-generate-testsuite/tests/config.lock ../jit-test/tests/wasm/spec
rm -r ../../../testing/web-platform/mozilla/tests/wasm
cp -R wasm-generate-testsuite/tests/wpt ../../../testing/web-platform/mozilla/tests/wasm
cp wasm-generate-testsuite/tests/config.lock ../../../testing/web-platform/mozilla/tests/wasm

run:
@[ -z $(MOZCONFIG) ] && echo "You need to define the MOZCONFIG env variable first."
Expand Down

0 comments on commit c13f6b0

Please sign in to comment.