@@ -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,14 @@ 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+ $cmd
87+
88+ # Everything else is in `libc-test`
89+ cmd=" $cmd --manifest-path libc-test/Cargo.toml"
90+
8191if [ " $target " = " s390x-unknown-linux-gnu" ]; then
8292 # FIXME: s390x-unknown-linux-gnu often fails to test due to timeout,
8393 # so we retry this N times.
@@ -86,52 +96,25 @@ if [ "$target" = "s390x-unknown-linux-gnu" ]; then
8696 passed=0
8797 until [ $n -ge $N ]; do
8898 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
99+ if $cmd --no-default-features; then
95100 passed=$(( passed+ 1 ))
96101 continue
97102 fi
98103 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
104+ if $cmd ; then
104105 passed=$(( passed+ 1 ))
105106 continue
106107 fi
107108 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
109+ if $cmd --features extra_traits; then
114110 break
115111 fi
116112 fi
117113 n=$(( n+ 1 ))
118114 sleep 1
119115 done
120116else
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" }
117+ $cmd --no-default-features
118+ $cmd
119+ $cmd --features extra_traits
137120fi
0 commit comments