Skip to content

Commit 63edbe6

Browse files
committed
changes to run test suite in wasmtime
run-make still fails but that's all hardcoded for node
1 parent 09ae784 commit 63edbe6

File tree

5 files changed

+22
-6
lines changed

5 files changed

+22
-6
lines changed

src/bootstrap/config.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -407,6 +407,7 @@ pub struct Target {
407407
pub wasi_root: Option<PathBuf>,
408408
pub qemu_rootfs: Option<PathBuf>,
409409
pub no_std: bool,
410+
pub runtool: Option<String>,
410411
}
411412

412413
impl Target {
@@ -746,6 +747,7 @@ define_config! {
746747
wasi_root: Option<String> = "wasi-root",
747748
qemu_rootfs: Option<String> = "qemu-rootfs",
748749
no_std: Option<bool> = "no-std",
750+
runtool: Option<String> = "runtool",
749751
}
750752
}
751753

@@ -1175,6 +1177,9 @@ impl Config {
11751177
if let Some(s) = cfg.no_std {
11761178
target.no_std = s;
11771179
}
1180+
if let Some(s) = &cfg.runtool {
1181+
target.runtool = Some(s.clone());
1182+
}
11781183
target.cc = cfg.cc.map(PathBuf::from);
11791184
target.cxx = cfg.cxx.map(PathBuf::from);
11801185
target.ar = cfg.ar.map(PathBuf::from);

src/bootstrap/test.rs

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1606,6 +1606,12 @@ note: if you're sure you want to do this, please open an issue as to why. In the
16061606
cmd.arg("--rustfix-coverage");
16071607
}
16081608

1609+
if let Some(config) = builder.config.target_config.get(&target) {
1610+
if let Some(tool) = &config.runtool {
1611+
cmd.arg("--runtool").arg(tool);
1612+
}
1613+
}
1614+
16091615
cmd.env("BOOTSTRAP_CARGO", &builder.initial_cargo);
16101616

16111617
cmd.arg("--channel").arg(&builder.config.channel);
@@ -2030,12 +2036,15 @@ impl Step for Crate {
20302036
cargo.arg("--quiet");
20312037
}
20322038

2033-
if target.contains("emscripten") {
2039+
let runtool = builder.config.target_config.get(&target).and_then(|t| t.runtool.as_ref());
2040+
if let Some(tool) = runtool {
2041+
cargo.env(format!("CARGO_TARGET_{}_RUNNER", envify(&target.triple)), tool);
2042+
} else if target.contains("emscripten") {
20342043
cargo.env(
20352044
format!("CARGO_TARGET_{}_RUNNER", envify(&target.triple)),
20362045
builder.config.nodejs.as_ref().expect("nodejs not configured"),
20372046
);
2038-
} else if target.starts_with("wasm32") {
2047+
} else if target == "wasm32-unknown-unknown" {
20392048
let node = builder.config.nodejs.as_ref().expect("nodejs not configured");
20402049
let runner =
20412050
format!("{} {}/src/etc/wasm32-shim.js", node.display(), builder.src.display());

src/ci/docker/host-x86_64/test-various/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-ins
1818
wget \
1919
patch
2020

21-
RUN curl -sL https://nodejs.org/dist/v15.14.0/node-v15.14.0-linux-x64.tar.xz | \
21+
RUN curl -sL https://github.com/bytecodealliance/wasmtime/releases/download/v1.0.0/wasmtime-v1.0.0-x86_64-linux.tar.xz | \
2222
tar -xJ
2323

2424
WORKDIR /build/

src/tools/compiletest/src/header.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -674,7 +674,9 @@ impl Config {
674674
// (in contrast to `wasm32` which also matches non-bare targets like
675675
// asmjs-unknown-emscripten).
676676
let matches_wasm32_alias = || {
677-
self.target == "wasm32-unknown-unknown" && matches!(name, "emscripten" | "wasm32-bare")
677+
(self.target == "wasm32-unknown-unknown"
678+
&& matches!(name, "emscripten" | "wasm32-bare"))
679+
|| (self.target == "wasm32-wasi" && matches!(name, "emscripten"))
678680
};
679681

680682
let is_match = name == "test" ||
@@ -950,7 +952,7 @@ pub fn make_test_description<R: Read>(
950952
ignore |= !has_shadow_call_stack
951953
&& config.parse_name_directive(ln, "needs-sanitizer-shadow-call-stack");
952954
ignore |= !config.can_unwind() && config.parse_name_directive(ln, "needs-unwind");
953-
ignore |= config.target == "wasm32-unknown-unknown"
955+
ignore |= config.target.contains("wasm32")
954956
&& config.parse_name_directive(ln, directives::CHECK_RUN_RESULTS);
955957
ignore |= config.debugger == Some(Debugger::Cdb) && ignore_cdb(config, ln);
956958
ignore |= config.debugger == Some(Debugger::Gdb) && ignore_gdb(config, ln);

src/tools/compiletest/src/runtest.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2094,7 +2094,7 @@ impl<'test> TestCx<'test> {
20942094
}
20952095
// If this is otherwise wasm, then run tests under nodejs with our
20962096
// shim
2097-
} else if self.config.target.contains("wasm32") {
2097+
} else if self.config.target == "wasm32-unknown-unknown" {
20982098
if let Some(ref p) = self.config.nodejs {
20992099
args.push(p.clone());
21002100
} else {

0 commit comments

Comments
 (0)