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