Skip to content

Commit 8e161a7

Browse files
committed
Expand and refactor teting infrastructure
This commit moves over most of the testing infrastructure to in-tree docker images that are all dispatched to from Travis (no other test configuration). This allows versioning modifications to the test infrastructure as well as the code itself. Additionally separate docker images allows for easy modification of one without worrying about tampering of others as well as easy addition of new targets by simply adding a new `Dockerfile`. Additionally this commit bundles the master version of the `compiler-rt` source repository from `llvm-mirror/compiler-rt` to test against. The compiler-rt library itself is compiled as a `cdylib` which is then dynamically located at runtime and we look for symbols in. There's a few hoops here, but they currently get the job done. All tests now execute against both gcc_s and compiler-rt, and this testing strategy is now all hidden behind a macro as well (refactoring all existing tests along the way).
1 parent c56a3f8 commit 8e161a7

File tree

38 files changed

+621
-523
lines changed

38 files changed

+621
-523
lines changed

.gitmodules

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[submodule "compiler-rt/compiler-rt-cdylib/compiler-rt"]
2+
path = compiler-rt/compiler-rt-cdylib/compiler-rt
3+
url = https://github.com/llvm-mirror/compiler-rt

.travis.yml

+33-32
Original file line numberDiff line numberDiff line change
@@ -1,62 +1,63 @@
11
dist: trusty
2-
language: generic
2+
language: rust
33
services: docker
44
sudo: required
5+
rust: nightly
6+
cache: cargo
57

68
matrix:
79
include:
810
- env: TARGET=aarch64-unknown-linux-gnu
9-
os: linux
1011
- env: TARGET=arm-unknown-linux-gnueabi
11-
os: linux
12+
# FIXME(rust-lang/rust#36518)
13+
rust: nightly-2016-09-21
1214
- env: TARGET=arm-unknown-linux-gnueabihf
13-
os: linux
1415
- env: TARGET=armv7-unknown-linux-gnueabihf
15-
os: linux
1616
- env: TARGET=i586-unknown-linux-gnu
17-
os: linux
1817
- env: TARGET=i686-apple-darwin
19-
language: ruby
18+
# FIXME(rust-lang/rust#36793)
19+
rust: nightly-2016-09-10
2020
os: osx
2121
- env: TARGET=i686-unknown-linux-gnu
22-
os: linux
22+
# FIXME(rust-lang/rust#36793)
23+
rust: nightly-2016-09-10
2324
- env: TARGET=mips-unknown-linux-gnu
24-
os: linux
2525
- env: TARGET=mipsel-unknown-linux-gnu
26-
os: linux
2726
- env: TARGET=powerpc-unknown-linux-gnu
28-
os: linux
2927
- env: TARGET=powerpc64-unknown-linux-gnu
30-
os: linux
31-
- env: TARGET=powerpc64le-unknown-linux-gnu
32-
os: linux
28+
# QEMU crashes even when executing the simplest cross compiled C program:
29+
# `int main() { return 0; }`
30+
- env: TARGET=powerpc64le-unknown-linux-gnu NO_RUN=1
3331
- env: TARGET=thumbv6m-none-eabi
34-
os: linux
35-
- env: TARGET=thumbv6m-none-eabi WEAK=true
36-
os: linux
32+
install: cargo install xargo --debug -f
33+
script: $HOME/.cargo/bin/xargo build --target $TARGET
3734
- env: TARGET=thumbv7em-none-eabi
38-
os: linux
39-
- env: TARGET=thumbv7em-none-eabi WEAK=true
40-
os: linux
35+
install: cargo install xargo --debug -f
36+
script: $HOME/.cargo/bin/xargo build --target $TARGET
4137
- env: TARGET=thumbv7em-none-eabihf
42-
os: linux
43-
- env: TARGET=thumbv7em-none-eabihf WEAK=true
44-
os: linux
45-
- env: TARGET=thumbv7m-none-eabi
46-
os: linux
47-
- env: TARGET=thumbv7m-none-eabi WEAK=true
48-
os: linux
38+
install: cargo install xargo --debug -f
39+
script: $HOME/.cargo/bin/xargo build --target $TARGET
4940
- env: TARGET=x86_64-apple-darwin
50-
language: ruby
5141
os: osx
52-
- env: TARGET=x86_64-unknown-linux-gnu
53-
os: linux
42+
env: TARGET=x86_64-unknown-linux-gnu
43+
44+
before_install:
45+
- test "$TRAVIS_OS_NAME" = "osx" || docker run --rm --privileged multiarch/qemu-user-static:register
5446

5547
install:
56-
- bash ci/install.sh
48+
- curl https://static.rust-lang.org/rustup.sh |
49+
sh -s -- --add-target=$TARGET --disable-sudo -y --prefix=`rustc --print sysroot`
5750

