| 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 |
| 14 | |
| Alex Crichton | 2fe6de4 | 2015-09-14 14:07:49 -0700 | [diff] [blame] | 15 | MAIN_TARGETS=https://static.rust-lang.org/dist |
| Alex Crichton | 23ab70b | 2015-09-13 23:38:27 -0700 | [diff] [blame] | 16 | EXTRA_TARGETS=https://people.mozilla.org/~acrichton/libc-test/2015-09-08 |
| 17 | |
| Alex Crichton | b66b8a4 | 2015-09-17 20:55:52 -0700 | [diff] [blame] | 18 | install() { |
| 19 | sudo apt-get update |
| 20 | sudo apt-get install $@ |
| 21 | } |
| 22 | |
| Alex Crichton | 22f3c5e | 2015-09-18 17:30:58 -0700 | [diff] [blame^] | 23 | case "$TARGET" in |
| Alex Crichton | acda013 | 2015-09-13 11:22:26 -0700 | [diff] [blame] | 24 | # 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^] | 25 | #d within that image. |
| 26 | arm-linux-androideabi) |
| 27 | docker pull alexcrichton/rust-libc-test |
| 28 | exec docker run -v `pwd`:/clone -t alexcrichton/rust-libc-test \ |
| 29 | sh ci/run.sh $TARGET |
| 30 | ;; |
| Alex Crichton | a4d78c4 | 2015-09-14 13:52:51 -0700 | [diff] [blame] | 31 | |
| Alex Crichton | 22f3c5e | 2015-09-18 17:30:58 -0700 | [diff] [blame^] | 32 | x86_64-unknown-linux-musl) |
| 33 | curl -s $EXTRA_TARGETS/$TARGET.tar.gz | tar xzf - -C $HOME/rust/lib/rustlib |
| 34 | install musl-tools |
| 35 | export CC=musl-gcc |
| 36 | ;; |
| Alex Crichton | a4d78c4 | 2015-09-14 13:52:51 -0700 | [diff] [blame] | 37 | |
| Alex Crichton | 22f3c5e | 2015-09-18 17:30:58 -0700 | [diff] [blame^] | 38 | arm-unknown-linux-gnueabihf) |
| 39 | curl -s $EXTRA_TARGETS/$TARGET.tar.gz | tar xzf - -C $HOME/rust/lib/rustlib |
| 40 | install gcc-4.7-arm-linux-gnueabihf qemu-user |
| 41 | export CC=arm-linux-gnueabihf-gcc-4.7 |
| 42 | ;; |
| Alex Crichton | d86471c | 2015-09-17 17:46:58 -0700 | [diff] [blame] | 43 | |
| Alex Crichton | 22f3c5e | 2015-09-18 17:30:58 -0700 | [diff] [blame^] | 44 | aarch64-unknown-linux-gnu) |
| 45 | curl -s $EXTRA_TARGETS/$TARGET.tar.gz | tar xzf - -C $HOME/rust/lib/rustlib |
| 46 | install gcc-aarch64-linux-gnu qemu-user |
| 47 | export CC=aarch64-linux-gnu-gcc |
| 48 | ;; |
| 49 | |
| 50 | mips-unknown-linux-gnu) |
| 51 | # Download pre-built and custom MIPS libs and then also instsall the MIPS |
| 52 | # compiler according to this post: |
| 53 | # http://sathisharada.blogspot.com/2014_10_01_archive.html |
| 54 | curl -s $EXTRA_TARGETS/$TARGET.tar.gz | tar xzf - -C $HOME/rust/lib/rustlib |
| 55 | |
| 56 | echo 'deb http://ftp.de.debian.org/debian squeeze main' | \ |
| 57 | sudo tee -a /etc/apt/sources.list |
| 58 | echo 'deb http://www.emdebian.org/debian/ squeeze main' | \ |
| 59 | sudo tee -a /etc/apt/sources.list |
| 60 | install emdebian-archive-keyring |
| 61 | install qemu-user gcc-4.4-mips-linux-gnu -y --force-yes |
| 62 | export CC=mips-linux-gnu-gcc |
| 63 | ;; |
| 64 | |
| 65 | *) |
| 66 | # Download the rustlib folder from the relevant portion of main distribution's |
| 67 | # tarballs. |
| 68 | curl -s $MAIN_TARGETS/rust-$TRAVIS_RUST_VERSION-$HOST.tar.gz | \ |
| 69 | tar xzf - -C $HOME/rust/lib/rustlib --strip-components=4 \ |
| 70 | rust-$TRAVIS_RUST_VERSION-$HOST/rustc/lib/rustlib/$HOST |
| 71 | TARGET=$HOST |
| 72 | |
| 73 | # clang has better error messages and implements alignof more broadly |
| 74 | export CC=clang |
| 75 | |
| 76 | if [ "$TARGET" = "i686-unknown-linux-gnu" ]; then |
| 77 | install gcc-multilib |
| 78 | fi |
| 79 | ;; |
| 80 | |
| 81 | esac |
| Alex Crichton | 944a733 | 2015-09-14 11:27:10 -0700 | [diff] [blame] | 82 | |
| 83 | mkdir .cargo |
| 84 | cp ci/cargo-config .cargo/config |
| 85 | sh ci/run.sh $TARGET |
| Alex Crichton | 9eca468 | 2015-09-17 00:48:36 -0700 | [diff] [blame] | 86 | |
| 87 | if [ "$TARGET" = "x86_64-unknown-linux-gnu" ] && \ |
| 88 | [ "$TRAVIS_RUST_VERSION" = "nightly" ] && \ |
| 89 | [ "$TRAVIS_OS_NAME" = "linux" ]; then |
| 90 | sh ci/dox.sh |
| 91 | fi |