1#!/bin/sh 2 3if [ "$#" -eq 0 ]; then 4 echo "Usage: $0 fmt..." >&2 5 exit 99 6fi 7 8# Honor the SPEED environment variable, just like we do it for "meson test" 9format_list="$@" 10if [ "$SPEED" = "slow" ] || [ "$SPEED" = "thorough" ]; then 11 group= 12else 13 group="-g auto" 14fi 15 16skip() { 17 echo "1..0 #SKIP $*" 18 exit 0 19} 20 21# Disable tests with any sanitizer except for specific ones 22SANITIZE_FLAGS=$( grep "CFLAGS.*-fsanitize" config-host.mak 2>/dev/null ) 23ALLOWED_SANITIZE_FLAGS="safe-stack cfi-icall" 24#Remove all occurrencies of allowed Sanitize flags 25for 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}" 31 fi 32 done 33done 34if echo ${SANITIZE_FLAGS} | grep -q "\-fsanitize" 2>/dev/null; then 35 # Have a sanitize flag that is not allowed, stop 36 skip "Sanitizers are enabled ==> Not running the qemu-iotests." 37fi 38 39if [ -z "$(find . -name 'qemu-system-*' -print)" ]; then 40 skip "No qemu-system binary available ==> Not running the qemu-iotests." 41fi 42 43if ! command -v bash >/dev/null 2>&1 ; then 44 skip "bash not available ==> Not running the qemu-iotests." 45fi 46 47if LANG=C bash --version | grep -q 'GNU bash, version [123]' ; then 48 skip "bash version too old ==> Not running the qemu-iotests." 49fi 50 51cd tests/qemu-iotests 52 53# QEMU_CHECK_BLOCK_AUTO is used to disable some unstable sub-tests 54export QEMU_CHECK_BLOCK_AUTO=1 55export PYTHONUTF8=1 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. 62JOBS=$(echo "$MAKEFLAGS" | sed -n 's/\(^\|.* \)-j\([0-9]\+\)\( .*\|$\)/-j \2/p') 63 64ret=0 65for fmt in $format_list ; do 66 ${PYTHON} ./check $JOBS -tap -$fmt $group || ret=1 67done 68 69exit $ret 70