File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 3030
3131# Run the tests for a specific target
3232test_target () {
33- target=" ${1} "
34- no_dist=" ${2 :- 0} "
33+ target=" $1 "
34+ no_dist=" $2 "
3535
3636 RUSTFLAGS=" ${RUSTFLAGS:- } "
3737
@@ -265,7 +265,13 @@ case "$rust" in
265265 * ) supports_wasi_pn=0 ;;
266266esac
267267
268- for target in $targets ; do
268+ some_tests_run=0
269+
270+ # Apply the `FILTER` variable, do OS-specific tasks, and run a target
271+ filter_and_run () {
272+ target=" $1 "
273+ no_dist=" ${2:- 0} "
274+
269275 if echo " $target " | grep -q " $filter " ; then
270276 if [ " $os " = " windows" ]; then
271277 TARGET=" $target " ./ci/install-rust.sh
@@ -278,27 +284,24 @@ for target in $targets; do
278284
279285 # `wasm32-wasip2` only exists in recent versions of Rust
280286 if [ " $target " = " wasm32-wasip2" ] && [ " $supports_wasi_pn " = " 0" ]; then
281- continue
287+ return
282288 fi
283289
284- test_target " $target "
285- test_run =1
290+ test_target " $target " " $no_dist "
291+ some_tests_run =1
286292 fi
293+ }
294+
295+ for target in $targets ; do
296+ filter_and_run " $target "
287297done
288298
289299for target in ${no_dist_targets:- } ; do
290- if echo " $target " | grep -q " $filter " ; then
291- if [ " $os " = " windows" ]; then
292- TARGET=" $target " ./ci/install-rust.sh
293- fi
294-
295- test_target " $target " 1
296- test_run=1
297- fi
300+ filter_and_run " $target " 1
298301done
299302
300303# Make sure we didn't accidentally filter everything
301- if [ " ${test_run :- } " != 1 ]; then
304+ if [ " $some_tests_run " != 1 ]; then
302305 echo " No tests were run"
303306 exit 1
304307fi
You can’t perform that action at this time.
0 commit comments