blob: b7a50b77c06cc00ad1d5102c67a5254b64d572e2 [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() {
Alex Crichton8dce9ad2015-12-03 11:44:14 -080023 if [ "$TRAVIS" = "true" ]; then
24 sudo apt-get update
25 sudo apt-get install -y $@
26 fi
Alex Crichtonb66b8a42015-09-17 20:55:52 -070027}
28
Alex Crichton49d7bca2015-11-27 09:40:37 -080029mkdir -p .cargo
30cp ci/cargo-config .cargo/config
31
Alex Crichton8dce9ad2015-12-03 11:44:14 -080032if [ "$TRAVIS" = "true" ]; then
33 case "$TARGET" in
34 *-apple-ios | *-rumprun-*)
35 curl -s $EXTRA_TARGETS/$TARGET.tar.gz | \
36 tar xzf - -C `rustc --print sysroot`/lib/rustlib
37 ;;
Alex Crichton657eeec2015-10-29 10:06:09 -070038
Alex Crichton8dce9ad2015-12-03 11:44:14 -080039 *)
40 # Download the rustlib folder from the relevant portion of main distribution's
41 # tarballs.
42 dir=rust-std-$TARGET
43 pkg=rust-std
44 if [ "$TRAVIS_RUST_VERSION" = "1.0.0" ]; then
45 pkg=rust
46 dir=rustc
47 fi
48 curl -s $MAIN_TARGETS/$pkg-$TRAVIS_RUST_VERSION-$TARGET.tar.gz | \
49 tar xzf - -C $HOME/rust/lib/rustlib --strip-components=4 \
50 $pkg-$TRAVIS_RUST_VERSION-$TARGET/$dir/lib/rustlib/$TARGET
51 ;;
Alex Crichton657eeec2015-10-29 10:06:09 -070052
Alex Crichton8dce9ad2015-12-03 11:44:14 -080053 esac
54fi
Alex Crichton657eeec2015-10-29 10:06:09 -070055
Alex Crichton49d7bca2015-11-27 09:40:37 -080056# Pull a pre-built docker image for testing android, then run tests entirely
57# within that image. Note that this is using the same rustc installation that
58# travis has (sharing it via `-v`) and otherwise the tests run entirely within
59# the container.
60if [ "$DOCKER" != "" ]; then
61 exec docker run \
62 --entrypoint bash \
63 -v `rustc --print sysroot`:/usr/local:ro \
64 -v `pwd`:/checkout \
65 -e LD_LIBRARY_PATH=/usr/local/lib \
66 -e CARGO_TARGET_DIR=/tmp \
67 -w /checkout \
68 -it $DOCKER \
69 ci/run.sh $TARGET
70fi
Alex Crichtona4d78c42015-09-14 13:52:51 -070071
Alex Crichton49d7bca2015-11-27 09:40:37 -080072case "$TARGET" in
Alex Crichton22f3c5e2015-09-18 17:30:58 -070073 x86_64-unknown-linux-musl)
Alex Crichton22f3c5e2015-09-18 17:30:58 -070074 install musl-tools
75 export CC=musl-gcc
76 ;;
Alex Crichtona4d78c42015-09-14 13:52:51 -070077
Alex Crichton22f3c5e2015-09-18 17:30:58 -070078 arm-unknown-linux-gnueabihf)
Alex Crichton22f3c5e2015-09-18 17:30:58 -070079 install gcc-4.7-arm-linux-gnueabihf qemu-user
80 export CC=arm-linux-gnueabihf-gcc-4.7
81 ;;
Alex Crichtond86471c2015-09-17 17:46:58 -070082
Alex Crichton22f3c5e2015-09-18 17:30:58 -070083 aarch64-unknown-linux-gnu)
Alex Crichton22f3c5e2015-09-18 17:30:58 -070084 install gcc-aarch64-linux-gnu qemu-user
85 export CC=aarch64-linux-gnu-gcc
86 ;;
87
Alex Crichtonbaef6112015-09-19 23:20:53 -070088 *-apple-ios)
Alex Crichtonbaef6112015-09-19 23:20:53 -070089 ;;
90
Alex Crichton22f3c5e2015-09-18 17:30:58 -070091 mips-unknown-linux-gnu)
92 # Download pre-built and custom MIPS libs and then also instsall the MIPS
93 # compiler according to this post:
94 # http://sathisharada.blogspot.com/2014_10_01_archive.html
Alex Crichton22f3c5e2015-09-18 17:30:58 -070095 echo 'deb http://ftp.de.debian.org/debian squeeze main' | \
96 sudo tee -a /etc/apt/sources.list
97 echo 'deb http://www.emdebian.org/debian/ squeeze main' | \
98 sudo tee -a /etc/apt/sources.list
99 install emdebian-archive-keyring
100 install qemu-user gcc-4.4-mips-linux-gnu -y --force-yes
101 export CC=mips-linux-gnu-gcc
102 ;;
103
104 *)
Alex Crichton22f3c5e2015-09-18 17:30:58 -0700105 # clang has better error messages and implements alignof more broadly
106 export CC=clang
107
108 if [ "$TARGET" = "i686-unknown-linux-gnu" ]; then
109 install gcc-multilib
110 fi
111 ;;
112
113esac
Alex Crichton944a7332015-09-14 11:27:10 -0700114
Alex Crichton944a7332015-09-14 11:27:10 -0700115sh ci/run.sh $TARGET
Alex Crichton9eca4682015-09-17 00:48:36 -0700116
117if [ "$TARGET" = "x86_64-unknown-linux-gnu" ] && \
118 [ "$TRAVIS_RUST_VERSION" = "nightly" ] && \
119 [ "$TRAVIS_OS_NAME" = "linux" ]; then
120 sh ci/dox.sh
121fi