Skip to content

Commit 911b544

Browse files
committed
Retry N times on s390x CI to avoid timeout failure
1 parent d5066c5 commit 911b544

File tree

1 file changed

+34
-6
lines changed

1 file changed

+34
-6
lines changed

ci/run.sh

Lines changed: 34 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -82,17 +82,45 @@ if [ "$QEMU" != "" ]; then
8282
exec egrep "^(PASSED)|(test result: ok)" "${CARGO_TARGET_DIR}/out.log"
8383
fi
8484

85-
# FIXME: x86_64-unknown-linux-gnux32 fail to compile without --release
85+
# FIXME: x86_64-unknown-linux-gnux32 fails to compile without --release
8686
# See https://github.com/rust-lang/rust/issues/59220
8787
opt=
8888
if [ "$TARGET" = "x86_64-unknown-linux-gnux32" ]; then
8989
opt="--release"
9090
fi
9191

92-
cargo test $opt --no-default-features --manifest-path libc-test/Cargo.toml \
93-
--target "${TARGET}"
92+
if [ "$TARGET" = "s390x-unknown-linux-gnu" ]; then
93+
# FIXME: s390x-unknown-linux-gnu often fails to test due to timeout,
94+
# so we retry this N times.
95+
N=5
96+
n=0
97+
passed=0
98+
until [ $n -ge $N ]
99+
do
100+
if [ "$passed" = "0" ]; then
101+
if cargo test --no-default-features --manifest-path libc-test/Cargo.toml --target "${TARGET}" ; then
102+
passed=$((passed+1))
103+
continue
104+
fi
105+
elif [ "$passed" = "1" ]; then
106+
if cargo test $opt --manifest-path libc-test/Cargo.toml --target "${TARGET}" ; then
107+
passed=$((passed+1))
108+
continue
109+
fi
110+
elif [ "$passed" = "2" ]; then
111+
if cargo test $opt --features extra_traits --manifest-path libc-test/Cargo.toml --target "${TARGET}"; then
112+
break
113+
fi
114+
fi
115+
n=$((n+1))
116+
sleep 1
117+
done
118+
else
119+
cargo test $opt --no-default-features --manifest-path libc-test/Cargo.toml \
120+
--target "${TARGET}"
94121

95-
cargo test $opt --manifest-path libc-test/Cargo.toml --target "${TARGET}"
122+
cargo test $opt --manifest-path libc-test/Cargo.toml --target "${TARGET}"
96123

97-
cargo test $opt --features extra_traits --manifest-path libc-test/Cargo.toml \
98-
--target "${TARGET}"
124+
cargo test $opt --features extra_traits --manifest-path libc-test/Cargo.toml \
125+
--target "${TARGET}"
126+
fi

0 commit comments

Comments
 (0)