blob: ec55d86168cf1df4cd0d0f5cc1f374882485ba67 [file] [log] [blame]
Alex Crichtond9962f42015-09-17 17:45:10 -07001# 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 Crichton83a30492015-09-12 16:15:48 -07005set -ex
6
Alex Crichtone47a4502015-09-12 16:42:49 -07007if [ "$TRAVIS_OS_NAME" = "linux" ]; then
Alex Crichton83a30492015-09-12 16:15:48 -07008 OS=unknown-linux-gnu
9else
10 OS=apple-darwin
11fi
12
13export HOST=$ARCH-$OS
Alex Crichton657eeec2015-10-29 10:06:09 -070014if [ "$TARGET" = "" ]; then
15 TARGET=$HOST
16fi
Alex Crichton83a30492015-09-12 16:15:48 -070017
Alex Crichton2fe6de42015-09-14 14:07:49 -070018MAIN_TARGETS=https://static.rust-lang.org/dist
Alex Crichton49d7bca2015-11-27 09:40:37 -080019DATE=$(echo $TRAVIS_RUST_VERSION | sed s/nightly-//)
20EXTRA_TARGETS=https://people.mozilla.org/~acrichton/libc-test/$DATE
Alex Crichton23ab70b2015-09-13 23:38:27 -070021
Alex Crichtonb66b8a42015-09-17 20:55:52 -070022install() {
23 sudo apt-get update
Alex Crichtoncc12d2b2015-10-14 15:58:08 -070024 sudo apt-get install -y $@
Alex Crichtonb66b8a42015-09-17 20:55:52 -070025}
26
Alex Crichton49d7bca2015-11-27 09:40:37 -080027mkdir -p .cargo
28cp ci/cargo-config .cargo/config
29
Alex Crichton22f3c5e2015-09-18 17:30:58 -070030case "$TARGET" in
Alex Crichton49d7bca2015-11-27 09:40:37 -080031 *-apple-ios | *-rumprun-*)
32 curl -s $EXTRA_TARGETS/$TARGET.tar.gz | \
33 tar xzf - -C `rustc --print sysroot`/lib/rustlib
Alex Crichton657eeec2015-10-29 10:06:09 -070034 ;;
35
36 *)
37 # Download the rustlib folder from the relevant portion of main distribution's
38 # tarballs.
39 dir=rust-std-$TARGET
40 pkg=rust-std
41 if [ "$TRAVIS_RUST_VERSION" = "1.0.0" ]; then
42 pkg=rust
43 dir=rustc
44 fi
45 curl -s $MAIN_TARGETS/$pkg-$TRAVIS_RUST_VERSION-$TARGET.tar.gz | \
46 tar xzf - -C $HOME/rust/lib/rustlib --strip-components=4 \
47 $pkg-$TRAVIS_RUST_VERSION-$TARGET/$dir/lib/rustlib/$TARGET
48 ;;
49
50esac
51
Alex Crichton49d7bca2015-11-27 09:40:37 -080052# Pull a pre-built docker image for testing android, then run tests entirely
53# within that image. Note that this is using the same rustc installation that
54# travis has (sharing it via `-v`) and otherwise the tests run entirely within
55# the container.
56if [ "$DOCKER" != "" ]; then
57 exec docker run \
58 --entrypoint bash \
59 -v `rustc --print sysroot`:/usr/local:ro \
60 -v `pwd`:/checkout \
61 -e LD_LIBRARY_PATH=/usr/local/lib \
62 -e CARGO_TARGET_DIR=/tmp \
63 -w /checkout \
64 -it $DOCKER \
65 ci/run.sh $TARGET
66fi
Alex Crichtona4d78c42015-09-14 13:52:51 -070067
Alex Crichton49d7bca2015-11-27 09:40:37 -080068case "$TARGET" in
Alex Crichton22f3c5e2015-09-18 17:30:58 -070069 x86_64-unknown-linux-musl)
Alex Crichton22f3c5e2015-09-18 17:30:58 -070070 install musl-tools
71 export CC=musl-gcc
72 ;;
Alex Crichtona4d78c42015-09-14 13:52:51 -070073
Alex Crichton22f3c5e2015-09-18 17:30:58 -070074 arm-unknown-linux-gnueabihf)
Alex Crichton22f3c5e2015-09-18 17:30:58 -070075 install gcc-4.7-arm-linux-gnueabihf qemu-user
76 export CC=arm-linux-gnueabihf-gcc-4.7
77 ;;
Alex Crichtond86471c2015-09-17 17:46:58 -070078
Alex Crichton22f3c5e2015-09-18 17:30:58 -070079 aarch64-unknown-linux-gnu)
Alex Crichton22f3c5e2015-09-18 17:30:58 -070080 install gcc-aarch64-linux-gnu qemu-user
81 export CC=aarch64-linux-gnu-gcc
82 ;;
83
Alex Crichtonbaef6112015-09-19 23:20:53 -070084 *-apple-ios)
Alex Crichtonbaef6112015-09-19 23:20:53 -070085 ;;
86
Alex Crichton22f3c5e2015-09-18 17:30:58 -070087 mips-unknown-linux-gnu)
88 # Download pre-built and custom MIPS libs and then also instsall the MIPS
89 # compiler according to this post:
90 # http://sathisharada.blogspot.com/2014_10_01_archive.html
Alex Crichton22f3c5e2015-09-18 17:30:58 -070091 echo 'deb http://ftp.de.debian.org/debian squeeze main' | \
92 sudo tee -a /etc/apt/sources.list
93 echo 'deb http://www.emdebian.org/debian/ squeeze main' | \
94 sudo tee -a /etc/apt/sources.list
95 install emdebian-archive-keyring
96 install qemu-user gcc-4.4-mips-linux-gnu -y --force-yes
97 export CC=mips-linux-gnu-gcc
98 ;;
99
100 *)
Alex Crichton22f3c5e2015-09-18 17:30:58 -0700101 # clang has better error messages and implements alignof more broadly
102 export CC=clang
103
104 if [ "$TARGET" = "i686-unknown-linux-gnu" ]; then
105 install gcc-multilib
106 fi
107 ;;
108
109esac
Alex Crichton944a7332015-09-14 11:27:10 -0700110
Alex Crichton944a7332015-09-14 11:27:10 -0700111sh ci/run.sh $TARGET
Alex Crichton9eca4682015-09-17 00:48:36 -0700112
113if [ "$TARGET" = "x86_64-unknown-linux-gnu" ] && \
114 [ "$TRAVIS_RUST_VERSION" = "nightly" ] && \
115 [ "$TRAVIS_OS_NAME" = "linux" ]; then
116 sh ci/dox.sh
117fi