From 4b9168ca2555119570264ff753b6e465dbcea8ed Mon Sep 17 00:00:00 2001 From: "Tobin C. Harding" Date: Fri, 21 Jul 2023 11:39:08 +1000 Subject: [PATCH] Run WASM tests from test wrapper script The `wasm-pack` command does not honour `cargo` flags passed to it so we cannot use `--locked` and test against pre-made lock files. Instead just run the WASM test from the test script wrapper. --- contrib/_test.sh | 9 --------- contrib/test.sh | 14 ++++++++++++++ 2 files changed, 14 insertions(+), 9 deletions(-) diff --git a/contrib/_test.sh b/contrib/_test.sh index 7303a5d..38c7315 100755 --- a/contrib/_test.sh +++ b/contrib/_test.sh @@ -86,15 +86,6 @@ if [ "$DO_DOCS" = true ]; then RUSTDOCFLAGS="-D warnings" cargo +stable doc --all-features fi -# Webassembly stuff -if [ "$DO_WASM" = true ]; then - clang --version - CARGO_TARGET_DIR=wasm cargo install --force wasm-pack - printf '\n[lib]\ncrate-type = ["cdylib", "rlib"]\n' >> Cargo.toml - CC=clang wasm-pack build - CC=clang wasm-pack test --node -fi - # Address Sanitizer if [ "$DO_ASAN" = true ]; then clang --version diff --git a/contrib/test.sh b/contrib/test.sh index 109601f..cd742e2 100755 --- a/contrib/test.sh +++ b/contrib/test.sh @@ -4,4 +4,18 @@ set -ex REPO_DIR=$(git rev-parse --show-toplevel) +# Webassembly stuff +# +# The wasm-pack command does not correctly pass args to cargo so we cannot use --locked and test +# with per-commited lockfiles (recent/minimal). Just run the WASM tests from here instead. +if [ "$DO_WASM" = true ]; then + clang --version + CARGO_TARGET_DIR=wasm cargo install --force wasm-pack + printf '\n[lib]\ncrate-type = ["cdylib", "rlib"]\n' >> Cargo.toml + CC=clang wasm-pack build + CC=clang wasm-pack test --node + + exit 0 +fi + $REPO_DIR/contrib/_test.sh