Skip to content

Commit c3627e2

Browse files
committed
Auto merge of #42631 - malbarbo:wasm32, r=alexcrichton
Add a travis builder for wasm32-unknown-emscripten This commits add an entry to travis matrix that will execute wasm32-unknown-emscripten tests suites. - Emscripten for asmjs was updated to sdk-1.37.13-64bit - The tests are run with node 8.0.0 (it can execute wasm) - A wrapper script is used to run each test from the directory where it is (workaround for emscripten-core/emscripten#4542) - Some tests are ignore, see #42629 and #42630
2 parents 4581e89 + 9da77b3 commit c3627e2

File tree

18 files changed

+182
-98
lines changed

18 files changed

+182
-98
lines changed

.travis.yml

+2-1
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,10 @@ matrix:
3636
- env: IMAGE=dist-x86_64-linux DEPLOY=1 ALLOW_TRY=1
3737
- env: IMAGE=dist-x86_64-musl DEPLOY=1
3838
- env: IMAGE=dist-x86_64-netbsd DEPLOY=1
39-
- env: IMAGE=emscripten
39+
- env: IMAGE=asmjs
4040
- env: IMAGE=i686-gnu
4141
- env: IMAGE=i686-gnu-nopt
42+
# - env: IMAGE=wasm32 issue 42646
4243
- env: IMAGE=x86_64-gnu
4344
- env: IMAGE=x86_64-gnu-full-bootstrap
4445
- env: IMAGE=x86_64-gnu-aux

src/bootstrap/check.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -567,7 +567,9 @@ fn find_tests(dir: &Path,
567567
let filename = e.file_name().into_string().unwrap();
568568
if (target.contains("windows") && filename.ends_with(".exe")) ||
569569
(!target.contains("windows") && !filename.contains(".")) ||
570-
(target.contains("emscripten") && filename.ends_with(".js")) {
570+
(target.contains("emscripten") &&
571+
filename.ends_with(".js") &&
572+
!filename.ends_with(".asm.js")) {
571573
dst.push(e.path());
572574
}
573575
}

src/ci/docker/asmjs/Dockerfile

+44
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
FROM ubuntu:16.04
2+
3+
RUN apt-get update && apt-get install -y --no-install-recommends \
4+
g++ \
5+
make \
6+
file \
7+
curl \
8+
ca-certificates \
9+
python \
10+
git \
11+
cmake \
12+
sudo \
13+
gdb \
14+
xz-utils
15+
16+
# dumb-init
17+
COPY scripts/dumb-init.sh /scripts/
18+
RUN sh /scripts/dumb-init.sh
19+
20+
# emscripten
21+
COPY scripts/emscripten.sh /scripts/
22+
RUN bash /scripts/emscripten.sh
23+
24+
# env
25+
ENV PATH=$PATH:/emsdk-portable
26+
ENV PATH=$PATH:/emsdk-portable/clang/e1.37.13_64bit/
27+
ENV PATH=$PATH:/emsdk-portable/emscripten/1.37.13/
28+
ENV PATH=$PATH:/emsdk-portable/node/4.1.1_64bit/bin/
29+
ENV EMSCRIPTEN=/emsdk-portable/emscripten/1.37.13/
30+
ENV BINARYEN_ROOT=/emsdk-portable/clang/e1.37.13_64bit/binaryen/
31+
ENV EM_CONFIG=/emsdk-portable/.emscripten
32+
33+
ENV TARGETS=asmjs-unknown-emscripten
34+
35+
ENV RUST_CONFIGURE_ARGS --target=$TARGETS
36+
37+
ENV SCRIPT python2.7 ../x.py test --target $TARGETS
38+
39+
# cache
40+
COPY scripts/sccache.sh /scripts/
41+
RUN sh /scripts/sccache.sh
42+
43+
# init
44+
ENTRYPOINT ["/usr/bin/dumb-init", "--"]
+44
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
FROM ubuntu:16.04
2+
3+
RUN apt-get update && apt-get install -y --no-install-recommends \
4+
g++ \
5+
make \
6+
file \
7+
curl \
8+
ca-certificates \
9+
python \
10+
git \
11+
cmake \
12+
sudo \
13+
gdb \
14+
xz-utils
15+
16+
# dumb-init
17+
COPY scripts/dumb-init.sh /scripts/
18+
RUN sh /scripts/dumb-init.sh
19+
20+
# emscripten
21+
COPY scripts/emscripten.sh /scripts/
22+
RUN bash /scripts/emscripten.sh
23+
COPY wasm32/node.sh /usr/local/bin/node
24+
25+
# env
26+
ENV PATH=$PATH:/emsdk-portable
27+
ENV PATH=$PATH:/emsdk-portable/clang/e1.37.13_64bit/
28+
ENV PATH=$PATH:/emsdk-portable/emscripten/1.37.13/
29+
ENV EMSCRIPTEN=/emsdk-portable/emscripten/1.37.13/
30+
ENV BINARYEN_ROOT=/emsdk-portable/clang/e1.37.13_64bit/binaryen/
31+
ENV EM_CONFIG=/emsdk-portable/.emscripten
32+
33+
ENV TARGETS=wasm32-unknown-emscripten
34+
35+
ENV RUST_CONFIGURE_ARGS --target=$TARGETS
36+
37+
ENV SCRIPT python2.7 ../x.py test --target $TARGETS
38+
39+
# cache
40+
COPY scripts/sccache.sh /scripts/
41+
RUN sh /scripts/sccache.sh
42+
43+
# init
44+
ENTRYPOINT ["/usr/bin/dumb-init", "--"]

src/ci/docker/disabled/wasm32/node.sh

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
#!/bin/bash
2+
# Copyright 2017 The Rust Project Developers. See the COPYRIGHT
3+
# file at the top-level directory of this distribution and at
4+
# http://rust-lang.org/COPYRIGHT.
5+
#
6+
# Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
7+
# http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
8+
# <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
9+
# option. This file may not be copied, modified, or distributed
10+
# except according to those terms.
11+
12+
path="$(dirname $1)"
13+
file="$(basename $1)"
14+
15+
shift
16+
17+
cd "$path"
18+
exec /node-v8.0.0-linux-x64/bin/node "$file" "$@"

src/ci/docker/emscripten/Dockerfile

-41
This file was deleted.

src/ci/docker/emscripten/build-emscripten.sh

-53
This file was deleted.

src/ci/docker/scripts/emscripten.sh

+53
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
# Copyright 2017 The Rust Project Developers. See the COPYRIGHT
2+
# file at the top-level directory of this distribution and at
3+
# http://rust-lang.org/COPYRIGHT.
4+
#
5+
# Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6+
# http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7+
# <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8+
# option. This file may not be copied, modified, or distributed
9+
# except according to those terms.
10+
11+
set -ex
12+
13+
hide_output() {
14+
set +x
15+
on_err="
16+
echo ERROR: An error was encountered with the build.
17+
cat /tmp/build.log
18+
exit 1
19+
"
20+
trap "$on_err" ERR
21+
bash -c "while true; do sleep 30; echo \$(date) - building ...; done" &
22+
PING_LOOP_PID=$!
23+
$@ &> /tmp/build.log
24+
trap - ERR
25+
kill $PING_LOOP_PID
26+
rm -f /tmp/build.log
27+
set -x
28+
}
29+
30+
cd /
31+
curl -L https://s3.amazonaws.com/mozilla-games/emscripten/releases/emsdk-portable.tar.gz | \
32+
tar -xz
33+
34+
cd /emsdk-portable
35+
./emsdk update
36+
hide_output ./emsdk install sdk-1.37.13-64bit
37+
./emsdk activate sdk-1.37.13-64bit
38+
39+
# Compile and cache libc
40+
source ./emsdk_env.sh
41+
echo "main(){}" > a.c
42+
HOME=/emsdk-portable/ emcc a.c
43+
HOME=/emsdk-portable/ emcc -s BINARYEN=1 a.c
44+
rm -f a.*
45+
46+
# Make emsdk usable by any user
47+
cp /root/.emscripten /emsdk-portable
48+
chmod a+rxw -R /emsdk-portable
49+
50+
# node 8 is required to run wasm
51+
cd /
52+
curl -L https://nodejs.org/dist/v8.0.0/node-v8.0.0-linux-x64.tar.xz | \
53+
tar -xJ

src/libcore/tests/num/dec2flt/mod.rs

+2
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ macro_rules! test_literal {
3333
})
3434
}
3535

