[Intel-gfx] [PATCH i-g-t] tests/igt_command_line.sh: Allow testing individual tests

Daniel Vetter daniel.vetter at ffwll.ch
Wed Sep 6 08:02:52 UTC 2017


meso will use this to run the tests for all testcases in parallel, for
great speedup!

v2: Fix bugs in the conversion. Oops, I broke the automake build.

v3: Try harder at being posix shell compliant.

Signed-off-by: Daniel Vetter <daniel.vetter at ffwll.ch>
---
 tests/igt_command_line.sh | 42 ++++++++++++++++++++++++++++--------------
 1 file changed, 28 insertions(+), 14 deletions(-)

diff --git a/tests/igt_command_line.sh b/tests/igt_command_line.sh
index 7f80fc805d37..57d105e958ae 100755
--- a/tests/igt_command_line.sh
+++ b/tests/igt_command_line.sh
@@ -37,26 +37,19 @@ fi
 # Manually running this script is possible in the source root or the
 # tests directory.
 
-TESTLISTFILE="$tests_dir/test-list.txt"
-if [ ! -r "$TESTLISTFILE" ]; then
-	tests_dir="tests"
-	TESTLISTFILE="$tests_dir/test-list.txt"
-fi
-
-TESTLIST=`cat $TESTLISTFILE`
-if [ $? -ne 0 ]; then
-	echo "Error: Could not read test lists"
-	exit 99
-fi
-
 fail () {
 	echo "FAIL: $1"
 	exit 1
 }
 
-for test in $TESTLIST; do
+check_test ()
+{
+	local test
+
+	test=$1
+
 	if [ "$test" = "TESTLIST" -o "$test" = "END" ]; then
-		continue
+		return
 	fi
 
 	testname="$test"
@@ -105,4 +98,25 @@ for test in $TESTLIST; do
 	# check invalid subtest handling
 	echo "  Checking invalid subtest handling..."
 	./$test --run-subtest invalid-subtest > /dev/null 2>&1 && fail $test
+}
+
+TESTLISTFILE="$tests_dir/test-list.txt"
+if [ ! -r "$TESTLISTFILE" ]; then
+	tests_dir="tests"
+	TESTLISTFILE="$tests_dir/test-list.txt"
+fi
+
+TESTLIST=`cat $TESTLISTFILE`
+if [ $? -ne 0 ]; then
+	echo "Error: Could not read test lists"
+	exit 99
+fi
+
+if [[ "$1" != "" ]] ; then
+	check_test $1
+	exit 0
+fi
+
+for test in $TESTLIST; do
+	check_test $test
 done
-- 
2.14.1



More information about the Intel-gfx mailing list