Skip to content

Commit

Permalink
ci: Reduce redundancy in run.sh and run tests in the libc crate
Browse files Browse the repository at this point in the history
We haven't been running any tests associated with the `libc` crate, make
sure we do this here. Also simplify some redundant things in the script.
  • Loading branch information
tgross35 committed Nov 25, 2024
1 parent aff3132 commit e0c4e5b
Showing 1 changed file with 16 additions and 33 deletions.
49 changes: 16 additions & 33 deletions ci/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ mirrors_url="https://ci-mirrors.rust-lang.org/libc"

target="$1"

export RUST_BACKTRACE="${RUST_BACKTRACE:-1}"

# If we're going to run tests inside of a qemu image, then we don't need any of
# the scripts below. Instead, download the image, prepare a filesystem which has
# the current state of this repository, and then run the image.
Expand Down Expand Up @@ -78,6 +80,14 @@ if [ -n "${QEMU:-}" ]; then
exec grep -E "^(PASSED)|(test result: ok)" "${CARGO_TARGET_DIR}/out.log"
fi

cmd="cargo test --target $target ${LIBC_CI_ZBUILD_STD+"-Zbuild-std"}"

# Run tests in the `libc` crate
$cmd

# Everything else is in `libc-test`
cmd="$cmd --manifest-path libc-test/Cargo.toml"

if [ "$target" = "s390x-unknown-linux-gnu" ]; then
# FIXME: s390x-unknown-linux-gnu often fails to test due to timeout,
# so we retry this N times.
Expand All @@ -86,52 +96,25 @@ if [ "$target" = "s390x-unknown-linux-gnu" ]; then
passed=0
until [ $n -ge $N ]; do
if [ "$passed" = "0" ]; then
if cargo test \
--no-default-features \
--manifest-path libc-test/Cargo.toml \
--target "$target" \
${LIBC_CI_ZBUILD_STD+"-Zbuild-std"}
then
if $cmd --no-default-features; then
passed=$((passed+1))
continue
fi
elif [ "$passed" = "1" ]; then
if cargo test \
--manifest-path libc-test/Cargo.toml \
--target "$target" \
${LIBC_CI_ZBUILD_STD+"-Zbuild-std"}
then
if $cmd; then
passed=$((passed+1))
continue
fi
elif [ "$passed" = "2" ]; then
if cargo test \
--features extra_traits \
--manifest-path libc-test/Cargo.toml \
--target "$target" \
${LIBC_CI_ZBUILD_STD+"-Zbuild-std"}
then
if $cmd --features extra_traits; then
break
fi
fi
n=$((n+1))
sleep 1
done
else
cargo test \
--no-default-features \
--manifest-path libc-test/Cargo.toml \
--target "$target" \
${LIBC_CI_ZBUILD_STD+"-Zbuild-std"}

cargo test \
--manifest-path libc-test/Cargo.toml \
--target "$target" \
${LIBC_CI_ZBUILD_STD+"-Zbuild-std"}

RUST_BACKTRACE=1 cargo test \
--features extra_traits \
--manifest-path libc-test/Cargo.toml \
--target "$target" \
${LIBC_CI_ZBUILD_STD+"-Zbuild-std"}
$cmd --no-default-features
$cmd
$cmd --features extra_traits
fi

0 comments on commit e0c4e5b

Please sign in to comment.