5851
script:
59-
- bash ci/script.sh
52+
- cargo generate-lockfile
53+
- if [[ $TRAVIS_OS_NAME = "linux" ]]; then
54+
sudo apt-get remove -y qemu-user-static &&
55+
sudo apt-get install -y qemu-user-static &&
56+
sh ci/run-docker.sh $TARGET;
57+
else
58+
cargo test --target $TARGET &&
59+
cargo test --target $TARGET --release;
60+
fi
6061

6162
branches:
6263
only:

Cargo.toml

+2-3
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,8 @@ optional = true
1313
[dev-dependencies]
1414
quickcheck = "0.3.1"
1515
rand = "0.3.14"
16-
17-
[dev-dependencies.gcc_s]
18-
path = "gcc_s"
16+
gcc_s = { path = "gcc_s" }
17+
compiler-rt = { path = "compiler-rt" }
1918

2019
[features]
2120
weak = ["rlibc/weak"]

README.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ See [rust-lang/rust#35437][0].
1616

1717
If you are working with a target that doesn't have binary releases of std available via rustup (this
1818
probably means you are building the core crate yourself) and need compiler-rt intrinsics (i.e. you
19-
are probably getting linker errors when building an executable: "undefined reference to
20-
__aeabi_memcpy"), you can use this crate to get those intrinsics and solve the linker errors. To do
19+
are probably getting linker errors when building an executable: `undefined reference to
20+
__aeabi_memcpy`), you can use this crate to get those intrinsics and solve the linker errors. To do
2121
that, simply add this crate as a Cargo dependency (it doesn't matter where in the dependency graph
2222
this crate ends up, as long as it's there):
2323

@@ -52,7 +52,7 @@ porting that particular intrinsic.
5252
1. [Rust][4] and [C][5] have slightly different operator precedence. C evaluates comparisons (`== !=`) before bitwise operations (`& | ^`), while Rust evaluates the other way.
5353
2. C assumes wrapping operations everywhere. Rust panics on overflow when in debug mode. Consider using the [Wrapping][6] type or the explicit [wrapping_*][7] functions where applicable.
5454
3. Note [C implicit casts][8], especially integer promotion. Rust is much more explicit about casting, so be sure that any cast which affects the output is ported to the Rust implementation.
55-
4. Rust has [many functions][9] for integer or floating point manipulation in the standard library. Consider using one of these functions rather than porting a new one.
55+
4. Rust has [many functions][9] for integer or floating point manipulation in the standard library. Consider using one of these functions rather than porting a new one.
5656

5757
[4]: https://doc.rust-lang.org/reference.html#operator-precedence
5858
[5]: http://en.cppreference.com/w/c/language/operator_precedence

appveyor.yml

+1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ environment:
44
- TARGET: x86_64-pc-windows-msvc
55

66
install:
7+
- git submodule update --init
78
- curl -sSf -o rustup-init.exe https://win.rustup.rs
89
- rustup-init.exe --default-host %TARGET% --default-toolchain nightly -y
910
- set PATH=%PATH%;C:\Users\appveyor\.cargo\bin

build.rs

+1
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,5 @@ fn main() {
44
if env::var("TARGET").unwrap().ends_with("gnueabihf") {
55
println!("cargo:rustc-cfg=gnueabihf")
66
}
7+
println!("cargo:rerun-if-changed=build.rs");
78
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
FROM ubuntu:16.04
2+
RUN apt-get update
3+
RUN apt-get install -y --no-install-recommends \
4+
gcc libc6-dev ca-certificates \
5+
gcc-aarch64-linux-gnu libc6-dev-arm64-cross \
6+
qemu-user-static
7+
ENV CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER=aarch64-linux-gnu-gcc \
8+
PATH=$PATH:/rust/bin \
9+
QEMU_LD_PREFIX=/usr/aarch64-linux-gnu \
10+
RUST_TEST_THREADS=1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
FROM ubuntu:16.04
2+
RUN apt-get update
3+
RUN apt-get install -y --no-install-recommends \
4+
gcc libc6-dev ca-certificates \
5+
gcc-arm-linux-gnueabi libc6-dev-armel-cross qemu-user-static
6+
ENV CARGO_TARGET_ARM_UNKNOWN_LINUX_GNUEABI_LINKER=arm-linux-gnueabi-gcc \
7+
PATH=$PATH:/rust/bin \
8+
QEMU_LD_PREFIX=/usr/arm-linux-gnueabi \
9+
RUST_TEST_THREADS=1
10+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
FROM ubuntu:16.04
2+
RUN apt-get update
3+
RUN apt-get install -y --no-install-recommends \
4+
gcc libc6-dev ca-certificates \
5+
gcc-arm-linux-gnueabihf libc6-dev-armhf-cross qemu-user-static
6+
ENV CARGO_TARGET_ARM_UNKNOWN_LINUX_GNUEABIHF_LINKER=arm-linux-gnueabihf-gcc \
7+
PATH=$PATH:/rust/bin \
8+
QEMU_LD_PREFIX=/usr/arm-linux-gnueabihf \
9+
RUST_TEST_THREADS=1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
FROM ubuntu:16.04
2+
RUN apt-get update
3+
RUN apt-get install -y --no-install-recommends \
4+
gcc libc6-dev ca-certificates \
5+
gcc-arm-linux-gnueabihf libc6-dev-armhf-cross qemu-user-static
6+
ENV CARGO_TARGET_ARMV7_UNKNOWN_LINUX_GNUEABIHF_LINKER=arm-linux-gnueabihf-gcc \
7+
PATH=$PATH:/rust/bin \
8+
QEMU_LD_PREFIX=/usr/arm-linux-gnueabihf \
9+
RUST_TEST_THREADS=1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
FROM ubuntu:16.04
2+
RUN apt-get update
3+
RUN apt-get install -y --no-install-recommends \
4+
gcc-multilib libc6-dev ca-certificates
5+
ENV PATH=$PATH:/rust/bin
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
FROM ubuntu:16.04
2+
RUN apt-get update
3+
RUN apt-get install -y --no-install-recommends \
4+
gcc-multilib libc6-dev ca-certificates
5+
ENV PATH=$PATH:/rust/bin
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
FROM ubuntu:16.04
2+
3+
RUN apt-get update
4+
RUN apt-get install -y --no-install-recommends \
5+
gcc libc6-dev ca-certificates \
6+
gcc-mips-linux-gnu libc6-dev-mips-cross \
7+
binfmt-support qemu-user-static qemu-system-mips
8+
9+
ENV CARGO_TARGET_MIPS_UNKNOWN_LINUX_GNU_LINKER=mips-linux-gnu-gcc \
10+
PATH=$PATH:/rust/bin \
11+
QEMU_LD_PREFIX=/usr/mips-linux-gnu \
12+
RUST_TEST_THREADS=1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
FROM ubuntu:16.04
2+
3+
RUN apt-get update
4+
RUN apt-get install -y --no-install-recommends \
5+
gcc libc6-dev ca-certificates \
6+
gcc-mipsel-linux-gnu libc6-dev-mipsel-cross \
7+
binfmt-support qemu-user-static
8+
9+
ENV CARGO_TARGET_MIPSEL_UNKNOWN_LINUX_GNU_LINKER=mipsel-linux-gnu-gcc \
10+
PATH=$PATH:/rust/bin \
11+
QEMU_LD_PREFIX=/usr/mipsel-linux-gnu \
12+
RUST_TEST_THREADS=1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
FROM ubuntu:16.04
2+
3+
RUN apt-get update
4+
RUN apt-get install -y --no-install-recommends \
5+
gcc libc6-dev qemu-user-static ca-certificates \
6+
gcc-powerpc-linux-gnu libc6-dev-powerpc-cross \
7+
qemu-system-ppc
8+
9+
ENV CARGO_TARGET_POWERPC_UNKNOWN_LINUX_GNU_LINKER=powerpc-linux-gnu-gcc \
10+
PATH=$PATH:/rust/bin \
11+
QEMU_LD_PREFIX=/usr/powerpc-linux-gnu \
12+
RUST_TEST_THREADS=1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
FROM ubuntu:16.04
2+
3+
RUN apt-get update
4+
RUN apt-get install -y --no-install-recommends \
5+
gcc libc6-dev ca-certificates \
6+
gcc-powerpc64-linux-gnu libc6-dev-ppc64-cross \
7+
binfmt-support qemu-user-static qemu-system-ppc
8+
9+
ENV CARGO_TARGET_POWERPC64_UNKNOWN_LINUX_GNU_LINKER=powerpc64-linux-gnu-gcc \
10+
CC_powerpc64_unknown_linux_gnu=powerpc64-linux-gnu-gcc \
11+
PATH=$PATH:/rust/bin \
12+
QEMU_LD_PREFIX=/usr/powerpc64-linux-gnu \
13+
RUST_TEST_THREADS=1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
FROM ubuntu:16.04
2+
3+
RUN apt-get update
4+
RUN apt-get install -y --no-install-recommends \
5+
gcc libc6-dev qemu-user-static ca-certificates \
6+
gcc-powerpc64le-linux-gnu libc6-dev-ppc64el-cross \
7+
qemu-system-ppc
8+
9+
ENV CARGO_TARGET_POWERPC64LE_UNKNOWN_LINUX_GNU_LINKER=powerpc64le-linux-gnu-gcc \
10+
CC_powerpc64le_unknown_linux_gnu=powerpc64le-linux-gnu-gcc \
11+
PATH=$PATH:/rust/bin \
12+
QEMU_LD_PREFIX=/usr/powerpc64le-linux-gnu \
13+
RUST_TEST_THREADS=1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
FROM ubuntu:16.04
2+
RUN apt-get update
3+
RUN apt-get install -y --no-install-recommends \
4+
gcc libc6-dev ca-certificates
5+
ENV PATH=$PATH:/rust/bin
6+

ci/env.sh

-51
This file was deleted.

ci/install.sh

-53
This file was deleted.

0 commit comments

Comments
 (0)