@@ -16,6 +16,7 @@ cat <<EOF
Usage: $0 [-h] [-v] [-a] [-g group] [-j NUM-TASKS]
+ -t: Only execute this test
-h: Output this help text
-v: Enables verbose mode
-a: Run all tests, including those flagged as 'nodefault'
@@ -31,10 +32,13 @@ EOF
RUNTIME_arch_run="./$TEST_DIR/run"
source scripts/runtime.bash
-while getopts "ag:hj:v" opt; do
+while getopts "t:ag:hj:v" opt; do
case $opt in
a)
run_all_tests="yes"
+ ;;
+ t)
+ only_test=$OPTARG
;;
g)
only_group=$OPTARG
@@ -12,12 +12,16 @@ function for_each_unittest()
local check
local accel
local timeout
+ local found=0
exec {fd}<"$unittests"
while read -u $fd line; do
if [[ "$line" =~ ^\[(.*)\]$ ]]; then
- "$cmd" "$testname" "$groups" "$smp" "$kernel" "$opts" "$arch" "$check" "$accel" "$timeout"
+ if [[ -z "$only_test" || "$testname" == "$only_test" ]]; then
+ "$cmd" "$testname" "$groups" "$smp" "$kernel" "$opts" "$arch" "$check" "$accel" "$timeout"
+ found=$((found + 1))
+ fi
testname=${BASH_REMATCH[1]}
smp=1
kernel=""
@@ -45,6 +49,17 @@ function for_each_unittest()
timeout=${BASH_REMATCH[1]}
fi
done
- "$cmd" "$testname" "$groups" "$smp" "$kernel" "$opts" "$arch" "$check" "$accel" "$timeout"
+ if [[ -z "$only_test" || "$testname" == "$only_test" ]]; then
+ "$cmd" "$testname" "$groups" "$smp" "$kernel" "$opts" "$arch" "$check" "$accel" "$timeout"
+ found=$((found + 1))
+ fi
+
exec {fd}<&-
+
+ if [[ $found -eq 0 ]]; then
+ echo "Didn't run any tests."
+ return 1
+ fi
+
+ echo "Ran $found test(s)."
}