about summary refs log tree commit diff
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2017-06-16 07:54:59 +0000
committerbors <bors@rust-lang.org>2017-06-16 07:54:59 +0000
commitc3627e25ee275323ff224bfd7c0fd0bc1362c28d (patch)
tree41c9bf11920a9e44ab36fddf442e5a2e3fac3503
parent4581e89a49c4b1209f9152a38a3cbb909c6209c9 (diff)
parent9da77b3ec5dd99c50629005480323e6684957409 (diff)
downloadrust-c3627e25ee275323ff224bfd7c0fd0bc1362c28d.tar.gz
rust-c3627e25ee275323ff224bfd7c0fd0bc1362c28d.zip
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 https://github.com/kripken/emscripten/issues/4542)
- Some tests are ignore, see #42629 and #42630
-rw-r--r--.travis.yml3
-rw-r--r--src/bootstrap/check.rs4
-rw-r--r--src/ci/docker/asmjs/Dockerfile44
-rw-r--r--src/ci/docker/disabled/wasm32/Dockerfile44
-rwxr-xr-xsrc/ci/docker/disabled/wasm32/node.sh18
-rw-r--r--src/ci/docker/emscripten/Dockerfile41
-rwxr-xr-xsrc/ci/docker/emscripten/build-emscripten.sh53
-rw-r--r--src/ci/docker/scripts/emscripten.sh53
-rw-r--r--src/libcore/tests/num/dec2flt/mod.rs2
-rw-r--r--src/libcore/tests/num/dec2flt/rawfp.rs3
-rw-r--r--src/libcore/tests/num/flt2dec/strategy/dragon.rs1
-rw-r--r--src/libcore/tests/num/flt2dec/strategy/grisu.rs1
-rw-r--r--src/libcore/tests/num/mod.rs1
-rw-r--r--src/libstd/f64.rs3
-rw-r--r--src/test/run-pass/asm-concat-src.rs2
-rw-r--r--src/test/run-pass/conditional-compile-arch.rs3
-rw-r--r--src/test/run-pass/issue-27859.rs2
-rw-r--r--src/test/run-pass/out-of-stack.rs2
18 files changed, 182 insertions, 98 deletions
diff --git a/.travis.yml b/.travis.yml
index 376711517e1..b95196da356 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -36,9 +36,10 @@ matrix:
     - env: IMAGE=dist-x86_64-linux DEPLOY=1 ALLOW_TRY=1
     - env: IMAGE=dist-x86_64-musl DEPLOY=1
     - env: IMAGE=dist-x86_64-netbsd DEPLOY=1
-    - env: IMAGE=emscripten
+    - env: IMAGE=asmjs
     - env: IMAGE=i686-gnu
     - env: IMAGE=i686-gnu-nopt
+    # - env: IMAGE=wasm32 issue 42646
     - env: IMAGE=x86_64-gnu
     - env: IMAGE=x86_64-gnu-full-bootstrap
     - env: IMAGE=x86_64-gnu-aux
