@@ -9,6 +9,8 @@ mirrors_url="https://ci-mirrors.rust-lang.org/libc"
99
1010target=" $1 "
1111
12+ export RUST_BACKTRACE=" ${RUST_BACKTRACE:- 1} "
13+
1214# If we're going to run tests inside of a qemu image, then we don't need any of
1315# the scripts below. Instead, download the image, prepare a filesystem which has
1416# the current state of this repository, and then run the image.
@@ -78,6 +80,20 @@ if [ -n "${QEMU:-}" ]; then
7880 exec grep -E " ^(PASSED)|(test result: ok)" " ${CARGO_TARGET_DIR} /out.log"
7981fi
8082
83+ cmd=" cargo test --target $target ${LIBC_CI_ZBUILD_STD+" -Zbuild-std" } "
84+
85+ # Run tests in the `libc` crate
86+ case " $target " in
87+ # FIXME(android): unit tests fail to start on Android
88+ # FIXME(s390x): unit tests fail to locate glibc
89+ * android* ) ;;
90+ * s390x* ) ;;
91+ * ) $cmd
92+ esac
93+
94+ # Everything else is in `libc-test`
95+ cmd=" $cmd --manifest-path libc-test/Cargo.toml"
96+
8197if [ " $target " = " s390x-unknown-linux-gnu" ]; then
8298 # FIXME: s390x-unknown-linux-gnu often fails to test due to timeout,
8399 # so we retry this N times.
@@ -86,52 +102,25 @@ if [ "$target" = "s390x-unknown-linux-gnu" ]; then
86102 passed=0
87103 until [ $n -ge $N ]; do
88104 if [ " $passed " = " 0" ]; then
89- if cargo test \
90- --no-default-features \
91- --manifest-path libc-test/Cargo.toml \
92- --target " $target " \
93- ${LIBC_CI_ZBUILD_STD+" -Zbuild-std" }
94- then
105+ if $cmd --no-default-features; then
95106 passed=$(( passed+ 1 ))
96107 continue
97108 fi
98109 elif [ " $passed " = " 1" ]; then
99- if cargo test \
100- --manifest-path libc-test/Cargo.toml \
101- --target " $target " \
102- ${LIBC_CI_ZBUILD_STD+" -Zbuild-std" }
103- then
110+ if $cmd ; then
104111 passed=$(( passed+ 1 ))
105112 continue
106113 fi
107114 elif [ " $passed " = " 2" ]; then
108- if cargo test \
109- --features extra_traits \
110- --manifest-path libc-test/Cargo.toml \
111- --target " $target " \
112- ${LIBC_CI_ZBUILD_STD+" -Zbuild-std" }
113- then
115+ if $cmd --features extra_traits; then
114116 break
115117 fi
116118 fi
117119 n=$(( n+ 1 ))
118120 sleep 1
119121 done
120122else
121- cargo test \
122- --no-default-features \
123- --manifest-path libc-test/Cargo.toml \
124- --target " $target " \
125- ${LIBC_CI_ZBUILD_STD+" -Zbuild-std" }
126-
127- cargo test \
128- --manifest-path libc-test/Cargo.toml \
129- --target " $target " \
130- ${LIBC_CI_ZBUILD_STD+" -Zbuild-std" }
131-
132- RUST_BACKTRACE=1 cargo test \
133- --features extra_traits \
134- --manifest-path libc-test/Cargo.toml \
135- --target " $target " \
136- ${LIBC_CI_ZBUILD_STD+" -Zbuild-std" }
123+ $cmd --no-default-features
124+ $cmd
125+ $cmd --features extra_traits
137126fi
0 commit comments