Skip to content

Commit e8f9d2d

Browse files
committed
travis: Get an emscripten builder online
This commit adds a new entry to the Travis matrix which will execute emscripten test suites. Along the way it updates a few bits of the test suite to continue passing on emscripten, such as: * Ignoring i128/u128 tests as they're presumably just not working (didn't investigate as to why) * Disabling a few process tests (not working on emscripten) * Ignore some num tests in libstd (#39119) * Fix some warnings when compiling
1 parent aedebfe commit e8f9d2d

25 files changed

+92
-2
lines changed

src/bootstrap/sanity.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ pub fn check(build: &mut Build) {
4545
let target = path.join(cmd);
4646
let mut cmd_alt = cmd.to_os_string();
4747
cmd_alt.push(".exe");
48-
if target.exists() ||
48+
if target.is_file() ||
4949
target.with_extension("exe").exists() ||
5050
target.join(cmd_alt).exists() {
5151
return Some(target);

src/ci/docker/emscripten/Dockerfile

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
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+
lib32stdc++6
16+
17+
ENV SCCACHE_DIGEST=7237e38e029342fa27b7ac25412cb9d52554008b12389727320bd533fd7f05b6a96d55485f305caf95e5c8f5f97c3313e10012ccad3e752aba2518f3522ba783
18+
RUN curl -L https://api.pub.build.mozilla.org/tooltool/sha512/$SCCACHE_DIGEST | \
19+
tar xJf - -C /usr/local/bin --strip-components=1
20+
21+
RUN curl -OL https://github.com/Yelp/dumb-init/releases/download/v1.2.0/dumb-init_1.2.0_amd64.deb && \
22+
dpkg -i dumb-init_*.deb && \
23+
rm dumb-init_*.deb
24+
ENTRYPOINT ["/usr/bin/dumb-init", "--"]
25+
26+
WORKDIR /tmp
27+
COPY build-emscripten.sh /tmp/
28+
RUN ./build-emscripten.sh
29+
ENV PATH=$PATH:/tmp/emsdk_portable
30+
ENV PATH=$PATH:/tmp/emsdk_portable/clang/tag-e1.37.1/build_tag-e1.37.1_32/bin
31+
ENV PATH=$PATH:/tmp/emsdk_portable/node/4.1.1_32bit/bin
32+
ENV PATH=$PATH:/tmp/emsdk_portable/emscripten/tag-1.37.1
33+
ENV EMSCRIPTEN=/tmp/emsdk_portable/emscripten/tag-1.37.1
34+
35+
ENV RUST_CONFIGURE_ARGS --target=asmjs-unknown-emscripten
36+
37+
# Run `emcc` first as it's got a prompt and doesn't actually do anything, after
38+
# that's done with do the real build.
39+
ENV SCRIPT emcc && \
40+
python2.7 ../x.py test --target asmjs-unknown-emscripten
41+
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
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+
set -ex
13+
14+
curl https://s3.amazonaws.com/mozilla-games/emscripten/releases/emsdk-portable.tar.gz | \
15+
tar xzf -
16+
source emsdk_portable/emsdk_env.sh
17+
emsdk update
18+
emsdk install --build=Release sdk-tag-1.37.1-32bit
19+
emsdk activate --build=Release sdk-tag-1.37.1-32bit

src/libstd/net/test.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
#[allow(dead_code)] // not used on emscripten
11+
#![allow(warnings)] // not used on emscripten
1212

1313
use env;
1414
use net::{SocketAddr, SocketAddrV4, SocketAddrV6, Ipv4Addr, Ipv6Addr, ToSocketAddrs};

src/libstd/num.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,7 @@ mod tests {
172172

173173
macro_rules! test_checked_next_power_of_two {
174174
($test_name:ident, $T:ident) => (
175+
#[cfg_attr(target_os = "emscripten", ignore)] // FIXME(#39119)
175176
fn $test_name() {
176177
#![test]
177178
assert_eq!((0 as $T).checked_next_power_of_two(), Some(1));

src/test/codegen/fastcall-inreg.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@
5353
// ignore-shave
5454
// ignore-wasm32
5555
// ignore-wasm64
56+
// ignore-emscripten
5657

5758
// compile-flags: -C no-prepopulate-passes
5859

src/test/compile-fail/asm-bad-clobber.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
// ignore-arm
1313
// ignore-aarch64
1414
// ignore-s390x
15+
// ignore-emscripten
1516

1617
#![feature(asm, rustc_attrs)]
1718

src/test/compile-fail/asm-in-bad-modifier.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
// except according to those terms.
1010

1111
// ignore-s390x
12+
// ignore-emscripten
1213

1314
#![feature(asm)]
1415

src/test/compile-fail/asm-misplaced-option.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
// ignore-arm
1313
// ignore-aarch64
1414
// ignore-s390x
15+
// ignore-emscripten
1516

1617
#![feature(asm, rustc_attrs)]
1718

src/test/compile-fail/asm-out-assign-imm.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
// except according to those terms.
1010

1111
// ignore-s390x
12+
// ignore-emscripten
1213

1314
#![feature(asm)]
1415

src/test/compile-fail/asm-out-no-modifier.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
// except according to those terms.
1010

1111
// ignore-s390x
12+
// ignore-emscripten
1213

1314
#![feature(asm)]
1415

src/test/compile-fail/asm-out-read-uninit.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
// except according to those terms.
1010

1111
// ignore-s390x
12+
// ignore-emscripten
1213

1314
#![feature(asm)]
1415

src/test/compile-fail/asm-src-loc-codegen-units.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
// ignore-stage1
1313
// compile-flags: -C codegen-units=2
1414
// error-pattern: build without -C codegen-units for more exact errors
15+
// ignore-emscripten
1516

1617
#![feature(asm)]
1718

src/test/compile-fail/asm-src-loc.rs

Lines changed: 2 additions & 0 deletions
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-emscripten
12+
1113
#![feature(asm)]
1214

1315
fn main() {

src/test/compile-fail/cdylib-deps-must-be-static.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
// error-pattern: dependency `cdylib_dep` not found in rlib format
1212
// aux-build:cdylib-dep.rs
1313
// ignore-musl
14+
// ignore-emscripten
1415

1516
#![crate_type = "cdylib"]
1617

src/test/compile-fail/macro-expanded-include/test.rs

Lines changed: 2 additions & 0 deletions
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-emscripten
12+
1113
#![feature(asm, rustc_attrs)]
1214
#![allow(unused)]
1315

src/test/compile-fail/panic-runtime/abort-link-to-unwind-dylib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010

1111
// compile-flags:-C panic=abort -C prefer-dynamic
1212
// ignore-musl - no dylibs here
13+
// ignore-emscripten
1314
// error-pattern:`panic_unwind` is not compiled with this crate's panic strategy
1415

1516
// This is a test where the local crate, compiled with `panic=abort`, links to

src/test/compile-fail/two-allocators-3.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
// aux-build:allocator1.rs
1212
// error-pattern: cannot link together two allocators
1313
// ignore-musl no dylibs on musl yet
14+
// ignore-emscripten
1415

1516
// We're linking std dynamically (via -C prefer-dynamic for this test) which
1617
// has an allocator and then we're also linking in a new allocator (allocator1)

src/test/run-pass-valgrind/down-with-thread-dtors.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
// except according to those terms.
1010

1111
// no-prefer-dynamic
12+
// ignore-emscripten
1213

1314
thread_local!(static FOO: Foo = Foo);
1415
thread_local!(static BAR: Bar = Bar(1));

src/test/run-pass-valgrind/exit-flushes.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
// no-prefer-dynamic
1212
// ignore-macos this needs valgrind 3.11 or higher; see
1313
// https://github.com/rust-lang/rust/pull/30365#issuecomment-165763679
14+
// ignore-emscripten
1415

1516
use std::env;
1617
use std::process::{exit, Command};

src/test/run-pass/i128-ffi.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@
2020
// Ignore 32 bit targets:
2121
// ignore-x86, ignore-arm
2222

23+
// ignore-emscripten
24+
2325
#![feature(i128_type)]
2426

2527
#[link(name = "rust_test_helpers", kind = "static")]

src/test/run-pass/i128.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@
1010

1111
// ignore-stage0
1212
// ignore-stage1
13+
14+
// ignore-emscripten
15+
1316
#![feature(i128_type, test)]
1417

1518
extern crate test;

src/test/run-pass/stdio-is-blocking.rs

Lines changed: 2 additions & 0 deletions
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-emscripten
12+
1113
use std::env;
1214
use std::io::prelude::*;
1315
use std::process::Command;

src/test/run-pass/try-wait.rs

Lines changed: 2 additions & 0 deletions
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-emscripten
12+
1113
#![feature(process_try_wait)]
1214

1315
use std::env;

src/test/run-pass/u128.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@
1010

1111
// ignore-stage0
1212
// ignore-stage1
13+
14+
// ignore-emscripten
15+
1316
#![feature(i128_type, test)]
1417

1518
extern crate test;

0 commit comments

Comments
 (0)