diff --git a/src/bootstrap/check.rs b/src/bootstrap/check.rs
index 5ecd752d0ce..2a1b27334c3 100644
--- a/src/bootstrap/check.rs
+++ b/src/bootstrap/check.rs
@@ -567,7 +567,9 @@ fn find_tests(dir: &Path,
         let filename = e.file_name().into_string().unwrap();
         if (target.contains("windows") && filename.ends_with(".exe")) ||
            (!target.contains("windows") && !filename.contains(".")) ||
-           (target.contains("emscripten") && filename.ends_with(".js")) {
+           (target.contains("emscripten") &&
+            filename.ends_with(".js") &&
+            !filename.ends_with(".asm.js")) {
             dst.push(e.path());
         }
     }
diff --git a/src/ci/docker/asmjs/Dockerfile b/src/ci/docker/asmjs/Dockerfile
new file mode 100644
index 00000000000..899ce1e4569
--- /dev/null
+++ b/src/ci/docker/asmjs/Dockerfile
@@ -0,0 +1,44 @@
+FROM ubuntu:16.04
+
+RUN apt-get update && apt-get install -y --no-install-recommends \
+  g++ \
+  make \
+  file \
+  curl \
+  ca-certificates \
+  python \
+  git \
+  cmake \
+  sudo \
+  gdb \
+  xz-utils
+
+# dumb-init
+COPY scripts/dumb-init.sh /scripts/
+RUN sh /scripts/dumb-init.sh
+
+# emscripten
+COPY scripts/emscripten.sh /scripts/
+RUN bash /scripts/emscripten.sh
+
+# env
+ENV PATH=$PATH:/emsdk-portable
+ENV PATH=$PATH:/emsdk-portable/clang/e1.37.13_64bit/
+ENV PATH=$PATH:/emsdk-portable/emscripten/1.37.13/
+ENV PATH=$PATH:/emsdk-portable/node/4.1.1_64bit/bin/
+ENV EMSCRIPTEN=/emsdk-portable/emscripten/1.37.13/
+ENV BINARYEN_ROOT=/emsdk-portable/clang/e1.37.13_64bit/binaryen/
+ENV EM_CONFIG=/emsdk-portable/.emscripten
+
+ENV TARGETS=asmjs-unknown-emscripten
+
+ENV RUST_CONFIGURE_ARGS --target=$TARGETS
+
+ENV SCRIPT python2.7 ../x.py test --target $TARGETS
+
+# cache
+COPY scripts/sccache.sh /scripts/
+RUN sh /scripts/sccache.sh
+
+# init
+ENTRYPOINT ["/usr/bin/dumb-init", "--"]
diff --git a/src/ci/docker/disabled/wasm32/Dockerfile b/src/ci/docker/disabled/wasm32/Dockerfile
new file mode 100644
index 00000000000..daf398ac096
--- /dev/null
+++ b/src/ci/docker/disabled/wasm32/Dockerfile
@@ -0,0 +1,44 @@
+FROM ubuntu:16.04
+
+RUN apt-get update && apt-get install -y --no-install-recommends \
+  g++ \
+  make \
+  file \
+  curl \
+  ca-certificates \
+  python \
+  git \
+  cmake \
+  sudo \
+  gdb \
+  xz-utils
+
+# dumb-init
+COPY scripts/dumb-init.sh /scripts/
+RUN sh /scripts/dumb-init.sh
+
+# emscripten
+COPY scripts/emscripten.sh /scripts/
+RUN bash /scripts/emscripten.sh
+COPY wasm32/node.sh /usr/local/bin/node
+
+# env
+ENV PATH=$PATH:/emsdk-portable
+ENV PATH=$PATH:/emsdk-portable/clang/e1.37.13_64bit/
+ENV PATH=$PATH:/emsdk-portable/emscripten/1.37.13/
+ENV EMSCRIPTEN=/emsdk-portable/emscripten/1.37.13/
+ENV BINARYEN_ROOT=/emsdk-portable/clang/e1.37.13_64bit/binaryen/
+ENV EM_CONFIG=/emsdk-portable/.emscripten
+
+ENV TARGETS=wasm32-unknown-emscripten
+
+ENV RUST_CONFIGURE_ARGS --target=$TARGETS
+
+ENV SCRIPT python2.7 ../x.py test --target $TARGETS
+
+# cache
+COPY scripts/sccache.sh /scripts/
+RUN sh /scripts/sccache.sh
+
+# init
+ENTRYPOINT ["/usr/bin/dumb-init", "--"]
diff --git a/src/ci/docker/disabled/wasm32/node.sh b/src/ci/docker/disabled/wasm32/node.sh
new file mode 100755
index 00000000000..dfa7f221ffa
--- /dev/null
+++ b/src/ci/docker/disabled/wasm32/node.sh
@@ -0,0 +1,18 @@
+#!/bin/bash
+# Copyright 2017 The Rust Project Developers. See the COPYRIGHT
+# file at the top-level directory of this distribution and at
+# http://rust-lang.org/COPYRIGHT.
+#
+# Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+# http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+# <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+# option. This file may not be copied, modified, or distributed
+# except according to those terms.
+
+path="$(dirname $1)"
+file="$(basename $1)"
+
+shift
+
+cd "$path"
+exec /node-v8.0.0-linux-x64/bin/node "$file" "$@"
diff --git a/src/ci/docker/emscripten/Dockerfile b/src/ci/docker/emscripten/Dockerfile
deleted file mode 100644
index 0f0e5b69c32..00000000000
--- a/src/ci/docker/emscripten/Dockerfile
+++ /dev/null
@@ -1,41 +0,0 @@
-FROM ubuntu:16.04
-
-RUN apt-get update && apt-get install -y --no-install-recommends \
-  g++ \
-  make \
-  file \
-  curl \
-  ca-certificates \
-  python \
-  git \
-  cmake \
-  sudo \
-  gdb \
-  xz-utils \
-  lib32stdc++6
-
-RUN curl -o /usr/local/bin/sccache \
-      https://s3.amazonaws.com/rust-lang-ci/rust-ci-mirror/2017-05-12-sccache-x86_64-unknown-linux-musl && \
-      chmod +x /usr/local/bin/sccache
-
-RUN curl -OL https://github.com/Yelp/dumb-init/releases/download/v1.2.0/dumb-init_1.2.0_amd64.deb && \
-    dpkg -i dumb-init_*.deb && \
-    rm dumb-init_*.deb
-ENTRYPOINT ["/usr/bin/dumb-init", "--"]
-
-WORKDIR /tmp
-COPY emscripten/build-emscripten.sh /tmp/
-RUN ./build-emscripten.sh
-ENV PATH=$PATH:/tmp/emsdk_portable
-ENV PATH=$PATH:/tmp/emsdk_portable/clang/tag-e1.37.10/build_tag-e1.37.10_32/bin
-ENV PATH=$PATH:/tmp/emsdk_portable/node/4.1.1_32bit/bin
-ENV PATH=$PATH:/tmp/emsdk_portable/emscripten/tag-1.37.10
-ENV EMSCRIPTEN=/tmp/emsdk_portable/emscripten/tag-1.37.10
-
-ENV RUST_CONFIGURE_ARGS --target=asmjs-unknown-emscripten
-
-# Run `emcc` first as it's got a prompt and doesn't actually do anything, after
-# that's done with do the real build.
-ENV SCRIPT emcc && \
-      python2.7 ../x.py test --target asmjs-unknown-emscripten
-
diff --git a/src/ci/docker/emscripten/build-emscripten.sh b/src/ci/docker/emscripten/build-emscripten.sh
deleted file mode 100755
index 8d6a28f418b..00000000000
--- a/src/ci/docker/emscripten/build-emscripten.sh
+++ /dev/null
@@ -1,53 +0,0 @@
-#!/bin/bash
-# Copyright 2017 The Rust Project Developers. See the COPYRIGHT
-# file at the top-level directory of this distribution and at
-# http://rust-lang.org/COPYRIGHT.
-#
-# Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-# http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-# <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-# option. This file may not be copied, modified, or distributed
-# except according to those terms.
-
-set -ex
-
-hide_output() {
-  set +x
-  on_err="
-echo ERROR: An error was encountered with the build.
-cat /tmp/build.log
-exit 1
-"
-  trap "$on_err" ERR
-  bash -c "while true; do sleep 30; echo \$(date) - building ...; done" &
-  PING_LOOP_PID=$!
-  $@ &> /tmp/build.log
-  trap - ERR
-  kill $PING_LOOP_PID
-  rm /tmp/build.log
-  set -x
-}
-
-curl https://s3.amazonaws.com/mozilla-games/emscripten/releases/emsdk-portable.tar.gz | \
-    tar xzf -
-
-# Some versions of the EMSDK archive have their contents in .emsdk-portable
-# and others in emsdk_portable. Make sure the EMSDK ends up in a fixed path.
-if [ -d emsdk-portable ]; then
-    mv emsdk-portable emsdk_portable
-fi
-
-if [ ! -d emsdk_portable ]; then
-    echo "ERROR: Invalid emsdk archive. Dumping working directory." >&2
-    ls -l
-    exit 1
-fi
-
-# Some versions of the EMSDK set the permissions of the root directory to
-# 0700. Ensure the directory is readable by all users.
-chmod 755 emsdk_portable
-
-source emsdk_portable/emsdk_env.sh
-hide_output emsdk update
-hide_output emsdk install --build=Release sdk-tag-1.37.10-32bit
-hide_output emsdk activate --build=Release sdk-tag-1.37.10-32bit
diff --git a/src/ci/docker/scripts/emscripten.sh b/src/ci/docker/scripts/emscripten.sh
new file mode 100644
index 00000000000..8aa5a98d7fc
--- /dev/null
+++ b/src/ci/docker/scripts/emscripten.sh
@@ -0,0 +1,53 @@
+# Copyright 2017 The Rust Project Developers. See the COPYRIGHT
+# file at the top-level directory of this distribution and at
+# http://rust-lang.org/COPYRIGHT.
+#
+# Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+# http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+# <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+# option. This file may not be copied, modified, or distributed
+# except according to those terms.
+
+set -ex
+
+hide_output() {
+  set +x
+  on_err="
+echo ERROR: An error was encountered with the build.
+cat /tmp/build.log
+exit 1
+"
+  trap "$on_err" ERR
+  bash -c "while true; do sleep 30; echo \$(date) - building ...; done" &
+  PING_LOOP_PID=$!
+  $@ &> /tmp/build.log
+  trap - ERR
+  kill $PING_LOOP_PID
+  rm -f /tmp/build.log
+  set -x
+}
+
+cd /
+curl -L https://s3.amazonaws.com/mozilla-games/emscripten/releases/emsdk-portable.tar.gz | \
+    tar -xz
+
+cd /emsdk-portable
+./emsdk update
+hide_output ./emsdk install sdk-1.37.13-64bit
+./emsdk activate sdk-1.37.13-64bit
+
+# Compile and cache libc
+source ./emsdk_env.sh
+echo "main(){}" > a.c
+HOME=/emsdk-portable/ emcc a.c
+HOME=/emsdk-portable/ emcc -s BINARYEN=1 a.c
+rm -f a.*
+
+# Make emsdk usable by any user
+cp /root/.emscripten /emsdk-portable
+chmod a+rxw -R /emsdk-portable
+
+# node 8 is required to run wasm
+cd /
+curl -L https://nodejs.org/dist/v8.0.0/node-v8.0.0-linux-x64.tar.xz | \
+    tar -xJ
diff --git a/src/libcore/tests/num/dec2flt/mod.rs b/src/libcore/tests/num/dec2flt/mod.rs
index 5d546c643e7..9934e1dab96 100644
--- a/src/libcore/tests/num/dec2flt/mod.rs
+++ b/src/libcore/tests/num/dec2flt/mod.rs
@@ -33,6 +33,7 @@ macro_rules! test_literal {
     })
 }
 
