Skip to content

Commit 7dc410d

Browse files
committed
Enable more tests for Emscripten targets
Specifically, enable SIMD intrinsic tests, target-independent asm! tests, and tests that were ignored due to old fastcomp bugs that have long since become irrelevant. Also re-enables asmjs tests that pass -g by reducing the corresponding Emscripten debug level so that it does not error out with a message about source maps being unsupported. This required fixing the asmjs target's `arch` string to be `"asmjs"` rather than `"wasm32"`, and that in turn required auditing many cfg attributes and fixing them to include both asmjs and wasm32. For many tests that could not be re-enabled, also adds an explanatory comment to make future auditing easier. In particular, tests requiring threads are left to be re-enabled in future work.
1 parent 1389494 commit 7dc410d

File tree

118 files changed

+80
-225
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

118 files changed

+80
-225
lines changed

src/bootstrap/native.rs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -520,10 +520,6 @@ impl Step for TestHelpers {
520520
builder.info("Building test helpers");
521521
t!(fs::create_dir_all(&dst));
522522
let mut cfg = cc::Build::new();
523-
// FIXME: Workaround for https://github.com/emscripten-core/emscripten/issues/9013
524-
if target.contains("emscripten") {
525-
cfg.pic(false);
526-
}
527523

528524
// We may have found various cross-compilers a little differently due to our
529525
// extra configuration, so inform gcc of these compilers. Note, though, that

src/ci/docker/scripts/emscripten.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,5 +19,5 @@ exit 1
1919

2020
git clone https://github.com/emscripten-core/emsdk.git /emsdk-portable
2121
cd /emsdk-portable
22-
hide_output ./emsdk install 1.38.46-upstream
23-
./emsdk activate 1.38.46-upstream
22+
hide_output ./emsdk install 1.39.5
23+
./emsdk activate 1.39.5

src/ci/docker/wasm32/Dockerfile

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -33,12 +33,4 @@ ENV EMCC_CFLAGS=-O1
3333
# Emscripten installation is user-specific
3434
ENV NO_CHANGE_USER=1
3535

36-
# FIXME: Re-enable these tests once https://github.com/rust-lang/cargo/pull/7476
37-
# is picked up by CI
38-
ENV SCRIPT python2.7 ../x.py test --target $TARGETS \
39-
--exclude src/libcore \
40-
--exclude src/liballoc \
41-
--exclude src/libproc_macro \
42-
--exclude src/libstd \
43-
--exclude src/libterm \
44-
--exclude src/libtest
36+
ENV SCRIPT python2.7 ../x.py test --target $TARGETS

src/liballoc/collections/linked_list/tests.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ fn test_insert_prev() {
181181
}
182182

183183
#[test]
184-
#[cfg_attr(target_os = "emscripten", ignore)]
184+
#[cfg_attr(target_os = "emscripten", ignore)] // Emscripten does not support threads
185185
#[cfg_attr(miri, ignore)] // Miri does not support threads
186186
fn test_send() {
187187
let n = list_from(&[1, 2, 3]);

src/liballoc/tests/binary_heap.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -345,9 +345,7 @@ fn assert_covariance() {
345345
// even if the order may not be correct.
346346
//
347347
// Destructors must be called exactly once per element.
348-
// FIXME: re-enable emscripten once it can unwind again
349348
#[test]
350-
#[cfg(not(target_os = "emscripten"))]
351349
fn panic_safe() {
352350
use rand::{seq::SliceRandom, thread_rng};
353351
use std::cmp;

src/liballoc/tests/lib.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,6 @@ fn hash<T: Hash>(t: &T) -> u64 {
3636
s.finish()
3737
}
3838

39-
// FIXME: Instantiated functions with i128 in the signature is not supported in Emscripten.
40-
// See https://github.com/kripken/emscripten-fastcomp/issues/169
41-
#[cfg(not(target_os = "emscripten"))]
4239
#[test]
4340
fn test_boxed_hasher() {
4441
let ordinary_hash = hash(&5u32);

src/liballoc/tests/slice.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1395,7 +1395,6 @@ fn test_box_slice_clone() {
13951395

13961396
#[test]
13971397
#[allow(unused_must_use)] // here, we care about the side effects of `.clone()`
1398-
#[cfg_attr(target_os = "emscripten", ignore)]
13991398
fn test_box_slice_clone_panics() {
14001399
use std::sync::atomic::{AtomicUsize, Ordering};
14011400
use std::sync::Arc;
@@ -1636,7 +1635,6 @@ macro_rules! test {
16361635
thread_local!(static SILENCE_PANIC: Cell<bool> = Cell::new(false));
16371636

16381637
#[test]
1639-
#[cfg_attr(target_os = "emscripten", ignore)] // no threads
16401638
fn panic_safe() {
16411639
let prev = panic::take_hook();
16421640
panic::set_hook(Box::new(move |info| {

src/liballoc/tests/vec.rs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -937,9 +937,7 @@ fn drain_filter_complex() {
937937
}
938938
}
939939

940-
// FIXME: re-enable emscripten once it can unwind again
941940
#[test]
942-
#[cfg(not(target_os = "emscripten"))]
943941
fn drain_filter_consumed_panic() {
944942
use std::rc::Rc;
945943
use std::sync::Mutex;
@@ -989,9 +987,7 @@ fn drain_filter_consumed_panic() {
989987
}
990988
}
991989

992-
// FIXME: Re-enable emscripten once it can catch panics
993990
#[test]
994-
#[cfg(not(target_os = "emscripten"))]
995991
fn drain_filter_unconsumed_panic() {
996992
use std::rc::Rc;
997993
use std::sync::Mutex;

src/libcore/fmt/num.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -258,7 +258,7 @@ macro_rules! impl_Display {
258258

259259
// Include wasm32 in here since it doesn't reflect the native pointer size, and
260260
// often cares strongly about getting a smaller code size.
261-
#[cfg(any(target_pointer_width = "64", target_arch = "wasm32"))]
261+
#[cfg(any(target_pointer_width = "64", target_arch = "wasm32", target_arch = "asmjs"))]
262262
mod imp {
263263
use super::*;
264264
impl_Display!(
@@ -267,7 +267,7 @@ mod imp {
267267
);
268268
}
269269

270-
#[cfg(not(any(target_pointer_width = "64", target_arch = "wasm32")))]
270+
#[cfg(not(any(target_pointer_width = "64", target_arch = "wasm32", target_arch = "asmjs")))]
271271
mod imp {
272272
use super::*;
273273
impl_Display!(i8, u8, i16, u16, i32, u32, isize, usize as u32 via to_u32 named fmt_u32);

src/libcore/ptr/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -426,8 +426,8 @@ unsafe fn swap_nonoverlapping_bytes(x: *mut u8, y: *mut u8, len: usize) {
426426
// Haswell E processors. LLVM is more able to optimize if we give a struct a
427427
// #[repr(simd)], even if we don't actually use this struct directly.
428428
//
429-
// FIXME repr(simd) broken on emscripten and redox
430-
#[cfg_attr(not(any(target_os = "emscripten", target_os = "redox")), repr(simd))]
429+
// FIXME repr(simd) broken on redox
430+
#[cfg_attr(not(target_os = "redox"), repr(simd))]
431431
struct Block(u64, u64, u64, u64);
432432
struct UnalignedBlock(u64, u64, u64, u64);
433433

0 commit comments

Comments
 (0)