36+
#[cfg_attr(all(target_arch = "wasm32", target_os = "emscripten"), ignore)] // issue 42630
3637
#[test]
3738
fn ordinary() {
3839
test_literal!(1.0);
@@ -43,6 +44,7 @@ fn ordinary() {
4344
test_literal!(2.2250738585072014e-308);
4445
}
4546

47+
#[cfg_attr(all(target_arch = "wasm32", target_os = "emscripten"), ignore)] // issue 42630
4648
#[test]
4749
fn special_code_paths() {
4850
test_literal!(36893488147419103229.0); // 2^65 - 3, triggers half-to-even with even significand

src/libcore/tests/num/dec2flt/rawfp.rs

+3
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@ fn rounding_overflow() {
8686
assert_eq!(rounded.k, adjusted_k + 1);
8787
}
8888

89+
#[cfg_attr(all(target_arch = "wasm32", target_os = "emscripten"), ignore)] // issue 42630
8990
#[test]
9091
fn prev_float_monotonic() {
9192
let mut x = 1.0;
@@ -121,6 +122,7 @@ fn next_float_inf() {
121122
assert_eq!(next_float(f64::INFINITY), f64::INFINITY);
122123
}
123124

125+
#[cfg_attr(all(target_arch = "wasm32", target_os = "emscripten"), ignore)] // issue 42630
124126
#[test]
125127
fn next_prev_identity() {
126128
for &x in &SOME_FLOATS {
@@ -131,6 +133,7 @@ fn next_prev_identity() {
131133
}
132134
}
133135

136+
#[cfg_attr(all(target_arch = "wasm32", target_os = "emscripten"), ignore)] // issue 42630
134137
#[test]
135138
fn next_float_monotonic() {
136139
let mut x = 0.49999999999999;

src/libcore/tests/num/flt2dec/strategy/dragon.rs

+1
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ fn test_mul_pow10() {
2424
}
2525
}
2626

27+
#[cfg_attr(all(target_arch = "wasm32", target_os = "emscripten"), ignore)] // issue 42630
2728
#[test]
2829
fn shortest_sanity_test() {
2930
f64_shortest_sanity_test(format_shortest);

src/libcore/tests/num/flt2dec/strategy/grisu.rs

+1
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ fn test_max_pow10_no_more_than() {
3838
}
3939

4040

41+
#[cfg_attr(all(target_arch = "wasm32", target_os = "emscripten"), ignore)] // issue 42630
4142
#[test]
4243
fn shortest_sanity_test() {
4344
f64_shortest_sanity_test(format_shortest);

src/libcore/tests/num/mod.rs

+1
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,7 @@ test_impl_from! { test_u16f64, u16, f64 }
169169
test_impl_from! { test_u32f64, u32, f64 }
170170

171171
// Float -> Float
172+
#[cfg_attr(all(target_arch = "wasm32", target_os = "emscripten"), ignore)] // issue 42630
172173
#[test]
173174
fn test_f32f64() {
174175
use core::f32;

src/libstd/f64.rs

+3
Original file line numberDiff line numberDiff line change
@@ -1158,6 +1158,7 @@ mod tests {
11581158
assert_eq!(Fp::Zero, neg_zero.classify());
11591159
}
11601160

1161+
#[cfg_attr(all(target_arch = "wasm32", target_os = "emscripten"), ignore)] // issue 42630
11611162
#[test]
11621163
fn test_one() {
11631164
let one: f64 = 1.0f64;
@@ -1210,6 +1211,7 @@ mod tests {
12101211
assert!((-109.2f64).is_finite());
12111212
}
12121213

1214+
#[cfg_attr(all(target_arch = "wasm32", target_os = "emscripten"), ignore)] // issue 42630
12131215
#[test]
12141216
fn test_is_normal() {
12151217
let nan: f64 = NAN;
@@ -1227,6 +1229,7 @@ mod tests {
12271229
assert!(!1e-308f64.is_normal());
12281230
}
12291231

1232+
#[cfg_attr(all(target_arch = "wasm32", target_os = "emscripten"), ignore)] // issue 42630
12301233
#[test]
12311234
fn test_classify() {
12321235
let nan: f64 = NAN;

src/test/run-pass/asm-concat-src.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
// except according to those terms.
1010

1111
// pretty-expanded FIXME #23616
12-
// ignore-asmjs
12+
// ignore-emscripten
1313

1414
#![feature(asm)]
1515

src/test/run-pass/conditional-compile-arch.rs

+3
Original file line numberDiff line numberDiff line change
@@ -36,3 +36,6 @@ pub fn main() { }
3636

3737
#[cfg(target_arch = "asmjs")]
3838
pub fn main() { }
39+
40+
#[cfg(target_arch = "wasm32")]
41+
pub fn main() { }

src/test/run-pass/issue-27859.rs

+2
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11+
// ignore-wasm32 issue 42629
12+
1113
#[inline(never)]
1214
fn foo(a: f32, b: f32) -> f32 {
1315
a % b

0 commit comments

Comments
 (0)