blob: 0bebd4245140a01ba83d28e1f2b37615775fe479 [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
14
Alex Crichton2fe6de42015-09-14 14:07:49 -070015MAIN_TARGETS=https://static.rust-lang.org/dist
Alex Crichton23ab70b2015-09-13 23:38:27 -070016EXTRA_TARGETS=https://people.mozilla.org/~acrichton/libc-test/2015-09-08
17
Alex Crichtonb66b8a42015-09-17 20:55:52 -070018install() {
19 sudo apt-get update
20 sudo apt-get install $@
21}
22
Alex Crichton22f3c5e2015-09-18 17:30:58 -070023case "$TARGET" in
Alex Crichtonacda0132015-09-13 11:22:26 -070024 # Pull a pre-built docker image for testing android, then run tests entirely
Alex Crichton22f3c5e2015-09-18 17:30:58 -070025 #d within that image.
26 arm-linux-androideabi)
27 docker pull alexcrichton/rust-libc-test
28 exec docker run -v `pwd`:/clone -t alexcrichton/rust-libc-test \
29 sh ci/run.sh $TARGET
30 ;;
Alex Crichtona4d78c42015-09-14 13:52:51 -070031
Alex Crichton22f3c5e2015-09-18 17:30:58 -070032 x86_64-unknown-linux-musl)
33 curl -s $EXTRA_TARGETS/$TARGET.tar.gz | tar xzf - -C $HOME/rust/lib/rustlib
34 install musl-tools
35 export CC=musl-gcc
36 ;;
Alex Crichtona4d78c42015-09-14 13:52:51 -070037
Alex Crichton22f3c5e2015-09-18 17:30:58 -070038 arm-unknown-linux-gnueabihf)
39 curl -s $EXTRA_TARGETS/$TARGET.tar.gz | tar xzf - -C $HOME/rust/lib/rustlib
40 install gcc-4.7-arm-linux-gnueabihf qemu-user
41 export CC=arm-linux-gnueabihf-gcc-4.7
42 ;;
Alex Crichtond86471c2015-09-17 17:46:58 -070043
Alex Crichton22f3c5e2015-09-18 17:30:58 -070044 aarch64-unknown-linux-gnu)
45 curl -s $EXTRA_TARGETS/$TARGET.tar.gz | tar xzf - -C $HOME/rust/lib/rustlib
46 install gcc-aarch64-linux-gnu qemu-user
47 export CC=aarch64-linux-gnu-gcc
48 ;;
49
50 mips-unknown-linux-gnu)
51 # Download pre-built and custom MIPS libs and then also instsall the MIPS
52 # compiler according to this post:
53 # http://sathisharada.blogspot.com/2014_10_01_archive.html
54 curl -s $EXTRA_TARGETS/$TARGET.tar.gz | tar xzf - -C $HOME/rust/lib/rustlib
55
56 echo 'deb http://ftp.de.debian.org/debian squeeze main' | \
57 sudo tee -a /etc/apt/sources.list
58 echo 'deb http://www.emdebian.org/debian/ squeeze main' | \
59 sudo tee -a /etc/apt/sources.list
60 install emdebian-archive-keyring
61 install qemu-user gcc-4.4-mips-linux-gnu -y --force-yes
62 export CC=mips-linux-gnu-gcc
63 ;;
64
65 *)
66 # Download the rustlib folder from the relevant portion of main distribution's
67 # tarballs.
68 curl -s $MAIN_TARGETS/rust-$TRAVIS_RUST_VERSION-$HOST.tar.gz | \
69 tar xzf - -C $HOME/rust/lib/rustlib --strip-components=4 \
70 rust-$TRAVIS_RUST_VERSION-$HOST/rustc/lib/rustlib/$HOST
71 TARGET=$HOST
72
73 # clang has better error messages and implements alignof more broadly
74 export CC=clang
75
76 if [ "$TARGET" = "i686-unknown-linux-gnu" ]; then
77 install gcc-multilib
78 fi
79 ;;
80
81esac
Alex Crichton944a7332015-09-14 11:27:10 -070082
83mkdir .cargo
84cp ci/cargo-config .cargo/config
85sh ci/run.sh $TARGET
Alex Crichton9eca4682015-09-17 00:48:36 -070086
87if [ "$TARGET" = "x86_64-unknown-linux-gnu" ] && \
88 [ "$TRAVIS_RUST_VERSION" = "nightly" ] && \
89 [ "$TRAVIS_OS_NAME" = "linux" ]; then
90 sh ci/dox.sh
91fi