Skip to content

Commit fc1ad2e

Browse files
Rollup merge of #131705 - hoodmane:fix-emscripten-tests, r=jieyouxu
Fix most ui tests on emscripten target To fix the linker errors, we need to set the output extension to `.js` instead of `.wasm`. Setting the output to a `.wasm` file puts Emscripten into standalone mode which is effectively a distinct target. We need to set the runner to be `node` as well. This fixes most of the ui tests. I fixed 4 additional tests with simple problems: - `intrinsics/intrinsic-alignment.rs` -- Two `#[cfg]` macros match for Emscripten so we got duplicate definition - `structs-enums/rec-align-u64.rs` -- same problem - `issues/issue-12699.rs` -- hangs so I disabled it - `process/process-sigpipe.rs` -- Not expected to work on Emscripten so I disabled it Resolves #131666. There are 7 more failing tests. I'll try to investigate more and see if I can fix them or at least understand why they happen. - abi/numbers-arithmetic/return-float.rs (problem with [wasm treatment of noncanonical floats](https://webassembly.github.io/spec/core/exec/numerics.html#nan-propagation)?) - async-await/issue-60709.rs -- linker error related to memcpy. Possible Emscripten bug? - backtrace/dylib-dep.rs -- Says "Not supported" - backtrace/line-tables-only.rs -- Says "Not supported" - no_std/no-std-unwind-binary.rs -- compiler says `error: lang item required, but not found: eh_catch_typeinfo` - structs-enums/enum-rec/issue-17431-6.rs -- One of the two compiler errors is missing - test-attrs/test-passed.rs r?workingjubilee r?jieyouxu
2 parents 6558e34 + 1d6643c commit fc1ad2e

File tree

8 files changed

+12
-11
lines changed

8 files changed

+12
-11
lines changed

src/bootstrap/src/core/config/config.rs

+3
Original file line numberDiff line numberDiff line change
@@ -612,6 +612,9 @@ impl Target {
612612
if triple.contains("-none") || triple.contains("nvptx") || triple.contains("switch") {
613613
target.no_std = true;
614614
}
615+
if triple.contains("emscripten") {
616+
target.runner = Some("node".into());
617+
}
615618
target
616619
}
617620
}

src/tools/compiletest/src/runtest.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -1643,7 +1643,9 @@ impl<'test> TestCx<'test> {
16431643
// double the length.
16441644
let mut f = self.output_base_dir().join("a");
16451645
// FIXME: This is using the host architecture exe suffix, not target!
1646-
if self.config.target.starts_with("wasm") {
1646+
if self.config.target.contains("emscripten") {
1647+
f = f.with_extra_extension("js");
1648+
} else if self.config.target.starts_with("wasm") {
16471649
f = f.with_extra_extension("wasm");
16481650
} else if self.config.target.contains("spirv") {
16491651
f = f.with_extra_extension("spv");

src/tools/tidy/src/issues.txt

-1
Original file line numberDiff line numberDiff line change
@@ -1520,7 +1520,6 @@ ui/issues/issue-12567.rs
15201520
ui/issues/issue-12612.rs
15211521
ui/issues/issue-12660.rs
15221522
ui/issues/issue-12677.rs
1523-
ui/issues/issue-12699.rs
15241523
ui/issues/issue-12729.rs
15251524
ui/issues/issue-12744.rs
15261525
ui/issues/issue-12860.rs

src/tools/tidy/src/ui_tests.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ use ignore::Walk;
1717
const ENTRY_LIMIT: u32 = 901;
1818
// FIXME: The following limits should be reduced eventually.
1919

20-
const ISSUES_ENTRY_LIMIT: u32 = 1673;
20+
const ISSUES_ENTRY_LIMIT: u32 = 1672;
2121

2222
const EXPECTED_TEST_FILE_EXTENSIONS: &[&str] = &[
2323
"rs", // test source files

tests/ui/intrinsics/intrinsic-alignment.rs

-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ mod rusti {
1313
#[cfg(any(
1414
target_os = "android",
1515
target_os = "dragonfly",
16-
target_os = "emscripten",
1716
target_os = "freebsd",
1817
target_os = "fuchsia",
1918
target_os = "hurd",

tests/ui/process/process-sigpipe.rs

+2-6
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,12 @@
1515

1616
//@ ignore-vxworks no 'sh'
1717
//@ ignore-fuchsia no 'sh'
18+
//@ ignore-emscripten No threads
19+
//@ only-unix SIGPIPE is a unix feature
1820

1921
use std::process;
2022
use std::thread;
2123

22-
#[cfg(unix)]
2324
fn main() {
2425
// Just in case `yes` doesn't check for EPIPE...
2526
thread::spawn(|| {
@@ -34,8 +35,3 @@ fn main() {
3435
assert!(output.status.success());
3536
assert!(output.stderr.len() == 0);
3637
}
37-
38-
#[cfg(not(unix))]
39-
fn main() {
40-
// Not worried about signal masks on other platforms
41-
}

tests/ui/issues/issue-12699.rs tests/ui/std/thread-sleep-ms.rs

+3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
//@ run-pass
22
//@ ignore-sgx not supported
3+
//@ ignore-emscripten
4+
// FIXME: test hangs on emscripten
35
#![allow(deprecated)]
6+
#![allow(unused_imports)]
47

58
use std::thread;
69

tests/ui/structs-enums/rec-align-u64.rs

-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@ struct Outer {
3333
#[cfg(any(
3434
target_os = "android",
3535
target_os = "dragonfly",
36-
target_os = "emscripten",
3736
target_os = "freebsd",
3837
target_os = "fuchsia",
3938
target_os = "hurd",

0 commit comments

Comments
 (0)