| 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 | 22f3c5e | 2015-09-18 17:30:58 -0700 | [diff] [blame] | 49 | #d within that image. |
| 50 | arm-linux-androideabi) |
| 51 | docker pull alexcrichton/rust-libc-test |
| 52 | exec docker run -v `pwd`:/clone -t alexcrichton/rust-libc-test \ |
| 53 | sh ci/run.sh $TARGET |
| 54 | ;; |
| Alex Crichton | a4d78c4 | 2015-09-14 13:52:51 -0700 | [diff] [blame] | 55 | |
| Alex Crichton | 22f3c5e | 2015-09-18 17:30:58 -0700 | [diff] [blame] | 56 | x86_64-unknown-linux-musl) |
| Alex Crichton | 22f3c5e | 2015-09-18 17:30:58 -0700 | [diff] [blame] | 57 | install musl-tools |
| 58 | export CC=musl-gcc |
| 59 | ;; |
| Alex Crichton | a4d78c4 | 2015-09-14 13:52:51 -0700 | [diff] [blame] | 60 | |
| Alex Crichton | 22f3c5e | 2015-09-18 17:30:58 -0700 | [diff] [blame] | 61 | arm-unknown-linux-gnueabihf) |
| Alex Crichton | 22f3c5e | 2015-09-18 17:30:58 -0700 | [diff] [blame] | 62 | install gcc-4.7-arm-linux-gnueabihf qemu-user |
| 63 | export CC=arm-linux-gnueabihf-gcc-4.7 |
| 64 | ;; |
| Alex Crichton | d86471c | 2015-09-17 17:46:58 -0700 | [diff] [blame] | 65 | |
| Alex Crichton | 22f3c5e | 2015-09-18 17:30:58 -0700 | [diff] [blame] | 66 | aarch64-unknown-linux-gnu) |
| Alex Crichton | 22f3c5e | 2015-09-18 17:30:58 -0700 | [diff] [blame] | 67 | install gcc-aarch64-linux-gnu qemu-user |
| 68 | export CC=aarch64-linux-gnu-gcc |
| 69 | ;; |
| 70 | |
| Alex Crichton | baef611 | 2015-09-19 23:20:53 -0700 | [diff] [blame] | 71 | *-apple-ios) |
| Alex Crichton | baef611 | 2015-09-19 23:20:53 -0700 | [diff] [blame] | 72 | ;; |
| 73 | |
| Alex Crichton | 22f3c5e | 2015-09-18 17:30:58 -0700 | [diff] [blame] | 74 | mips-unknown-linux-gnu) |
| 75 | # Download pre-built and custom MIPS libs and then also instsall the MIPS |
| 76 | # compiler according to this post: |
| 77 | # http://sathisharada.blogspot.com/2014_10_01_archive.html |
| Alex Crichton | 22f3c5e | 2015-09-18 17:30:58 -0700 | [diff] [blame] | 78 | echo 'deb http://ftp.de.debian.org/debian squeeze main' | \ |
| 79 | sudo tee -a /etc/apt/sources.list |
| 80 | echo 'deb http://www.emdebian.org/debian/ squeeze main' | \ |
| 81 | sudo tee -a /etc/apt/sources.list |
| 82 | install emdebian-archive-keyring |
| 83 | install qemu-user gcc-4.4-mips-linux-gnu -y --force-yes |
| 84 | export CC=mips-linux-gnu-gcc |
| 85 | ;; |
| 86 | |
| 87 | *) |
| Alex Crichton | 22f3c5e | 2015-09-18 17:30:58 -0700 | [diff] [blame] | 88 | # clang has better error messages and implements alignof more broadly |
| 89 | export CC=clang |
| 90 | |
| 91 | if [ "$TARGET" = "i686-unknown-linux-gnu" ]; then |
| 92 | install gcc-multilib |
| 93 | fi |
| 94 | ;; |
| 95 | |
| 96 | esac |
| Alex Crichton | 944a733 | 2015-09-14 11:27:10 -0700 | [diff] [blame] | 97 | |
| 98 | mkdir .cargo |
| 99 | cp ci/cargo-config .cargo/config |
| 100 | sh ci/run.sh $TARGET |
| Alex Crichton | 9eca468 | 2015-09-17 00:48:36 -0700 | [diff] [blame] | 101 | |
| 102 | if [ "$TARGET" = "x86_64-unknown-linux-gnu" ] && \ |
| 103 | [ "$TRAVIS_RUST_VERSION" = "nightly" ] && \ |
| 104 | [ "$TRAVIS_OS_NAME" = "linux" ]; then |
| 105 | sh ci/dox.sh |
| 106 | fi |