1 2function for_each_unittest() 3{ 4 local unittests="$1" 5 local cmd="$2" 6 local testname 7 local smp 8 local kernel 9 local opts 10 local groups 11 local arch 12 local check 13 local accel 14 local timeout 15 16 exec {fd}<"$unittests" 17 18 while read -r -u $fd line; do 19 if [[ "$line" =~ ^\[(.*)\]$ ]]; then 20 if [ -n "${testname}" ]; then 21 "$cmd" "$testname" "$groups" "$smp" "$kernel" "$opts" "$arch" "$check" "$accel" "$timeout" 22 fi 23 testname=${BASH_REMATCH[1]} 24 smp=1 25 kernel="" 26 opts="" 27 groups="" 28 arch="" 29 check="" 30 accel="" 31 timeout="" 32 elif [[ $line =~ ^file\ *=\ *(.*)$ ]]; then 33 kernel=$TEST_DIR/${BASH_REMATCH[1]} 34 elif [[ $line =~ ^smp\ *=\ *(.*)$ ]]; then 35 smp=${BASH_REMATCH[1]} 36 elif [[ $line =~ ^extra_params\ *=\ *(.*)$ ]]; then 37 opts=${BASH_REMATCH[1]} 38 elif [[ $line =~ ^groups\ *=\ *(.*)$ ]]; then 39 groups=${BASH_REMATCH[1]} 40 elif [[ $line =~ ^arch\ *=\ *(.*)$ ]]; then 41 arch=${BASH_REMATCH[1]} 42 elif [[ $line =~ ^check\ *=\ *(.*)$ ]]; then 43 check=${BASH_REMATCH[1]} 44 elif [[ $line =~ ^accel\ *=\ *(.*)$ ]]; then 45 accel=${BASH_REMATCH[1]} 46 elif [[ $line =~ ^timeout\ *=\ *(.*)$ ]]; then 47 timeout=${BASH_REMATCH[1]} 48 fi 49 done 50 if [ -n "${testname}" ]; then 51 "$cmd" "$testname" "$groups" "$smp" "$kernel" "$opts" "$arch" "$check" "$accel" "$timeout" 52 fi 53 exec {fd}<&- 54} 55