Remove old support for emscripten/wasm32-u-u

This commit removes the `wasm32-shim.js` file, for example, and deletes
old support for Emscripten which hasn't been exercised in some time.
This commit is contained in:
Alex Crichton 2024-03-06 12:41:08 -08:00
parent 8fcc009f7d
commit 7d9690a3bc
3 changed files with 4 additions and 65 deletions

View File

@ -1657,8 +1657,8 @@ NOTE: if you're sure you want to do this, please open an issue as to why. In the
// ensure that `libproc_macro` is available on the host.
builder.ensure(compile::Std::new(compiler, compiler.host));
// As well as the target, except for plain wasm32, which can't build it
if suite != "mir-opt" && !target.contains("wasm") && !target.contains("emscripten") {
// As well as the target
if suite != "mir-opt" {
builder.ensure(TestHelpers { target });
}
@ -2511,16 +2511,7 @@ fn prepare_cargo_test(
dylib_path.insert(0, PathBuf::from(&*builder.sysroot_libdir(compiler, target)));
cargo.env(dylib_path_var(), env::join_paths(&dylib_path).unwrap());
if target.contains("emscripten") {
cargo.env(
format!("CARGO_TARGET_{}_RUNNER", envify(&target.triple)),
builder.config.nodejs.as_ref().expect("nodejs not configured"),
);
} else if target.starts_with("wasm32") {
let node = builder.config.nodejs.as_ref().expect("nodejs not configured");
let runner = format!("{} {}/src/etc/wasm32-shim.js", node.display(), builder.src.display());
cargo.env(format!("CARGO_TARGET_{}_RUNNER", envify(&target.triple)), &runner);
} else if builder.remote_tested(target) {
if builder.remote_tested(target) {
cargo.env(
format!("CARGO_TARGET_{}_RUNNER", envify(&target.triple)),
format!("{} run 0", builder.tool_exe(Tool::RemoteTestClient).display()),

View File

@ -1,24 +0,0 @@
// This is a small "shim" program which is used when wasm32 unit tests are run
// in this repository. This program is intended to be run in node.js and will
// load a wasm module into memory, instantiate it with a set of imports, and
// then run it.
//
// There's a bunch of helper functions defined here in `imports.env`, but note
// that most of them aren't actually needed to execute most programs. Many of
// these are just intended for completeness or debugging. Hopefully over time
// nothing here is needed for completeness.
const fs = require('fs');
const process = require('process');
const buffer = fs.readFileSync(process.argv[2]);
Error.stackTraceLimit = 20;
let m = new WebAssembly.Module(buffer);
let instance = new WebAssembly.Instance(m, {});
try {
instance.exports.main();
} catch (e) {
console.error(e);
process.exit(101);
}

View File

@ -2632,9 +2632,7 @@ impl<'test> TestCx<'test> {
// double the length.
let mut f = self.output_base_dir().join("a");
// FIXME: This is using the host architecture exe suffix, not target!
if self.config.target.contains("emscripten") {
f = f.with_extra_extension("js");
} else if self.config.target.contains("wasm32") {
if self.config.target.starts_with("wasm") {
f = f.with_extra_extension("wasm");
} else if self.config.target.contains("spirv") {
f = f.with_extra_extension("spv");
@ -2649,32 +2647,6 @@ impl<'test> TestCx<'test> {
// then split apart its command
let mut args = self.split_maybe_args(&self.config.runner);
// If this is emscripten, then run tests under nodejs
if self.config.target.contains("emscripten") {
if let Some(ref p) = self.config.nodejs {
args.push(p.into());
} else {
self.fatal("emscripten target requested and no NodeJS binary found (--nodejs)");
}
// If this is otherwise wasm, then run tests under nodejs with our
// shim
} else if self.config.target.contains("wasm32") {
if let Some(ref p) = self.config.nodejs {
args.push(p.into());
} else {
self.fatal("wasm32 target requested and no NodeJS binary found (--nodejs)");
}
let src = self
.config
.src_base
.parent()
.unwrap() // chop off `ui`
.parent()
.unwrap(); // chop off `tests`
args.push(src.join("src/etc/wasm32-shim.js").into_os_string());
}
let exe_file = self.make_exe_name();
args.push(exe_file.into_os_string());