Skip to content

Commit bcb4107

Browse files
committed
ci: Ensure build channels get run even if FILTER is unset
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 <#4125>) (cherry picked from commit 084f370)
1 parent 46ebe26 commit bcb4107

File tree

1 file changed

+16
-3
lines changed

1 file changed

+16
-3
lines changed

ci/build.sh

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ set -eux
1111
: "${OS?The OS environment variable must be set.}"
1212

1313
rust="$TOOLCHAIN"
14+
filter="${FILTER:-}"
1415

1516
echo "Testing Rust $rust on $OS"
1617

@@ -198,13 +199,15 @@ case "${OS}" in
198199
esac
199200

200201
for target in $targets; do
201-
if echo "$target" | grep -q "$FILTER"; then
202+
if echo "$target" | grep -q "$filter"; then
202203
if [ "${OS}" = "windows" ]; then
203204
TARGET="$target" sh ./ci/install-rust.sh
204205
test_target build "$target"
205206
else
206207
test_target build "$target"
207208
fi
209+
210+
test_run=1
208211
fi
209212
done
210213

@@ -279,8 +282,10 @@ x86_64-wrs-vxworks \
279282
if [ "${rust}" = "nightly" ] && [ "${OS}" = "linux" ]; then
280283
for target in $rust_linux_no_core_targets; do
281284
if echo "$target" | grep -q "$FILTER"; then
282-
test_target build "$target" 1
285+
test_target "$target" 1
283286
fi
287+
288+
test_run=1
284289
done
285290
fi
286291

@@ -293,7 +298,15 @@ i386-apple-ios \
293298
if [ "${rust}" = "nightly" ] && [ "${OS}" = "macos" ]; then
294299
for target in $rust_apple_no_core_targets; do
295300
if echo "$target" | grep -q "$FILTER"; then
296-
test_target build "$target" 1
301+
test_target "$target" 1
297302
fi
303+
304+
test_run=1
298305
done
299306
fi
307+
308+
# Make sure we didn't accidentally filter everything
309+
if [ "${test_run:-}" != 1 ]; then
310+
echo "No tests were run"
311+
exit 1
312+
fi

0 commit comments

Comments
 (0)