+#[cfg_attr(all(target_arch = "wasm32", target_os = "emscripten"), ignore)] // issue 42630
 #[test]
 fn ordinary() {
     test_literal!(1.0);
@@ -43,6 +44,7 @@ fn ordinary() {
     test_literal!(2.2250738585072014e-308);
 }
 
+#[cfg_attr(all(target_arch = "wasm32", target_os = "emscripten"), ignore)] // issue 42630
 #[test]
 fn special_code_paths() {
     test_literal!(36893488147419103229.0); // 2^65 - 3, triggers half-to-even with even significand
diff --git a/src/libcore/tests/num/dec2flt/rawfp.rs b/src/libcore/tests/num/dec2flt/rawfp.rs
index 2b0afc40202..c9cd2bf5a9a 100644
--- a/src/libcore/tests/num/dec2flt/rawfp.rs
+++ b/src/libcore/tests/num/dec2flt/rawfp.rs
@@ -86,6 +86,7 @@ fn rounding_overflow() {
     assert_eq!(rounded.k, adjusted_k + 1);
 }
 
+#[cfg_attr(all(target_arch = "wasm32", target_os = "emscripten"), ignore)] // issue 42630
 #[test]
 fn prev_float_monotonic() {
     let mut x = 1.0;
@@ -121,6 +122,7 @@ fn next_float_inf() {
     assert_eq!(next_float(f64::INFINITY), f64::INFINITY);
 }
 
+#[cfg_attr(all(target_arch = "wasm32", target_os = "emscripten"), ignore)] // issue 42630
 #[test]
 fn next_prev_identity() {
     for &x in &SOME_FLOATS {
@@ -131,6 +133,7 @@ fn next_prev_identity() {
     }
 }
 
+#[cfg_attr(all(target_arch = "wasm32", target_os = "emscripten"), ignore)] // issue 42630
 #[test]
 fn next_float_monotonic() {
     let mut x = 0.49999999999999;
diff --git a/src/libcore/tests/num/flt2dec/strategy/dragon.rs b/src/libcore/tests/num/flt2dec/strategy/dragon.rs
index 4edb0f3df60..03772a765cc 100644
--- a/src/libcore/tests/num/flt2dec/strategy/dragon.rs
+++ b/src/libcore/tests/num/flt2dec/strategy/dragon.rs
@@ -24,6 +24,7 @@ fn test_mul_pow10() {
     }
 }
 
+#[cfg_attr(all(target_arch = "wasm32", target_os = "emscripten"), ignore)] // issue 42630
 #[test]
 fn shortest_sanity_test() {
     f64_shortest_sanity_test(format_shortest);
diff --git a/src/libcore/tests/num/flt2dec/strategy/grisu.rs b/src/libcore/tests/num/flt2dec/strategy/grisu.rs
index 79e66ee669e..17fb99bcc92 100644
--- a/src/libcore/tests/num/flt2dec/strategy/grisu.rs
+++ b/src/libcore/tests/num/flt2dec/strategy/grisu.rs
@@ -38,6 +38,7 @@ fn test_max_pow10_no_more_than() {
 }
 
 
+#[cfg_attr(all(target_arch = "wasm32", target_os = "emscripten"), ignore)] // issue 42630
 #[test]
 fn shortest_sanity_test() {
     f64_shortest_sanity_test(format_shortest);
diff --git a/src/libcore/tests/num/mod.rs b/src/libcore/tests/num/mod.rs
index 51737c9c3b4..8fdcc36a268 100644
--- a/src/libcore/tests/num/mod.rs
+++ b/src/libcore/tests/num/mod.rs
@@ -169,6 +169,7 @@ test_impl_from! { test_u16f64, u16, f64 }
 test_impl_from! { test_u32f64, u32, f64 }
 
 // Float -> Float
+#[cfg_attr(all(target_arch = "wasm32", target_os = "emscripten"), ignore)] // issue 42630
 #[test]
 fn test_f32f64() {
     use core::f32;
diff --git a/src/libstd/f64.rs b/src/libstd/f64.rs
index 82e3903eec7..813998b7502 100644
--- a/src/libstd/f64.rs
+++ b/src/libstd/f64.rs
@@ -1158,6 +1158,7 @@ mod tests {
         assert_eq!(Fp::Zero, neg_zero.classify());
     }
 
+    #[cfg_attr(all(target_arch = "wasm32", target_os = "emscripten"), ignore)] // issue 42630
     #[test]
     fn test_one() {
         let one: f64 = 1.0f64;
@@ -1210,6 +1211,7 @@ mod tests {
         assert!((-109.2f64).is_finite());
     }
 
+    #[cfg_attr(all(target_arch = "wasm32", target_os = "emscripten"), ignore)] // issue 42630
     #[test]
     fn test_is_normal() {
         let nan: f64 = NAN;
@@ -1227,6 +1229,7 @@ mod tests {
         assert!(!1e-308f64.is_normal());
     }
 
+    #[cfg_attr(all(target_arch = "wasm32", target_os = "emscripten"), ignore)] // issue 42630
     #[test]
     fn test_classify() {
         let nan: f64 = NAN;
diff --git a/src/test/run-pass/asm-concat-src.rs b/src/test/run-pass/asm-concat-src.rs
index ea3d0c3aa0e..fb257bf7b50 100644
--- a/src/test/run-pass/asm-concat-src.rs
+++ b/src/test/run-pass/asm-concat-src.rs
@@ -9,7 +9,7 @@
 // except according to those terms.
 
 // pretty-expanded FIXME #23616
-// ignore-asmjs
+// ignore-emscripten
 
 #![feature(asm)]
 
diff --git a/src/test/run-pass/conditional-compile-arch.rs b/src/test/run-pass/conditional-compile-arch.rs
index 24c461d5f51..6e3e4be0d8e 100644
--- a/src/test/run-pass/conditional-compile-arch.rs
+++ b/src/test/run-pass/conditional-compile-arch.rs
@@ -36,3 +36,6 @@ pub fn main() { }
 
 #[cfg(target_arch = "asmjs")]
 pub fn main() { }
+
+#[cfg(target_arch = "wasm32")]
+pub fn main() { }
diff --git a/src/test/run-pass/issue-27859.rs b/src/test/run-pass/issue-27859.rs
index 900614be612..56036caca15 100644
--- a/src/test/run-pass/issue-27859.rs
+++ b/src/test/run-pass/issue-27859.rs
@@ -8,6 +8,8 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
+// ignore-wasm32 issue 42629
+
 #[inline(never)]
 fn foo(a: f32, b: f32) -> f32 {
     a % b
diff --git a/src/test/run-pass/out-of-stack.rs b/src/test/run-pass/out-of-stack.rs
index a7748b6d6a2..7e70c4a7ab3 100644
--- a/src/test/run-pass/out-of-stack.rs
+++ b/src/test/run-pass/out-of-stack.rs
@@ -10,7 +10,7 @@
 
 // ignore-android: FIXME (#20004)
 // ignore-musl
-// ignore-asmjs
+// ignore-emscripten
 
 #![feature(asm)]
 #![feature(libc)]