| 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 | 9eca468 | 2015-09-17 00:48:36 -0700 | [diff] [blame] | 18 | if [ "$TARGET" = "arm-linux-androideabi" ]; then |
| Alex Crichton | acda013 | 2015-09-13 11:22:26 -0700 | [diff] [blame] | 19 | # Pull a pre-built docker image for testing android, then run tests entirely |
| 20 | # within that image. |
| 21 | docker pull alexcrichton/rust-libc-test |
| Alex Crichton | 944a733 | 2015-09-14 11:27:10 -0700 | [diff] [blame] | 22 | exec docker run -v `pwd`:/clone -t alexcrichton/rust-libc-test \ |
| 23 | sh ci/run.sh $TARGET |
| Alex Crichton | 2f846f3 | 2015-09-13 21:21:46 -0700 | [diff] [blame] | 24 | elif [ "$TARGET" = "x86_64-unknown-linux-musl" ]; then |
| Alex Crichton | 23ab70b | 2015-09-13 23:38:27 -0700 | [diff] [blame] | 25 | curl -s $EXTRA_TARGETS/$TARGET.tar.gz | tar xzf - -C $HOME/rust/lib/rustlib |
| Alex Crichton | 15b83c2 | 2015-09-17 17:25:52 -0700 | [diff] [blame] | 26 | sudo apt-get install musl-tools |
| 27 | export CC=musl-gcc |
| Alex Crichton | 23ab70b | 2015-09-13 23:38:27 -0700 | [diff] [blame] | 28 | elif [ "$TARGET" = "arm-unknown-linux-gnueabihf" ]; then |
| 29 | curl -s $EXTRA_TARGETS/$TARGET.tar.gz | tar xzf - -C $HOME/rust/lib/rustlib |
| Alex Crichton | 517b76a | 2015-09-13 23:53:31 -0700 | [diff] [blame] | 30 | sudo apt-get install gcc-4.7-arm-linux-gnueabihf qemu-user |
| Alex Crichton | 23ab70b | 2015-09-13 23:38:27 -0700 | [diff] [blame] | 31 | export CC=arm-linux-gnueabihf-gcc-4.7 |
| Alex Crichton | 684cfa4 | 2015-09-17 15:18:18 -0700 | [diff] [blame] | 32 | elif [ "$TARGET" = "aarch64-unknown-linux-gnu" ]; then |
| 33 | curl -s $EXTRA_TARGETS/$TARGET.tar.gz | tar xzf - -C $HOME/rust/lib/rustlib |
| 34 | sudo apt-get install gcc-aarch64-linux-gnu qemu-user |
| 35 | export CC=aarch64-linux-gnu-gcc |
| Alex Crichton | 944a733 | 2015-09-14 11:27:10 -0700 | [diff] [blame] | 36 | elif [ "$TARGET" = "mips-unknown-linux-gnu" ]; then |
| Alex Crichton | a4d78c4 | 2015-09-14 13:52:51 -0700 | [diff] [blame] | 37 | # Download pre-built and custom MIPS libs and then also instsall the MIPS |
| 38 | # compiler according to this post: |
| 39 | # http://sathisharada.blogspot.com/2014_10_01_archive.html |
| Alex Crichton | 944a733 | 2015-09-14 11:27:10 -0700 | [diff] [blame] | 40 | curl -s $EXTRA_TARGETS/$TARGET.tar.gz | tar xzf - -C $HOME/rust/lib/rustlib |
| Alex Crichton | a4d78c4 | 2015-09-14 13:52:51 -0700 | [diff] [blame] | 41 | |
| Alex Crichton | 944a733 | 2015-09-14 11:27:10 -0700 | [diff] [blame] | 42 | echo 'deb http://ftp.de.debian.org/debian squeeze main' | \ |
| 43 | sudo tee -a /etc/apt/sources.list |
| 44 | echo 'deb http://www.emdebian.org/debian/ squeeze main' | \ |
| 45 | sudo tee -a /etc/apt/sources.list |
| 46 | sudo apt-get update |
| Alex Crichton | ac5ba00 | 2015-09-14 11:49:09 -0700 | [diff] [blame] | 47 | sudo apt-get install emdebian-archive-keyring |
| Alex Crichton | 86c7c43 | 2015-09-14 12:58:03 -0700 | [diff] [blame] | 48 | sudo apt-get install qemu-user gcc-4.4-mips-linux-gnu -y --force-yes |
| Alex Crichton | 944a733 | 2015-09-14 11:27:10 -0700 | [diff] [blame] | 49 | export CC=mips-linux-gnu-gcc |
| Alex Crichton | acda013 | 2015-09-13 11:22:26 -0700 | [diff] [blame] | 50 | else |
| Alex Crichton | a4d78c4 | 2015-09-14 13:52:51 -0700 | [diff] [blame] | 51 | # Download the rustlib folder from the relevant portion of main distribution's |
| 52 | # tarballs. |
| 53 | curl -s $MAIN_TARGETS/rust-$TRAVIS_RUST_VERSION-$HOST.tar.gz | \ |
| 54 | tar xzf - -C $HOME/rust/lib/rustlib --strip-components=4 \ |
| 55 | rust-$TRAVIS_RUST_VERSION-$HOST/rustc/lib/rustlib/$HOST |
| Alex Crichton | 944a733 | 2015-09-14 11:27:10 -0700 | [diff] [blame] | 56 | TARGET=$HOST |
| Alex Crichton | a4d78c4 | 2015-09-14 13:52:51 -0700 | [diff] [blame] | 57 | |
| 58 | # clang has better error messages and implements alignof more broadly |
| 59 | export CC=clang |
| Alex Crichton | 83a3049 | 2015-09-12 16:15:48 -0700 | [diff] [blame] | 60 | fi |
| Alex Crichton | 944a733 | 2015-09-14 11:27:10 -0700 | [diff] [blame] | 61 | |
| 62 | mkdir .cargo |
| 63 | cp ci/cargo-config .cargo/config |
| 64 | sh ci/run.sh $TARGET |
| Alex Crichton | 9eca468 | 2015-09-17 00:48:36 -0700 | [diff] [blame] | 65 | |
| 66 | if [ "$TARGET" = "x86_64-unknown-linux-gnu" ] && \ |
| 67 | [ "$TRAVIS_RUST_VERSION" = "nightly" ] && \ |
| 68 | [ "$TRAVIS_OS_NAME" = "linux" ]; then |
| 69 | sh ci/dox.sh |
| 70 | fi |