Use a switch instead of if/else
This commit is contained in:
parent
2536b35aa8
commit
22f3c5e1a7
@ -20,42 +20,34 @@ install() {
|
|||||||
sudo apt-get install $@
|
sudo apt-get install $@
|
||||||
}
|
}
|
||||||
|
|
||||||
# NOTE: this is not actually run on travis right now, this was added to in
|
case "$TARGET" in
|
||||||
# theory run FreeBSD vagrant images on Travis, but it ended up not working, so
|
|
||||||
# this may not be working when you read this.
|
|
||||||
install_vagrant() {
|
|
||||||
echo 'deb http://download.virtualbox.org/virtualbox/debian trusty contrib' | \
|
|
||||||
sudo tee -a /etc/apt/sources.list
|
|
||||||
vbox=virtualbox-5.0_5.0.4-102546~Ubuntu~trusty_amd64.deb
|
|
||||||
curl https://www.virtualbox.org/download/oracle_vbox.asc | sudo apt-key add -
|
|
||||||
install virtualbox-5.0 linux-headers-3.16.0-31-generic nfs-kernel-server
|
|
||||||
|
|
||||||
# After we've got virtualbox, install vagrant itself. Note that the version in
|
|
||||||
# the default ubuntu repos is too old to run the images we have, so install
|
|
||||||
# the one from the vagrant website's download link
|
|
||||||
curl -LO https://dl.bintray.com/mitchellh/vagrant/vagrant_1.7.4_x86_64.deb
|
|
||||||
sudo dpkg -i vagrant_1.7.4_x86_64.deb
|
|
||||||
}
|
|
||||||
|
|
||||||
if [ "$TARGET" = "arm-linux-androideabi" ]; then
|
|
||||||
# Pull a pre-built docker image for testing android, then run tests entirely
|
# Pull a pre-built docker image for testing android, then run tests entirely
|
||||||
# within that image.
|
#d within that image.
|
||||||
|
arm-linux-androideabi)
|
||||||
docker pull alexcrichton/rust-libc-test
|
docker pull alexcrichton/rust-libc-test
|
||||||
exec docker run -v `pwd`:/clone -t alexcrichton/rust-libc-test \
|
exec docker run -v `pwd`:/clone -t alexcrichton/rust-libc-test \
|
||||||
sh ci/run.sh $TARGET
|
sh ci/run.sh $TARGET
|
||||||
elif [ "$TARGET" = "x86_64-unknown-linux-musl" ]; then
|
;;
|
||||||
|
|
||||||
|
x86_64-unknown-linux-musl)
|
||||||
curl -s $EXTRA_TARGETS/$TARGET.tar.gz | tar xzf - -C $HOME/rust/lib/rustlib
|
curl -s $EXTRA_TARGETS/$TARGET.tar.gz | tar xzf - -C $HOME/rust/lib/rustlib
|
||||||
install musl-tools
|
install musl-tools
|
||||||
export CC=musl-gcc
|
export CC=musl-gcc
|
||||||
elif [ "$TARGET" = "arm-unknown-linux-gnueabihf" ]; then
|
;;
|
||||||
|
|
||||||
|
arm-unknown-linux-gnueabihf)
|
||||||
curl -s $EXTRA_TARGETS/$TARGET.tar.gz | tar xzf - -C $HOME/rust/lib/rustlib
|
curl -s $EXTRA_TARGETS/$TARGET.tar.gz | tar xzf - -C $HOME/rust/lib/rustlib
|
||||||
install gcc-4.7-arm-linux-gnueabihf qemu-user
|
install gcc-4.7-arm-linux-gnueabihf qemu-user
|
||||||
export CC=arm-linux-gnueabihf-gcc-4.7
|
export CC=arm-linux-gnueabihf-gcc-4.7
|
||||||
elif [ "$TARGET" = "aarch64-unknown-linux-gnu" ]; then
|
;;
|
||||||
|
|
||||||
|
aarch64-unknown-linux-gnu)
|
||||||
curl -s $EXTRA_TARGETS/$TARGET.tar.gz | tar xzf - -C $HOME/rust/lib/rustlib
|
curl -s $EXTRA_TARGETS/$TARGET.tar.gz | tar xzf - -C $HOME/rust/lib/rustlib
|
||||||
install gcc-aarch64-linux-gnu qemu-user
|
install gcc-aarch64-linux-gnu qemu-user
|
||||||
export CC=aarch64-linux-gnu-gcc
|
export CC=aarch64-linux-gnu-gcc
|
||||||
elif [ "$TARGET" = "mips-unknown-linux-gnu" ]; then
|
;;
|
||||||
|
|
||||||
|
mips-unknown-linux-gnu)
|
||||||
# Download pre-built and custom MIPS libs and then also instsall the MIPS
|
# Download pre-built and custom MIPS libs and then also instsall the MIPS
|
||||||
# compiler according to this post:
|
# compiler according to this post:
|
||||||
# http://sathisharada.blogspot.com/2014_10_01_archive.html
|
# http://sathisharada.blogspot.com/2014_10_01_archive.html
|
||||||
@ -68,13 +60,9 @@ elif [ "$TARGET" = "mips-unknown-linux-gnu" ]; then
|
|||||||
install emdebian-archive-keyring
|
install emdebian-archive-keyring
|
||||||
install qemu-user gcc-4.4-mips-linux-gnu -y --force-yes
|
install qemu-user gcc-4.4-mips-linux-gnu -y --force-yes
|
||||||
export CC=mips-linux-gnu-gcc
|
export CC=mips-linux-gnu-gcc
|
||||||
elif [ "$TARGET" = "x86_64-unknown-freebsd" ]; then
|
;;
|
||||||
install_vagrant
|
|
||||||
cd ci
|
*)
|
||||||
vagrant up freebsd
|
|
||||||
exec vagrant ssh freebsd -c \
|
|
||||||
'cd /vagrant && CARGO_TARGET_DIR=/tmp sh ci/run.sh x86_64-unknown-freebsd'
|
|
||||||
else
|
|
||||||
# Download the rustlib folder from the relevant portion of main distribution's
|
# Download the rustlib folder from the relevant portion of main distribution's
|
||||||
# tarballs.
|
# tarballs.
|
||||||
curl -s $MAIN_TARGETS/rust-$TRAVIS_RUST_VERSION-$HOST.tar.gz | \
|
curl -s $MAIN_TARGETS/rust-$TRAVIS_RUST_VERSION-$HOST.tar.gz | \
|
||||||
@ -88,7 +76,9 @@ else
|
|||||||
if [ "$TARGET" = "i686-unknown-linux-gnu" ]; then
|
if [ "$TARGET" = "i686-unknown-linux-gnu" ]; then
|
||||||
install gcc-multilib
|
install gcc-multilib
|
||||||
fi
|
fi
|
||||||
fi
|
;;
|
||||||
|
|
||||||
|
esac
|
||||||
|
|
||||||
mkdir .cargo
|
mkdir .cargo
|
||||||
cp ci/cargo-config .cargo/config
|
cp ci/cargo-config .cargo/config
|
||||||
|
25
ci/run.sh
25
ci/run.sh
@ -8,17 +8,28 @@ set -ex
|
|||||||
TARGET=$1
|
TARGET=$1
|
||||||
cargo build --manifest-path libc-test/Cargo.toml --target $TARGET
|
cargo build --manifest-path libc-test/Cargo.toml --target $TARGET
|
||||||
|
|
||||||
if [ "$TARGET" = "arm-linux-androideabi" ]; then
|
case "$TARGET" in
|
||||||
|
arm-linux-androideabi)
|
||||||
emulator @test -no-window &
|
emulator @test -no-window &
|
||||||
adb wait-for-device
|
adb wait-for-device
|
||||||
adb push /root/target/$TARGET/debug/libc-test /data/libc-test
|
adb push /root/target/$TARGET/debug/libc-test /data/libc-test
|
||||||
adb shell /data/libc-test
|
adb shell /data/libc-test
|
||||||
elif [ "$TARGET" = "arm-unknown-linux-gnueabihf" ]; then
|
;;
|
||||||
|
|
||||||
|
arm-unknown-linux-gnueabihf)
|
||||||
qemu-arm -L /usr/arm-linux-gnueabihf libc-test/target/$TARGET/debug/libc-test
|
qemu-arm -L /usr/arm-linux-gnueabihf libc-test/target/$TARGET/debug/libc-test
|
||||||
elif [ "$TARGET" = "mips-unknown-linux-gnu" ]; then
|
;;
|
||||||
|
|
||||||
|
mips-unknown-linux-gnu)
|
||||||
qemu-mips -L /usr/mips-linux-gnu libc-test/target/$TARGET/debug/libc-test
|
qemu-mips -L /usr/mips-linux-gnu libc-test/target/$TARGET/debug/libc-test
|
||||||
elif [ "$TARGET" = "aarch64-unknown-linux-gnu" ]; then
|
;;
|
||||||
qemu-aarch64 -L /usr/aarch64-linux-gnu/ libc-test/target/$TARGET/debug/libc-test
|
|
||||||
else
|
aarch64-unknown-linux-gnu)
|
||||||
|
qemu-aarch64 -L /usr/aarch64-linux-gnu/ \
|
||||||
|
libc-test/target/$TARGET/debug/libc-test
|
||||||
|
;;
|
||||||
|
|
||||||
|
*)
|
||||||
cargo run --manifest-path libc-test/Cargo.toml --target $TARGET
|
cargo run --manifest-path libc-test/Cargo.toml --target $TARGET
|
||||||
fi
|
;;
|
||||||
|
esac
|
||||||
|
Loading…
Reference in New Issue
Block a user