Răsfoiți Sursa

adapt to new testing infrastructure

Jorge Aparicio 8 ani în urmă
părinte
comite
b5797dc2a2

+ 6 - 12
.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

+ 1 - 1
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");

+ 8 - 0
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

+ 8 - 0
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

+ 8 - 0
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

+ 8 - 0
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

+ 3 - 7
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

+ 63 - 0
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