From b5797dc2a2906ebc360dd4f59b714ab7e04fb630 Mon Sep 17 00:00:00 2001 From: Jorge Aparicio Date: Thu, 29 Sep 2016 18:50:04 -0500 Subject: [PATCH] adapt to new testing infrastructure --- .travis.yml | 18 +++---- build.rs | 2 +- ci/docker/thumbv6m-none-eabi/Dockerfile | 8 +++ ci/docker/thumbv7em-none-eabi/Dockerfile | 8 +++ ci/docker/thumbv7em-none-eabihf/Dockerfile | 8 +++ ci/docker/thumbv7m-none-eabi/Dockerfile | 8 +++ ci/run-docker.sh | 10 ++-- ci/run.sh | 63 ++++++++++++++++++++++ 8 files changed, 105 insertions(+), 20 deletions(-) create mode 100644 ci/docker/thumbv6m-none-eabi/Dockerfile create mode 100644 ci/docker/thumbv7em-none-eabi/Dockerfile create mode 100644 ci/docker/thumbv7em-none-eabihf/Dockerfile create mode 100644 ci/docker/thumbv7m-none-eabi/Dockerfile create mode 100644 ci/run.sh diff --git a/.travis.yml b/.travis.yml index 47252a4..5b84ae5 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,7 +3,6 @@ language: rust services: docker sudo: required rust: nightly -cache: cargo matrix: include: @@ -25,18 +24,11 @@ matrix: - env: TARGET=mipsel-unknown-linux-gnu - env: TARGET=powerpc-unknown-linux-gnu - env: TARGET=powerpc64-unknown-linux-gnu - # QEMU crashes even when executing the simplest cross compiled C program: - # `int main() { return 0; }` - - env: TARGET=powerpc64le-unknown-linux-gnu NO_RUN=1 + - env: TARGET=powerpc64le-unknown-linux-gnu - env: TARGET=thumbv6m-none-eabi - install: cargo install xargo --debug -f - script: $HOME/.cargo/bin/xargo build --target $TARGET - env: TARGET=thumbv7em-none-eabi - install: cargo install xargo --debug -f - script: $HOME/.cargo/bin/xargo build --target $TARGET - env: TARGET=thumbv7em-none-eabihf - install: cargo install xargo --debug -f - script: $HOME/.cargo/bin/xargo build --target $TARGET + - env: TARGET=thumbv7m-none-eabi - env: TARGET=x86_64-apple-darwin os: osx env: TARGET=x86_64-unknown-linux-gnu @@ -45,8 +37,10 @@ before_install: - test "$TRAVIS_OS_NAME" = "osx" || docker run --rm --privileged multiarch/qemu-user-static:register install: - - curl https://static.rust-lang.org/rustup.sh | - sh -s -- --add-target=$TARGET --disable-sudo -y --prefix=`rustc --print sysroot` + - if case $TARGET in thumb*) false;; *) true;; esac; then + curl https://static.rust-lang.org/rustup.sh | + sh -s -- --add-target=$TARGET --disable-sudo -y --prefix=`rustc --print sysroot`; + fi script: - cargo generate-lockfile diff --git a/build.rs b/build.rs index 2333bb1..f58ea5b 100644 --- a/build.rs +++ b/build.rs @@ -406,7 +406,7 @@ fn main() { } for src in sources.map.values() { - cfg.file(Path::new("compiler-rt/lib/builtins").join(src)); + cfg.file(Path::new("compiler-rt/compiler-rt-cdylib/compiler-rt/lib/builtins").join(src)); } cfg.compile("libcompiler-rt.a"); diff --git a/ci/docker/thumbv6m-none-eabi/Dockerfile b/ci/docker/thumbv6m-none-eabi/Dockerfile new file mode 100644 index 0000000..c6f7209 --- /dev/null +++ b/ci/docker/thumbv6m-none-eabi/Dockerfile @@ -0,0 +1,8 @@ +FROM ubuntu:16.04 +RUN apt-get update +RUN apt-get install -y --no-install-recommends \ + ca-certificates curl gcc gcc-arm-none-eabi libc6-dev libcurl4-openssl-dev libssh2-1 libnewlib-dev +ENV AR_thumbv6m_none_eabi=arm-none-eabi-ar \ + CARGO_TARGET_THUMBV6M_NONE_EABI_LINKER=arm-none-eabi-gcc \ + CC_thumbv6m_none_eabi=arm-none-eabi-gcc \ + PATH=$PATH:/rust/bin diff --git a/ci/docker/thumbv7em-none-eabi/Dockerfile b/ci/docker/thumbv7em-none-eabi/Dockerfile new file mode 100644 index 0000000..016097b --- /dev/null +++ b/ci/docker/thumbv7em-none-eabi/Dockerfile @@ -0,0 +1,8 @@ +FROM ubuntu:16.04 +RUN apt-get update +RUN apt-get install -y --no-install-recommends \ + ca-certificates curl gcc gcc-arm-none-eabi libc6-dev libcurl4-openssl-dev libssh2-1 libnewlib-dev +ENV AR_thumbv7em_none_eabi=arm-none-eabi-ar \ + CARGO_TARGET_THUMBV7EM_NONE_EABI_LINKER=arm-none-eabi-gcc \ + CC_thumbv7em_none_eabi=arm-none-eabi-gcc \ + PATH=$PATH:/rust/bin diff --git a/ci/docker/thumbv7em-none-eabihf/Dockerfile b/ci/docker/thumbv7em-none-eabihf/Dockerfile new file mode 100644 index 0000000..c7188ef --- /dev/null +++ b/ci/docker/thumbv7em-none-eabihf/Dockerfile @@ -0,0 +1,8 @@ +FROM ubuntu:16.04 +RUN apt-get update +RUN apt-get install -y --no-install-recommends \ + ca-certificates curl gcc gcc-arm-none-eabi libc6-dev libcurl4-openssl-dev libssh2-1 libnewlib-dev +ENV AR_thumbv7em_none_eabihf=arm-none-eabi-ar \ + CARGO_TARGET_THUMBV7EM_NONE_EABIHF_LINKER=arm-none-eabi-gcc \ + CC_thumbv7em_none_eabihf=arm-none-eabi-gcc \ + PATH=$PATH:/rust/bin diff --git a/ci/docker/thumbv7m-none-eabi/Dockerfile b/ci/docker/thumbv7m-none-eabi/Dockerfile new file mode 100644 index 0000000..542cc92 --- /dev/null +++ b/ci/docker/thumbv7m-none-eabi/Dockerfile @@ -0,0 +1,8 @@ +FROM ubuntu:16.04 +RUN apt-get update +RUN apt-get install -y --no-install-recommends \ + ca-certificates curl gcc gcc-arm-none-eabi libc6-dev libcurl4-openssl-dev libssh2-1 libnewlib-dev +ENV AR_thumbv7m_none_eabi=arm-none-eabi-ar \ + CARGO_TARGET_THUMBV7M_NONE_EABI_LINKER=arm-none-eabi-gcc \ + CC_thumbv7m_none_eabi=arm-none-eabi-gcc \ + PATH=$PATH:/rust/bin diff --git a/ci/run-docker.sh b/ci/run-docker.sh index 8ef024e..6912714 100644 --- a/ci/run-docker.sh +++ b/ci/run-docker.sh @@ -5,19 +5,15 @@ set -ex run() { echo $1 - CMD="cargo test --target $1" - if [ "$NO_RUN" = "1" ]; then - CMD="$CMD --no-run" - fi - docker build -t libc ci/docker/$1 + docker build -t $1 ci/docker/$1 docker run \ -v `rustc --print sysroot`:/rust:ro \ -v `pwd`:/checkout:ro \ -e CARGO_TARGET_DIR=/tmp/target \ -w /checkout \ --privileged \ - -it libc \ - bash -c "$CMD && $CMD --release" + -it $1 \ + sh ci/run.sh $1 } if [ -z "$1" ]; then diff --git a/ci/run.sh b/ci/run.sh new file mode 100644 index 0000000..866ddc2 --- /dev/null +++ b/ci/run.sh @@ -0,0 +1,63 @@ +# Test our implementation +case $1 in + thumb*) + curl -sf "https://raw.githubusercontent.com/japaric/rust-everywhere/master/install.sh" | \ + bash -s -- --at /usr/bin --from japaric/xargo --tag v0.1.10 + xargo build --target $1 + xargo build --target $1 --release + ;; + # QEMU crashes even when executing the simplest cross compiled C program: + # `int main() { return 0; }` + powerpc64le-unknown-linux-gnu) + cargo test --target $1 --no-run + cargo test --target $1 --no-run --release + ;; + *) + cargo test --target $1 + cargo test --target $1 --release + ;; +esac + +# Verify that we haven't drop any intrinsic/symbol +case $1 in + thumb*) + xargo build --features c --target $1 --bin intrinsics + ;; + *) + cargo build --features c --target $1 --bin intrinsics + ;; +esac + +# Look out for duplicated symbols when we include the compiler-rt (C) implementation +PREFIX=$(echo $1 | sed -e 's/unknown-//') +case $1 in + armv7-*) + PREFIX=arm-linux-gnueabihf- + ;; + thumb*) + PREFIX=arm-none-eabi- + ;; + *-unknown-linux-gnu | *-apple-darwin) + PREFIX= + ;; +esac + +case $TRAVIS_OS_NAME in + osx) + NM=gnm + + # NOTE OSx's nm doesn't accept the `--defined-only` or provide an equivalent. + # Use GNU nm instead + brew install binutils + ;; + *) + NM=nm + ;; +esac + +$PREFIX$NM -g --defined-only /tmp/target/${1}/debug/librustc_builtins.rlib | \ + sort | uniq -d | grep 'T __' + +if test $? = 0; then + exit 1 +fi