Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a travis builder for wasm32-unknown-emscripten #42631

Merged
merged 8 commits into from
Jun 16, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 3 additions & 1 deletion src/bootstrap/check.rs
Original file line number Diff line number Diff line change
Expand Up @@ -563,7 +563,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());
}
}
Expand Down
44 changes: 44 additions & 0 deletions src/ci/docker/asmjs/Dockerfile
Original file line number Diff line number Diff line change
@@ -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", "--"]
44 changes: 44 additions & 0 deletions src/ci/docker/disabled/wasm32/Dockerfile
Original file line number Diff line number Diff line change
@@ -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", "--"]
18 changes: 18 additions & 0 deletions src/ci/docker/disabled/wasm32/node.sh
Original file line number Diff line number Diff line change
@@ -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" "$@"
41 changes: 0 additions & 41 deletions src/ci/docker/emscripten/Dockerfile

This file was deleted.

53 changes: 0 additions & 53 deletions src/ci/docker/emscripten/build-emscripten.sh

This file was deleted.

53 changes: 53 additions & 0 deletions src/ci/docker/scripts/emscripten.sh
Original file line number Diff line number Diff line change
@@ -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
2 changes: 2 additions & 0 deletions src/libcore/tests/num/dec2flt/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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
Expand Down
3 changes: 3 additions & 0 deletions src/libcore/tests/num/dec2flt/rawfp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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 {
Expand All @@ -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;
Expand Down
1 change: 1 addition & 0 deletions src/libcore/tests/num/flt2dec/strategy/dragon.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
1 change: 1 addition & 0 deletions src/libcore/tests/num/flt2dec/strategy/grisu.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
1 change: 1 addition & 0 deletions src/libcore/tests/num/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
3 changes: 3 additions & 0 deletions src/libstd/f64.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand All @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion src/test/run-pass/asm-concat-src.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
// except according to those terms.

// pretty-expanded FIXME #23616
// ignore-asmjs
// ignore-emscripten

#![feature(asm)]

Expand Down
3 changes: 3 additions & 0 deletions src/test/run-pass/conditional-compile-arch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,3 +36,6 @@ pub fn main() { }

#[cfg(target_arch = "asmjs")]
pub fn main() { }

#[cfg(target_arch = "wasm32")]
pub fn main() { }
2 changes: 2 additions & 0 deletions src/test/run-pass/issue-27859.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Loading