| Alex Crichton | d9962f4 | 2015-09-17 17:45:10 -0700 | [diff] [blame] | 1 | # Entry point for all travis builds, this will set up the Travis environment by |
| 2 | # downloading any dependencies. It will then execute the `run.sh` script to |
| 3 | # build and execute all tests. |
| 4 | |
| Alex Crichton | 83a3049 | 2015-09-12 16:15:48 -0700 | [diff] [blame] | 5 | set -ex |
| 6 | |
| Alex Crichton | e47a450 | 2015-09-12 16:42:49 -0700 | [diff] [blame] | 7 | if [ "$TRAVIS_OS_NAME" = "linux" ]; then |
| Alex Crichton | 83a3049 | 2015-09-12 16:15:48 -0700 | [diff] [blame] | 8 | OS=unknown-linux-gnu |
| 9 | else |
| 10 | OS=apple-darwin |
| 11 | fi |
| 12 | |
| 13 | export HOST=$ARCH-$OS |
| Alex Crichton | 657eeec | 2015-10-29 10:06:09 -0700 | [diff] [blame] | 14 | if [ "$TARGET" = "" ]; then |
| 15 | TARGET=$HOST |
| 16 | fi |
| Alex Crichton | 83a3049 | 2015-09-12 16:15:48 -0700 | [diff] [blame] | 17 | |
| Alex Crichton | 2fe6de4 | 2015-09-14 14:07:49 -0700 | [diff] [blame] | 18 | MAIN_TARGETS=https://static.rust-lang.org/dist |
| Alex Crichton | 49d7bca | 2015-11-27 09:40:37 -0800 | [diff] [blame] | 19 | DATE=$(echo $TRAVIS_RUST_VERSION | sed s/nightly-//) |
| 20 | EXTRA_TARGETS=https://people.mozilla.org/~acrichton/libc-test/$DATE |
| Alex Crichton | 23ab70b | 2015-09-13 23:38:27 -0700 | [diff] [blame] | 21 | |
| Alex Crichton | b66b8a4 | 2015-09-17 20:55:52 -0700 | [diff] [blame] | 22 | install() { |
| 23 | sudo apt-get update |
| Alex Crichton | cc12d2b | 2015-10-14 15:58:08 -0700 | [diff] [blame] | 24 | sudo apt-get install -y $@ |
| Alex Crichton | b66b8a4 | 2015-09-17 20:55:52 -0700 | [diff] [blame] | 25 | } |
| 26 | |
| Alex Crichton | 49d7bca | 2015-11-27 09:40:37 -0800 | [diff] [blame] | 27 | mkdir -p .cargo |
| 28 | cp ci/cargo-config .cargo/config |
| 29 | |
| Alex Crichton | 22f3c5e | 2015-09-18 17:30:58 -0700 | [diff] [blame] | 30 | case "$TARGET" in |
| Alex Crichton | 49d7bca | 2015-11-27 09:40:37 -0800 | [diff] [blame] | 31 | *-apple-ios | *-rumprun-*) |
| 32 | curl -s $EXTRA_TARGETS/$TARGET.tar.gz | \ |
| 33 | tar xzf - -C `rustc --print sysroot`/lib/rustlib |
| Alex Crichton | 657eeec | 2015-10-29 10:06:09 -0700 | [diff] [blame] | 34 | ;; |
| 35 | |
| 36 | *) |
| 37 | # Download the rustlib folder from the relevant portion of main distribution's |
| 38 | # tarballs. |
| 39 | dir=rust-std-$TARGET |
| 40 | pkg=rust-std |
| 41 | if [ "$TRAVIS_RUST_VERSION" = "1.0.0" ]; then |
| 42 | pkg=rust |
| 43 | dir=rustc |
| 44 | fi |
| 45 | curl -s $MAIN_TARGETS/$pkg-$TRAVIS_RUST_VERSION-$TARGET.tar.gz | \ |
| 46 | tar xzf - -C $HOME/rust/lib/rustlib --strip-components=4 \ |
| 47 | $pkg-$TRAVIS_RUST_VERSION-$TARGET/$dir/lib/rustlib/$TARGET |
| 48 | ;; |
| 49 | |
| 50 | esac |
| 51 | |
| Alex Crichton | 49d7bca | 2015-11-27 09:40:37 -0800 | [diff] [blame] | 52 | # Pull a pre-built docker image for testing android, then run tests entirely |
| 53 | # within that image. Note that this is using the same rustc installation that |
| 54 | # travis has (sharing it via `-v`) and otherwise the tests run entirely within |
| 55 | # the container. |
| 56 | if [ "$DOCKER" != "" ]; then |
| 57 | exec docker run \ |
| 58 | --entrypoint bash \ |
| 59 | -v `rustc --print sysroot`:/usr/local:ro \ |
| 60 | -v `pwd`:/checkout \ |
| 61 | -e LD_LIBRARY_PATH=/usr/local/lib \ |
| 62 | -e CARGO_TARGET_DIR=/tmp \ |
| 63 | -w /checkout \ |
| 64 | -it $DOCKER \ |
| 65 | ci/run.sh $TARGET |
| 66 | fi |
| Alex Crichton | a4d78c4 | 2015-09-14 13:52:51 -0700 | [diff] [blame] | 67 | |
| Alex Crichton | 49d7bca | 2015-11-27 09:40:37 -0800 | [diff] [blame] | 68 | case "$TARGET" in |
| Alex Crichton | 22f3c5e | 2015-09-18 17:30:58 -0700 | [diff] [blame] | 69 | x86_64-unknown-linux-musl) |
| Alex Crichton | 22f3c5e | 2015-09-18 17:30:58 -0700 | [diff] [blame] | 70 | install musl-tools |
| 71 | export CC=musl-gcc |
| 72 | ;; |
| Alex Crichton | a4d78c4 | 2015-09-14 13:52:51 -0700 | [diff] [blame] | 73 | |
| Alex Crichton | 22f3c5e | 2015-09-18 17:30:58 -0700 | [diff] [blame] | 74 | arm-unknown-linux-gnueabihf) |
| Alex Crichton | 22f3c5e | 2015-09-18 17:30:58 -0700 | [diff] [blame] | 75 | install gcc-4.7-arm-linux-gnueabihf qemu-user |
| 76 | export CC=arm-linux-gnueabihf-gcc-4.7 |
| 77 | ;; |
| Alex Crichton | d86471c | 2015-09-17 17:46:58 -0700 | [diff] [blame] | 78 | |
| Alex Crichton | 22f3c5e | 2015-09-18 17:30:58 -0700 | [diff] [blame] | 79 | aarch64-unknown-linux-gnu) |
| Alex Crichton | 22f3c5e | 2015-09-18 17:30:58 -0700 | [diff] [blame] | 80 | install gcc-aarch64-linux-gnu qemu-user |
| 81 | export CC=aarch64-linux-gnu-gcc |
| 82 | ;; |
| 83 | |
| Alex Crichton | baef611 | 2015-09-19 23:20:53 -0700 | [diff] [blame] | 84 | *-apple-ios) |
| Alex Crichton | baef611 | 2015-09-19 23:20:53 -0700 | [diff] [blame] | 85 | ;; |
| 86 | |
| Alex Crichton | 22f3c5e | 2015-09-18 17:30:58 -0700 | [diff] [blame] | 87 | mips-unknown-linux-gnu) |
| 88 | # Download pre-built and custom MIPS libs and then also instsall the MIPS |
| 89 | # compiler according to this post: |
| 90 | # http://sathisharada.blogspot.com/2014_10_01_archive.html |
| Alex Crichton | 22f3c5e | 2015-09-18 17:30:58 -0700 | [diff] [blame] | 91 | echo 'deb http://ftp.de.debian.org/debian squeeze main' | \ |
| 92 | sudo tee -a /etc/apt/sources.list |
| 93 | echo 'deb http://www.emdebian.org/debian/ squeeze main' | \ |
| 94 | sudo tee -a /etc/apt/sources.list |
| 95 | install emdebian-archive-keyring |
| 96 | install qemu-user gcc-4.4-mips-linux-gnu -y --force-yes |
| 97 | export CC=mips-linux-gnu-gcc |
| 98 | ;; |
| 99 | |
| 100 | *) |
| Alex Crichton | 22f3c5e | 2015-09-18 17:30:58 -0700 | [diff] [blame] | 101 | # clang has better error messages and implements alignof more broadly |
| 102 | export CC=clang |
| 103 | |
| 104 | if [ "$TARGET" = "i686-unknown-linux-gnu" ]; then |
| 105 | install gcc-multilib |
| 106 | fi |
| 107 | ;; |
| 108 | |
| 109 | esac |
| Alex Crichton | 944a733 | 2015-09-14 11:27:10 -0700 | [diff] [blame] | 110 | |
| Alex Crichton | 944a733 | 2015-09-14 11:27:10 -0700 | [diff] [blame] | 111 | sh ci/run.sh $TARGET |
| Alex Crichton | 9eca468 | 2015-09-17 00:48:36 -0700 | [diff] [blame] | 112 | |
| 113 | if [ "$TARGET" = "x86_64-unknown-linux-gnu" ] && \ |
| 114 | [ "$TRAVIS_RUST_VERSION" = "nightly" ] && \ |
| 115 | [ "$TRAVIS_OS_NAME" = "linux" ]; then |
| 116 | sh ci/dox.sh |
| 117 | fi |