blob: 1e4b144cbed79159c711c1ae8b981384a066df97 [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 Crichton23ab70b2015-09-13 23:38:27 -070019EXTRA_TARGETS=https://people.mozilla.org/~acrichton/libc-test/2015-09-08
20
Alex Crichtonb66b8a42015-09-17 20:55:52 -070021install() {
22 sudo apt-get update
Alex Crichtoncc12d2b2015-10-14 15:58:08 -070023 sudo apt-get install -y $@
Alex Crichtonb66b8a42015-09-17 20:55:52 -070024}
25
Alex Crichton22f3c5e2015-09-18 17:30:58 -070026case "$TARGET" in
Alex Crichton657eeec2015-10-29 10:06:09 -070027 *-apple-ios)
28 curl -s $EXTRA_TARGETS/$TARGET.tar.gz | tar xzf - -C $HOME/rust/lib/rustlib
29 ;;
30
31 *)
32 # Download the rustlib folder from the relevant portion of main distribution's
33 # tarballs.
34 dir=rust-std-$TARGET
35 pkg=rust-std
36 if [ "$TRAVIS_RUST_VERSION" = "1.0.0" ]; then
37 pkg=rust
38 dir=rustc
39 fi
40 curl -s $MAIN_TARGETS/$pkg-$TRAVIS_RUST_VERSION-$TARGET.tar.gz | \
41 tar xzf - -C $HOME/rust/lib/rustlib --strip-components=4 \
42 $pkg-$TRAVIS_RUST_VERSION-$TARGET/$dir/lib/rustlib/$TARGET
43 ;;
44
45esac
46
47case "$TARGET" in
Alex Crichtonacda0132015-09-13 11:22:26 -070048 # Pull a pre-built docker image for testing android, then run tests entirely
Alex Crichton2995f552015-10-29 16:34:55 -070049 # within that image. Note that this is using the same rustc installation that
50 # travis has (sharing it via `-v`) and otherwise the tests run entirely within
51 # the container.
Alex Crichton22f3c5e2015-09-18 17:30:58 -070052 arm-linux-androideabi)
Alex Crichton2995f552015-10-29 16:34:55 -070053 script="
54cp -r /checkout/* .
55mkdir .cargo
56cp ci/cargo-config .cargo/config
Alex Crichton9f52b892015-11-06 15:13:41 -080057exec sh ci/run.sh $TARGET
Alex Crichton2995f552015-10-29 16:34:55 -070058"
59 exec docker run \
60 --entrypoint bash \
61 -v $HOME/rust:/usr/local:ro \
62 -v `pwd`:/checkout:ro \
63 -e LD_LIBRARY_PATH=/usr/local/lib \
64 -it alexcrichton/rust-slave-android:2015-10-21 \
65 -c "$script"
Alex Crichton22f3c5e2015-09-18 17:30:58 -070066 ;;
Alex Crichtona4d78c42015-09-14 13:52:51 -070067
Alex Crichton22f3c5e2015-09-18 17:30:58 -070068 x86_64-unknown-linux-musl)
Alex Crichton22f3c5e2015-09-18 17:30:58 -070069 install musl-tools
70 export CC=musl-gcc
71 ;;
Alex Crichtona4d78c42015-09-14 13:52:51 -070072
Alex Crichton22f3c5e2015-09-18 17:30:58 -070073 arm-unknown-linux-gnueabihf)
Alex Crichton22f3c5e2015-09-18 17:30:58 -070074 install gcc-4.7-arm-linux-gnueabihf qemu-user
75 export CC=arm-linux-gnueabihf-gcc-4.7
76 ;;
Alex Crichtond86471c2015-09-17 17:46:58 -070077
Alex Crichton22f3c5e2015-09-18 17:30:58 -070078 aarch64-unknown-linux-gnu)
Alex Crichton22f3c5e2015-09-18 17:30:58 -070079 install gcc-aarch64-linux-gnu qemu-user
80 export CC=aarch64-linux-gnu-gcc
81 ;;
82
Alex Crichtonbaef6112015-09-19 23:20:53 -070083 *-apple-ios)
Alex Crichtonbaef6112015-09-19 23:20:53 -070084 ;;
85
Alex Crichton22f3c5e2015-09-18 17:30:58 -070086 mips-unknown-linux-gnu)
87 # Download pre-built and custom MIPS libs and then also instsall the MIPS
88 # compiler according to this post:
89 # http://sathisharada.blogspot.com/2014_10_01_archive.html
Alex Crichton22f3c5e2015-09-18 17:30:58 -070090 echo 'deb http://ftp.de.debian.org/debian squeeze main' | \
91 sudo tee -a /etc/apt/sources.list
92 echo 'deb http://www.emdebian.org/debian/ squeeze main' | \
93 sudo tee -a /etc/apt/sources.list
94 install emdebian-archive-keyring
95 install qemu-user gcc-4.4-mips-linux-gnu -y --force-yes
96 export CC=mips-linux-gnu-gcc
97 ;;
98
99 *)
Alex Crichton22f3c5e2015-09-18 17:30:58 -0700100 # clang has better error messages and implements alignof more broadly
101 export CC=clang
102
103 if [ "$TARGET" = "i686-unknown-linux-gnu" ]; then
104 install gcc-multilib
105 fi
106 ;;
107
108esac
Alex Crichton944a7332015-09-14 11:27:10 -0700109
110mkdir .cargo
111cp ci/cargo-config .cargo/config
112sh ci/run.sh $TARGET
Alex Crichton9eca4682015-09-17 00:48:36 -0700113
114if [ "$TARGET" = "x86_64-unknown-linux-gnu" ] && \
115 [ "$TRAVIS_RUST_VERSION" = "nightly" ] && \
116 [ "$TRAVIS_OS_NAME" = "linux" ]; then
117 sh ci/dox.sh
118fi