about summary refs log tree commit diff
path: root/tests/ui/command
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2024-03-12 00:03:54 +0000
committerbors <bors@rust-lang.org>2024-03-12 00:03:54 +0000
commitdc2ffa405407ffb3654658c50ab3dfda124fbdfd (patch)
tree0050efb1fe19fbec8dcb00148b1a011e1617dc16 /tests/ui/command
parent4a0cc881dcc4d800f10672747f61a94377ff6662 (diff)
parentcf6d6050f7d1ea62c9aae54ddd345106b6e31382 (diff)
downloadrust-dc2ffa405407ffb3654658c50ab3dfda124fbdfd.tar.gz
rust-dc2ffa405407ffb3654658c50ab3dfda124fbdfd.zip
Auto merge of #122036 - alexcrichton:test-wasm-with-wasi, r=oli-obk
Test wasm32-wasip1 in CI, not wasm32-unknown-unknown

This commit changes CI to no longer test the `wasm32-unknown-unknown` target and instead test the `wasm32-wasip1` target. There was some discussion of this in a [Zulip thread], and the motivations for this PR are:

* Runtime failures on `wasm32-unknown-unknown` print nothing, meaning all you get is "something failed". In contrast `wasm32-wasip1` can print to stdout/stderr.

* The unknown-unknown target is missing lots of pieces of libstd, and while `wasm32-wasip1` is also missing some pieces (e.g. threads) it's missing fewer pieces. This means that many more tests can be run.

Overall my hope is to improve the debuggability of wasm failures on CI and ideally be a bit less of a maintenance burden.

This commit specifically removes the testing of `wasm32-unknown-unknown` and replaces it with testing of `wasm32-wasip1`. Along the way there were a number of other archiectural changes made as well, including:

* A new `target.*.runtool` option can now be specified in `config.toml` which is passed as `--runtool` to `compiletest`. This is used to reimplement execution of WebAssembly in a less-wasm-specific fashion.

* The default value for `runtool` is an ambiently located WebAssembly runtime found on the system, if any. I've implemented logic for Wasmtime.

* Existing testing support for `wasm32-unknown-unknown` and Emscripten has been removed. I'm not aware of Emscripten testing being run any time recently and otherwise `wasm32-wasip1` is in theory the focus now.

* I've added a new `//@ needs-threads` directive for `compiletest` and classified a bunch of wasm-ignored tests as needing threads. In theory these tests can run on `wasm32-wasi-preview1-threads`, for example.

* I've tried to audit all existing tests that are either `ignore-emscripten` or `ignore-wasm*`. Many now run on `wasm32-wasip1` due to being able to emit error messages, for example. Many are updated with comments as to why they can't run as well.

* The `compiletest` output matching for `wasm32-wasip1` automatically uses "match a subset" mode implemented in `compiletest`. This is because WebAssembly runtimes often add extra information on failure, such as the `unreachable` instruction in `panic!`, which isn't able to be matched against the golden output from native platforms.

* I've ported most existing `run-make` tests that use custom Node.js wrapper scripts to the new run-make-based-in-Rust infrastructure. To do this I added `wasmparser` as a dependency of `run-make-support` for the various wasm tests to use that parse wasm files. The one test that executed WebAssembly now uses `wasmtime`-the-CLI to execute the test instead. I have not ported over an exception-handling test as Wasmtime doesn't implement this yet.

* I've updated the `test` crate to print out timing information for WASI targets as it can do that (gets a previously ignored test now passing).

* The `test-various` image now builds a WASI sysroot for the WASI target and additionally downloads a fixed release of Wasmtime, currently the latest one at 18.0.2, and uses that for testing.

