@@ -11,7 +11,9 @@ OS=${TRAVIS_OS_NAME}
1111echo " Testing Rust ${RUST} on ${OS} "
1212
1313test_target () {
14- TARGET=" ${1} "
14+ CARGO=" ${1} "
15+ TARGET=" ${2} "
16+ NO_STD=" ${3} "
1517
1618 opt=
1719 if [ " ${TARGET} " = " x86_64-unknown-linux-gnux32" ]; then
@@ -22,31 +24,38 @@ test_target() {
2224 opt=" --release"
2325 fi
2426
25- NO_STD=
26- case ${TARGET} in
27- thumbv* )
28- NO_STD=1
29- ;;
30- esac
31-
32- rustup target add " ${TARGET} " --toolchain " ${RUST} " || true
27+ # If there is a std component, fetch it:
28+ if [ " ${NO_STD} " != " 1" ]; then
29+ # FIXME: rustup often fails to download some artifacts due to network
30+ # issues, so we retry this N times.
31+ N=5
32+ n=0
33+ until [ $n -ge $N ]
34+ do
35+ if rustup target add " ${TARGET} " --toolchain " ${RUST} " ; then
36+ break
37+ fi
38+ n=$(( n+ 1 ))
39+ sleep 1
40+ done
41+ fi
3342
3443 # Test that libc builds without any default features (no libstd)
35- cargo " +${RUST} " build -vv $opt --no-default-features --target " ${TARGET} "
44+ " $CARGO " " +${RUST} " build -vv $opt --no-default-features --target " ${TARGET} "
3645
3746 # Test that libc builds with default features (e.g. libstd)
3847 # if the target supports libstd
3948 if [ " $NO_STD " != " 1" ]; then
40- cargo " +${RUST} " build -vv $opt --target " ${TARGET} "
49+ " $CARGO " " +${RUST} " build -vv $opt --target " ${TARGET} "
4150 fi
4251
4352 # Test that libc builds with the `extra_traits` feature
44- cargo " +${RUST} " build -vv $opt --no-default-features --target " ${TARGET} " \
53+ " $CARGO " " +${RUST} " build -vv $opt --no-default-features --target " ${TARGET} " \
4554 --features extra_traits
4655
4756 # Also test that it builds with `extra_traits` and default features:
4857 if [ " $NO_STD " != " 1" ]; then
49- cargo " +${RUST} " build -vv $opt --target " ${TARGET} " \
58+ " $CARGO " " +${RUST} " build -vv $opt --target " ${TARGET} " \
5059 --features extra_traits
5160 fi
5261}
@@ -103,24 +112,15 @@ x86_64-unknown-cloudabi \
103112
104113RUST_NIGHTLY_LINUX_TARGETS=" \
105114aarch64-fuchsia \
106- thumbv6m-none-eabi \
107- thumbv7em-none-eabi \
108- thumbv7em-none-eabihf \
109- thumbv7m-none-eabi \
110- thumbv7neon-linux-androideabi \
111- thumbv7neon-unknown-linux-gnueabihf \
115+ armv5te-unknown-linux-gnueabi \
116+ armv5te-unknown-linux-musleabi \
117+ i686-pc-windows-gnu \
112118x86_64-fortanix-unknown-sgx \
113119x86_64-fuchsia \
120+ x86_64-pc-windows-gnu \
114121x86_64-unknown-linux-gnux32 \
115122x86_64-unknown-redox \
116123"
117- # FIXME: these do not have a rust-std component available
118- # aarch64-unknown-cloudabi armv7-unknown-cloudabi-eabihf
119- # i686-unknown-cloudabi powerpc-unknown-linux-gnuspe
120- # sparc-unknown-linux-gnu mips-unknown-linux-uclib
121- # i686-unknown-haiku mipsel-unknown-unknown-linux-uclib
122- # sparc64-unknown-netbsd x86_64-unknown-bitrig x86_64-unknown-haiku
123- # x86_64-unknown-openbsd i686-unknown-netbsd
124124
125125RUST_OSX_TARGETS=" \
126126aarch64-apple-ios \
@@ -161,5 +161,45 @@ case "${OS}" in
161161esac
162162
163163for TARGET in $TARGETS ; do
164- test_target " $TARGET "
164+ test_target cargo " $TARGET "
165165done
166+
167+ # FIXME: https://github.com/rust-lang/rust/issues/58564
168+ # sparc-unknown-linux-gnu
169+ RUST_LINUX_NO_CORE_TARGETS=" \
170+ x86_64-unknown-dragonfly \
171+ aarch64-pc-windows-msvc \
172+ aarch64-unknown-cloudabi \
173+ armebv7r-none-eabi \
174+ armebv7r-none-eabihf \
175+ armv7-unknown-cloudabi-eabihf \
176+ armv7r-none-eabi \
177+ armv7r-none-eabihf \
178+ i586-pc-windows-msvc \
179+ i686-pc-windows-msvc \
180+ i686-unknown-cloudabi \
181+ i686-unknown-haiku \
182+ i686-unknown-netbsd \
183+ nvptx64-nvidia-cuda \
184+ powerpc-unknown-linux-gnuspe \
185+ riscv32imac-unknown-none-elf \
186+ riscv32imc-unknown-none-elf \
187+ sparc64-unknown-netbsd \
188+ thumbv6m-none-eabi \
189+ thumbv7em-none-eabi \
190+ thumbv7em-none-eabihf \
191+ thumbv7m-none-eabi \
192+ thumbv7neon-linux-androideabi \
193+ thumbv7neon-unknown-linux-gnueabihf \
194+ thumbv8m.main-none-eabi \
195+ x86_64-pc-windows-msvc
196+ x86_64-unknown-bitrig \
197+ x86_64-unknown-haiku \
198+ x86_64-unknown-openbsd
199+ "
200+
201+ if [ " ${RUST} " = " nightly" ] && [ " ${OS} " = " linux" ]; then
202+ for TARGET in $RUST_LINUX_NO_CORE_TARGETS ; do
203+ test_target xargo " $TARGET " 1
204+ done
205+ fi
0 commit comments