core/ptimers: Remove unnecessary 'sysemu/cpus.h' include
[qemu/rayw.git] / tests / check-block.sh
blob720a46bc3627b7c5e5617182c1508aaa0f26bc4e
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 grep -q "CONFIG_GPROF=y" config-host.mak 2>/dev/null ; then
22 skip "GPROF is enabled ==> Not running the qemu-iotests."
25 # Disable tests with any sanitizer except for specific ones
26 SANITIZE_FLAGS=$( grep "CFLAGS.*-fsanitize" config-host.mak 2>/dev/null )
27 ALLOWED_SANITIZE_FLAGS="safe-stack cfi-icall"
28 #Remove all occurrencies of allowed Sanitize flags
29 for j in ${ALLOWED_SANITIZE_FLAGS}; do
30 TMP_FLAGS=${SANITIZE_FLAGS}
31 SANITIZE_FLAGS=""
32 for i in ${TMP_FLAGS}; do
33 if ! echo ${i} | grep -q "${j}" 2>/dev/null; then
34 SANITIZE_FLAGS="${SANITIZE_FLAGS} ${i}"
36 done
37 done
38 if echo ${SANITIZE_FLAGS} | grep -q "\-fsanitize" 2>/dev/null; then
39 # Have a sanitize flag that is not allowed, stop
40 skip "Sanitizers are enabled ==> Not running the qemu-iotests."
43 if [ -z "$(find . -name 'qemu-system-*' -print)" ]; then
44 skip "No qemu-system binary available ==> Not running the qemu-iotests."
47 if ! command -v bash >/dev/null 2>&1 ; then
48 skip "bash not available ==> Not running the qemu-iotests."
51 if LANG=C bash --version | grep -q 'GNU bash, version [123]' ; then
52 skip "bash version too old ==> Not running the qemu-iotests."
55 if ! (sed --version | grep 'GNU sed') > /dev/null 2>&1 ; then
56 if ! command -v gsed >/dev/null 2>&1; then
57 skip "GNU sed not available ==> Not running the qemu-iotests."
59 else
60 # Double-check that we're not using BusyBox' sed which says
61 # that "This is not GNU sed version 4.0" ...
62 if sed --version | grep -q 'not GNU sed' ; then
63 skip "BusyBox sed not supported ==> Not running the qemu-iotests."
67 cd tests/qemu-iotests
69 # QEMU_CHECK_BLOCK_AUTO is used to disable some unstable sub-tests
70 export QEMU_CHECK_BLOCK_AUTO=1
71 export PYTHONUTF8=1
72 # If make was called with -jN we want to call ./check with -j N. Extract the
73 # flag from MAKEFLAGS, so that if it absent (or MAKEFLAGS is not defined), JOBS
74 # would be an empty line otherwise JOBS is prepared string of flag with value:
75 # "-j N"
76 # Note, that the following works even if make was called with "-j N" or even
77 # "--jobs N", as all these variants becomes simply "-jN" in MAKEFLAGS variable.
78 JOBS=$(echo "$MAKEFLAGS" | sed -n 's/\(^\|.* \)-j\([0-9]\+\)\( .*\|$\)/-j \2/p')
80 ret=0
81 for fmt in $format_list ; do
82 ${PYTHON} ./check $JOBS -tap -$fmt $group || ret=1
83 done
85 exit $ret