1source config.mak 2 3function for_each_unittest() 4{ 5 local unittests="$1" 6 local cmd="$2" 7 local testname 8 local smp 9 local kernel 10 local opts 11 local groups 12 local arch 13 local machine 14 local check 15 local accel 16 local timeout 17 local rematch 18 19 exec {fd}<"$unittests" 20 21 while read -r -u $fd line; do 22 if [[ "$line" =~ ^\[(.*)\]$ ]]; then 23 rematch=${BASH_REMATCH[1]} 24 if [ -n "${testname}" ]; then 25 $(arch_cmd) "$cmd" "$testname" "$groups" "$smp" "$kernel" "$opts" "$arch" "$machine" "$check" "$accel" "$timeout" 26 fi 27 testname=$rematch 28 smp=1 29 kernel="" 30 opts="" 31 groups="" 32 arch="" 33 machine="" 34 check="" 35 accel="" 36 timeout="" 37 elif [[ $line =~ ^file\ *=\ *(.*)$ ]]; then 38 kernel=$TEST_DIR/${BASH_REMATCH[1]} 39 elif [[ $line =~ ^smp\ *=\ *(.*)$ ]]; then 40 smp=${BASH_REMATCH[1]} 41 elif [[ $line =~ ^extra_params\ *=\ *'"""'(.*)$ ]]; then 42 opts=${BASH_REMATCH[1]}$'\n' 43 while read -r -u $fd; do 44 #escape backslash newline, but not double backslash 45 if [[ $opts =~ [^\\]*(\\*)$'\n'$ ]]; then 46 if (( ${#BASH_REMATCH[1]} % 2 == 1 )); then 47 opts=${opts%\\$'\n'} 48 fi 49 fi 50 if [[ "$REPLY" =~ ^(.*)'"""'[:blank:]*$ ]]; then 51 opts+=${BASH_REMATCH[1]} 52 break 53 else 54 opts+=$REPLY$'\n' 55 fi 56 done 57 elif [[ $line =~ ^extra_params\ *=\ *(.*)$ ]]; then 58 opts=${BASH_REMATCH[1]} 59 elif [[ $line =~ ^groups\ *=\ *(.*)$ ]]; then 60 groups=${BASH_REMATCH[1]} 61 elif [[ $line =~ ^arch\ *=\ *(.*)$ ]]; then 62 arch=${BASH_REMATCH[1]} 63 elif [[ $line =~ ^machine\ *=\ *(.*)$ ]]; then 64 machine=${BASH_REMATCH[1]} 65 elif [[ $line =~ ^check\ *=\ *(.*)$ ]]; then 66 check=${BASH_REMATCH[1]} 67 elif [[ $line =~ ^accel\ *=\ *(.*)$ ]]; then 68 accel=${BASH_REMATCH[1]} 69 elif [[ $line =~ ^timeout\ *=\ *(.*)$ ]]; then 70 timeout=${BASH_REMATCH[1]} 71 fi 72 done 73 if [ -n "${testname}" ]; then 74 $(arch_cmd) "$cmd" "$testname" "$groups" "$smp" "$kernel" "$opts" "$arch" "$machine" "$check" "$accel" "$timeout" 75 fi 76 exec {fd}<&- 77} 78 79function arch_cmd() 80{ 81 [ "${ARCH_CMD}" ] && echo "${ARCH_CMD}" 82} 83 84# The current file has to be the only file sourcing the arch helper 85# file. Shellcheck can't follow this so help it out. There doesn't appear to be a 86# way to specify multiple alternatives, so we will have to rethink this if things 87# get more complicated. 88ARCH_FUNC=scripts/${ARCH}/func.bash 89if [ -f "${ARCH_FUNC}" ]; then 90# shellcheck source=scripts/s390x/func.bash 91 source "${ARCH_FUNC}" 92fi 93