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