Skip to content

Commit

Permalink
ci: Ensure build channels get run even if FILTER is unset
Browse files Browse the repository at this point in the history
In 59a18de("ci: Set `-u` (error on unset)..."), `-u` started being
passed to the `set` call in shell scripts. This broke the `FILTER` logic
since now the command always fails.

Make this a bit less fragile by explicitly setting to an empty string,
as well as adding a check that at least one test got run.

(backport <rust-lang#4125>)
(cherry picked from commit 084f370)
  • Loading branch information
tgross35 committed Nov 20, 2024
1 parent 46ebe26 commit bcb4107
Showing 1 changed file with 16 additions and 3 deletions.
19 changes: 16 additions & 3 deletions ci/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ set -eux
: "${OS?The OS environment variable must be set.}"

rust="$TOOLCHAIN"
filter="${FILTER:-}"

echo "Testing Rust $rust on $OS"

Expand Down Expand Up @@ -198,13 +199,15 @@ case "${OS}" in
esac

for target in $targets; do
if echo "$target" | grep -q "$FILTER"; then
if echo "$target" | grep -q "$filter"; then
if [ "${OS}" = "windows" ]; then
TARGET="$target" sh ./ci/install-rust.sh
test_target build "$target"
else
test_target build "$target"
fi

test_run=1
fi
done

Expand Down Expand Up @@ -279,8 +282,10 @@ x86_64-wrs-vxworks \
if [ "${rust}" = "nightly" ] && [ "${OS}" = "linux" ]; then
for target in $rust_linux_no_core_targets; do
if echo "$target" | grep -q "$FILTER"; then
test_target build "$target" 1
test_target "$target" 1
fi

test_run=1
done
fi

Expand All @@ -293,7 +298,15 @@ i386-apple-ios \
if [ "${rust}" = "nightly" ] && [ "${OS}" = "macos" ]; then
for target in $rust_apple_no_core_targets; do
if echo "$target" | grep -q "$FILTER"; then
test_target build "$target" 1
test_target "$target" 1
fi

test_run=1
done
fi

# Make sure we didn't accidentally filter everything
if [ "${test_run:-}" != 1 ]; then
echo "No tests were run"
exit 1
fi

0 comments on commit bcb4107

Please sign in to comment.