blob: bb40ba737b3505b366dbc42387275fbdd2acf52c [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
Alex Crichtoncc12d2b2015-10-14 15:58:08 -070020 sudo apt-get install -y $@
Alex Crichtonb66b8a42015-09-17 20:55:52 -070021}
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
Alex Crichtonbaef6112015-09-19 23:20:53 -070050 *-apple-ios)
51 curl -s $EXTRA_TARGETS/$TARGET.tar.gz | tar xzf - -C $HOME/rust/lib/rustlib
52 ;;
53
Alex Crichton22f3c5e2015-09-18 17:30:58 -070054 mips-unknown-linux-gnu)
55 # Download pre-built and custom MIPS libs and then also instsall the MIPS
56 # compiler according to this post:
57 # http://sathisharada.blogspot.com/2014_10_01_archive.html
58 curl -s $EXTRA_TARGETS/$TARGET.tar.gz | tar xzf - -C $HOME/rust/lib/rustlib
59
60 echo 'deb http://ftp.de.debian.org/debian squeeze main' | \
61 sudo tee -a /etc/apt/sources.list
62 echo 'deb http://www.emdebian.org/debian/ squeeze main' | \
63 sudo tee -a /etc/apt/sources.list
64 install emdebian-archive-keyring
65 install qemu-user gcc-4.4-mips-linux-gnu -y --force-yes
66 export CC=mips-linux-gnu-gcc
67 ;;
68
69 *)
70 # Download the rustlib folder from the relevant portion of main distribution's
71 # tarballs.
72 curl -s $MAIN_TARGETS/rust-$TRAVIS_RUST_VERSION-$HOST.tar.gz | \
73 tar xzf - -C $HOME/rust/lib/rustlib --strip-components=4 \
74 rust-$TRAVIS_RUST_VERSION-$HOST/rustc/lib/rustlib/$HOST
75 TARGET=$HOST
76
77 # clang has better error messages and implements alignof more broadly
78 export CC=clang
79
80 if [ "$TARGET" = "i686-unknown-linux-gnu" ]; then
81 install gcc-multilib
82 fi
83 ;;
84
85esac
Alex Crichton944a7332015-09-14 11:27:10 -070086
87mkdir .cargo
88cp ci/cargo-config .cargo/config
89sh ci/run.sh $TARGET
Alex Crichton9eca4682015-09-17 00:48:36 -070090
91if [ "$TARGET" = "x86_64-unknown-linux-gnu" ] && \
92 [ "$TRAVIS_RUST_VERSION" = "nightly" ] && \
93 [ "$TRAVIS_OS_NAME" = "linux" ]; then
94 sh ci/dox.sh
95fi