diff mbox

[i-g-t,08/12] tests/igt_command_line.sh: Allow testing individual tests

Message ID 20170902170406.8271-8-daniel.vetter@ffwll.ch (mailing list archive)
State New, archived
Headers show

Commit Message

Daniel Vetter Sept. 2, 2017, 5:04 p.m. UTC
meso will use this to run the tests for all testcases in parallel, for
great speedup!

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
---
 tests/igt_command_line.sh | 39 ++++++++++++++++++++++++++-------------
 1 file changed, 26 insertions(+), 13 deletions(-)
diff mbox

Patch

diff --git a/tests/igt_command_line.sh b/tests/igt_command_line.sh
index 7f80fc805d37..f98a584a8ea3 100755
--- a/tests/igt_command_line.sh
+++ b/tests/igt_command_line.sh
@@ -37,24 +37,16 @@  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
+function check_test () {
+	local test
+
+	test=$1
+
 	if [ "$test" = "TESTLIST" -o "$test" = "END" ]; then
 		continue
 	fi
@@ -105,4 +97,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