]>
Commit | Line | Data |
---|---|---|
b8c6f29e KW |
1 | #!/bin/sh |
2 | ||
18c1cdd2 PB |
3 | if [ "$#" -eq 0 ]; then |
4 | echo "Usage: $0 fmt..." >&2 | |
5 | exit 99 | |
6 | fi | |
7 | ||
98487b90 | 8 | # Honor the SPEED environment variable, just like we do it for "meson test" |
18c1cdd2 PB |
9 | format_list="$@" |
10 | if [ "$SPEED" = "slow" ] || [ "$SPEED" = "thorough" ]; then | |
bdd95e47 TH |
11 | group= |
12 | else | |
bdd95e47 TH |
13 | group="-g auto" |
14 | fi | |
15 | ||
98487b90 | 16 | skip() { |
d316859f PB |
17 | echo "1..0 #SKIP $*" |
18 | exit 0 | |
98487b90 PB |
19 | } |
20 | ||
24496fe8 DB |
21 | # Disable tests with any sanitizer except for specific ones |
22 | SANITIZE_FLAGS=$( grep "CFLAGS.*-fsanitize" config-host.mak 2>/dev/null ) | |
23 | ALLOWED_SANITIZE_FLAGS="safe-stack cfi-icall" | |
24 | #Remove all occurrencies of allowed Sanitize flags | |
25 | for j in ${ALLOWED_SANITIZE_FLAGS}; do | |
26 | TMP_FLAGS=${SANITIZE_FLAGS} | |
27 | SANITIZE_FLAGS="" | |
28 | for i in ${TMP_FLAGS}; do | |
29 | if ! echo ${i} | grep -q "${j}" 2>/dev/null; then | |
30 | SANITIZE_FLAGS="${SANITIZE_FLAGS} ${i}" | |
d6d1a65c | 31 | fi |
24496fe8 | 32 | done |
d6d1a65c DB |
33 | done |
34 | if echo ${SANITIZE_FLAGS} | grep -q "\-fsanitize" 2>/dev/null; then | |
35 | # Have a sanitize flag that is not allowed, stop | |
98487b90 | 36 | skip "Sanitizers are enabled ==> Not running the qemu-iotests." |
2cc4d1c5 TH |
37 | fi |
38 | ||
bdd95e47 | 39 | if [ -z "$(find . -name 'qemu-system-*' -print)" ]; then |
98487b90 | 40 | skip "No qemu-system binary available ==> Not running the qemu-iotests." |
bdd95e47 TH |
41 | fi |
42 | ||
43 | if ! command -v bash >/dev/null 2>&1 ; then | |
98487b90 | 44 | skip "bash not available ==> Not running the qemu-iotests." |
bdd95e47 | 45 | fi |
b8c6f29e | 46 | |
0f3231bf | 47 | if LANG=C bash --version | grep -q 'GNU bash, version [123]' ; then |
98487b90 | 48 | skip "bash version too old ==> Not running the qemu-iotests." |
0f3231bf TH |
49 | fi |
50 | ||
7467d94c | 51 | cd tests/qemu-iotests |
b8c6f29e | 52 | |
33fe08fc TH |
53 | # QEMU_CHECK_BLOCK_AUTO is used to disable some unstable sub-tests |
54 | export QEMU_CHECK_BLOCK_AUTO=1 | |
f203080b | 55 | export PYTHONUTF8=1 |
bcda7b17 VSO |
56 | # If make was called with -jN we want to call ./check with -j N. Extract the |
57 | # flag from MAKEFLAGS, so that if it absent (or MAKEFLAGS is not defined), JOBS | |
58 | # would be an empty line otherwise JOBS is prepared string of flag with value: | |
59 | # "-j N" | |
60 | # Note, that the following works even if make was called with "-j N" or even | |
61 | # "--jobs N", as all these variants becomes simply "-jN" in MAKEFLAGS variable. | |
62 | JOBS=$(echo "$MAKEFLAGS" | sed -n 's/\(^\|.* \)-j\([0-9]\+\)\( .*\|$\)/-j \2/p') | |
33fe08fc | 63 | |
b8c6f29e | 64 | ret=0 |
bdd95e47 | 65 | for fmt in $format_list ; do |
d316859f | 66 | ${PYTHON} ./check $JOBS -tap -$fmt $group || ret=1 |
c2519009 | 67 | done |
b8c6f29e KW |
68 | |
69 | exit $ret |