Merge tag 'qemu-macppc-20230206' of https://github.com/mcayland/qemu into staging
[qemu.git] / tests / check-block.sh
blob5de2c1ba0b305b7e25577dc4fce0fdee6804b2f8
1 #!/bin/sh
3 if [ "$#" -eq 0 ]; then
4 echo "Usage: $0 fmt..." >&2
5 exit 99
6 fi
8 # Honor the SPEED environment variable, just like we do it for "meson test"
9 format_list="$@"
10 if [ "$SPEED" = "slow" ] || [ "$SPEED" = "thorough" ]; then
11 group=
12 else
13 group="-g auto"
16 skip() {
17 echo "1..0 #SKIP $*"
18 exit 0
21 if [ -z "$(find . -name 'qemu-system-*' -print)" ]; then
22 skip "No qemu-system binary available ==> Not running the qemu-iotests."
25 cd tests/qemu-iotests
27 # QEMU_CHECK_BLOCK_AUTO is used to disable some unstable sub-tests
28 export QEMU_CHECK_BLOCK_AUTO=1
29 export PYTHONUTF8=1
30 # If make was called with -jN we want to call ./check with -j N. Extract the
31 # flag from MAKEFLAGS, so that if it absent (or MAKEFLAGS is not defined), JOBS
32 # would be an empty line otherwise JOBS is prepared string of flag with value:
33 # "-j N"
34 # Note, that the following works even if make was called with "-j N" or even
35 # "--jobs N", as all these variants becomes simply "-jN" in MAKEFLAGS variable.
36 JOBS=$(echo "$MAKEFLAGS" | sed -n 's/\(^\|.* \)-j\([0-9]\+\)\( .*\|$\)/-j \2/p')
38 ret=0
39 for fmt in $format_list ; do
40 ${PYTHON} ./check $JOBS -tap -$fmt $group || ret=1
41 done
43 exit $ret