| 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 | a1b948e | 2015-09-18 11:54:32 -0700 | [diff] [blame] | 23 | # NOTE: this is not actually run on travis right now, this was added to in |
| 24 | # theory run FreeBSD vagrant images on Travis, but it ended up not working, so |
| 25 | # this may not be working when you read this. |
| 26 | install_vagrant() { |
| 27 | echo 'deb http://download.virtualbox.org/virtualbox/debian trusty contrib' | \ |
| 28 | sudo tee -a /etc/apt/sources.list |
| 29 | vbox=virtualbox-5.0_5.0.4-102546~Ubuntu~trusty_amd64.deb |
| 30 | curl https://www.virtualbox.org/download/oracle_vbox.asc | sudo apt-key add - |
| 31 | install virtualbox-5.0 linux-headers-3.16.0-31-generic nfs-kernel-server |
| 32 | |
| 33 | # After we've got virtualbox, install vagrant itself. Note that the version in |
| 34 | # the default ubuntu repos is too old to run the images we have, so install |
| 35 | # the one from the vagrant website's download link |
| 36 | curl -LO https://dl.bintray.com/mitchellh/vagrant/vagrant_1.7.4_x86_64.deb |
| 37 | sudo dpkg -i vagrant_1.7.4_x86_64.deb |
| 38 | } |
| 39 | |
| Alex Crichton | 9eca468 | 2015-09-17 00:48:36 -0700 | [diff] [blame] | 40 | if [ "$TARGET" = "arm-linux-androideabi" ]; then |
| Alex Crichton | acda013 | 2015-09-13 11:22:26 -0700 | [diff] [blame] | 41 | # Pull a pre-built docker image for testing android, then run tests entirely |
| 42 | # within that image. |
| 43 | docker pull alexcrichton/rust-libc-test |
| Alex Crichton | 944a733 | 2015-09-14 11:27:10 -0700 | [diff] [blame] | 44 | exec docker run -v `pwd`:/clone -t alexcrichton/rust-libc-test \ |
| 45 | sh ci/run.sh $TARGET |
| Alex Crichton | 2f846f3 | 2015-09-13 21:21:46 -0700 | [diff] [blame] | 46 | elif [ "$TARGET" = "x86_64-unknown-linux-musl" ]; then |
| Alex Crichton | 23ab70b | 2015-09-13 23:38:27 -0700 | [diff] [blame] | 47 | curl -s $EXTRA_TARGETS/$TARGET.tar.gz | tar xzf - -C $HOME/rust/lib/rustlib |
| Alex Crichton | b66b8a4 | 2015-09-17 20:55:52 -0700 | [diff] [blame] | 48 | install musl-tools |
| Alex Crichton | 15b83c2 | 2015-09-17 17:25:52 -0700 | [diff] [blame] | 49 | export CC=musl-gcc |
| Alex Crichton | 23ab70b | 2015-09-13 23:38:27 -0700 | [diff] [blame] | 50 | elif [ "$TARGET" = "arm-unknown-linux-gnueabihf" ]; then |
| 51 | curl -s $EXTRA_TARGETS/$TARGET.tar.gz | tar xzf - -C $HOME/rust/lib/rustlib |
| Alex Crichton | b66b8a4 | 2015-09-17 20:55:52 -0700 | [diff] [blame] | 52 | install gcc-4.7-arm-linux-gnueabihf qemu-user |
| Alex Crichton | 23ab70b | 2015-09-13 23:38:27 -0700 | [diff] [blame] | 53 | export CC=arm-linux-gnueabihf-gcc-4.7 |
| Alex Crichton | 684cfa4 | 2015-09-17 15:18:18 -0700 | [diff] [blame] | 54 | elif [ "$TARGET" = "aarch64-unknown-linux-gnu" ]; then |
| 55 | curl -s $EXTRA_TARGETS/$TARGET.tar.gz | tar xzf - -C $HOME/rust/lib/rustlib |
| Alex Crichton | b66b8a4 | 2015-09-17 20:55:52 -0700 | [diff] [blame] | 56 | install gcc-aarch64-linux-gnu qemu-user |
| Alex Crichton | 684cfa4 | 2015-09-17 15:18:18 -0700 | [diff] [blame] | 57 | export CC=aarch64-linux-gnu-gcc |
| Alex Crichton | 944a733 | 2015-09-14 11:27:10 -0700 | [diff] [blame] | 58 | elif [ "$TARGET" = "mips-unknown-linux-gnu" ]; then |
| Alex Crichton | a4d78c4 | 2015-09-14 13:52:51 -0700 | [diff] [blame] | 59 | # Download pre-built and custom MIPS libs and then also instsall the MIPS |
| 60 | # compiler according to this post: |
| 61 | # http://sathisharada.blogspot.com/2014_10_01_archive.html |
| Alex Crichton | 944a733 | 2015-09-14 11:27:10 -0700 | [diff] [blame] | 62 | 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] | 63 | |
| Alex Crichton | 944a733 | 2015-09-14 11:27:10 -0700 | [diff] [blame] | 64 | echo 'deb http://ftp.de.debian.org/debian squeeze main' | \ |
| 65 | sudo tee -a /etc/apt/sources.list |
| 66 | echo 'deb http://www.emdebian.org/debian/ squeeze main' | \ |
| 67 | sudo tee -a /etc/apt/sources.list |
| Alex Crichton | b66b8a4 | 2015-09-17 20:55:52 -0700 | [diff] [blame] | 68 | install emdebian-archive-keyring |
| 69 | install qemu-user gcc-4.4-mips-linux-gnu -y --force-yes |
| Alex Crichton | 944a733 | 2015-09-14 11:27:10 -0700 | [diff] [blame] | 70 | export CC=mips-linux-gnu-gcc |
| Alex Crichton | a1b948e | 2015-09-18 11:54:32 -0700 | [diff] [blame] | 71 | elif [ "$TARGET" = "x86_64-unknown-freebsd" ]; then |
| 72 | install_vagrant |
| 73 | cd ci |
| 74 | vagrant up freebsd |
| 75 | exec vagrant ssh freebsd -c \ |
| 76 | 'cd /vagrant && CARGO_TARGET_DIR=/tmp sh ci/run.sh x86_64-unknown-freebsd' |
| Alex Crichton | acda013 | 2015-09-13 11:22:26 -0700 | [diff] [blame] | 77 | else |
| Alex Crichton | a4d78c4 | 2015-09-14 13:52:51 -0700 | [diff] [blame] | 78 | # Download the rustlib folder from the relevant portion of main distribution's |
| 79 | # tarballs. |
| 80 | curl -s $MAIN_TARGETS/rust-$TRAVIS_RUST_VERSION-$HOST.tar.gz | \ |
| 81 | tar xzf - -C $HOME/rust/lib/rustlib --strip-components=4 \ |
| 82 | rust-$TRAVIS_RUST_VERSION-$HOST/rustc/lib/rustlib/$HOST |
| Alex Crichton | 944a733 | 2015-09-14 11:27:10 -0700 | [diff] [blame] | 83 | TARGET=$HOST |
| Alex Crichton | a4d78c4 | 2015-09-14 13:52:51 -0700 | [diff] [blame] | 84 | |
| 85 | # clang has better error messages and implements alignof more broadly |
| 86 | export CC=clang |
| Alex Crichton | d86471c | 2015-09-17 17:46:58 -0700 | [diff] [blame] | 87 | |
| 88 | if [ "$TARGET" = "i686-unknown-linux-gnu" ]; then |
| Alex Crichton | b66b8a4 | 2015-09-17 20:55:52 -0700 | [diff] [blame] | 89 | install gcc-multilib |
| Alex Crichton | d86471c | 2015-09-17 17:46:58 -0700 | [diff] [blame] | 90 | fi |
| Alex Crichton | 83a3049 | 2015-09-12 16:15:48 -0700 | [diff] [blame] | 91 | fi |
| Alex Crichton | 944a733 | 2015-09-14 11:27:10 -0700 | [diff] [blame] | 92 | |
| 93 | mkdir .cargo |
| 94 | cp ci/cargo-config .cargo/config |
| 95 | sh ci/run.sh $TARGET |
| Alex Crichton | 9eca468 | 2015-09-17 00:48:36 -0700 | [diff] [blame] | 96 | |
| 97 | if [ "$TARGET" = "x86_64-unknown-linux-gnu" ] && \ |
| 98 | [ "$TRAVIS_RUST_VERSION" = "nightly" ] && \ |
| 99 | [ "$TRAVIS_OS_NAME" = "linux" ]; then |
| 100 | sh ci/dox.sh |
| 101 | fi |