[Zulip thread]: https://rust-lang.zulipchat.com/#narrow/stream/131828-t-compiler/topic/Have.20wasm.20tests.20ever.20caused.20problems.20on.20CI.3F/near/424317944
Diffstat (limited to 'tests/ui/command')
-rw-r--r--tests/ui/command/command-argv0.rs2
-rw-r--r--tests/ui/command/command-current-dir.rs2
-rw-r--r--tests/ui/command/command-exec.rs2
-rw-r--r--tests/ui/command/command-pre-exec.rs2
-rw-r--r--tests/ui/command/command-setgroups.rs2
-rw-r--r--tests/ui/command/issue-10626.rs2
6 files changed, 6 insertions, 6 deletions
diff --git a/tests/ui/command/command-argv0.rs b/tests/ui/command/command-argv0.rs
index 53649e35a89..35625c0b334 100644
--- a/tests/ui/command/command-argv0.rs
+++ b/tests/ui/command/command-argv0.rs
@@ -1,7 +1,7 @@
 //@ run-pass
 
 //@ ignore-windows - this is a unix-specific test
-//@ ignore-emscripten no processes
+//@ ignore-wasm32 no processes
 //@ ignore-sgx no processes
 use std::env;
 use std::os::unix::process::CommandExt;
diff --git a/tests/ui/command/command-current-dir.rs b/tests/ui/command/command-current-dir.rs
index 7186a165a96..95c16bce6e8 100644
--- a/tests/ui/command/command-current-dir.rs
+++ b/tests/ui/command/command-current-dir.rs
@@ -1,5 +1,5 @@
 //@ run-pass
-//@ ignore-emscripten no processes
+//@ ignore-wasm32 no processes
 //@ ignore-sgx no processes
 //@ ignore-fuchsia Needs directory creation privilege
 
diff --git a/tests/ui/command/command-exec.rs b/tests/ui/command/command-exec.rs
index 3cc5d0bbd3e..c97b8561410 100644
--- a/tests/ui/command/command-exec.rs
+++ b/tests/ui/command/command-exec.rs
@@ -2,7 +2,7 @@
 
 #![allow(stable_features)]
 //@ ignore-windows - this is a unix-specific test
-//@ ignore-emscripten no processes
+//@ ignore-wasm32 no processes
 //@ ignore-sgx no processes
 //@ ignore-fuchsia no execvp syscall provided
 
diff --git a/tests/ui/command/command-pre-exec.rs b/tests/ui/command/command-pre-exec.rs
index 2f3483fad08..7242dea2775 100644
--- a/tests/ui/command/command-pre-exec.rs
+++ b/tests/ui/command/command-pre-exec.rs
@@ -2,7 +2,7 @@
 
 #![allow(stable_features)]
 //@ ignore-windows - this is a unix-specific test
-//@ ignore-emscripten no processes
+//@ ignore-wasm32 no processes
 //@ ignore-sgx no processes
 //@ ignore-fuchsia no execvp syscall
 #![feature(process_exec, rustc_private)]
diff --git a/tests/ui/command/command-setgroups.rs b/tests/ui/command/command-setgroups.rs
index f5dbf43feb5..c940135d844 100644
--- a/tests/ui/command/command-setgroups.rs
+++ b/tests/ui/command/command-setgroups.rs
@@ -1,6 +1,6 @@
 //@ run-pass
 //@ ignore-windows - this is a unix-specific test
-//@ ignore-emscripten
+//@ ignore-wasm32
 //@ ignore-sgx
 //@ ignore-musl - returns dummy result for _SC_NGROUPS_MAX
 //@ ignore-nto - does not have `/bin/id`, expects groups to be i32 (not u32)
diff --git a/tests/ui/command/issue-10626.rs b/tests/ui/command/issue-10626.rs
index c63edb83700..f8dbb011513 100644
--- a/tests/ui/command/issue-10626.rs
+++ b/tests/ui/command/issue-10626.rs
@@ -1,5 +1,5 @@
 //@ run-pass
-//@ ignore-emscripten no processes
+//@ ignore-wasm32 no processes
 //@ ignore-sgx no processes
 
 // Make sure that if a process doesn't have its stdio/stderr descriptors set up