[igt-dev] [PATCH i-g-t 3/3] tests/igt_command_line.sh: Check for duplicate subtest names

Kamil Konieczny kamil.konieczny at linux.intel.com
Thu Oct 28 10:18:19 UTC 2021


From: Petri Latvala <petri.latvala at intel.com>

A test having multiple subtests with the same name is always an error
and a couple of such cases had already crept in. Keep them out.

Signed-off-by: Petri Latvala <petri.latvala at intel.com>
---
 tests/igt_command_line.sh | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/tests/igt_command_line.sh b/tests/igt_command_line.sh
index 5356877c..fb8f2e2a 100755
--- a/tests/igt_command_line.sh
+++ b/tests/igt_command_line.sh
@@ -92,6 +92,17 @@ check_test ()
 		echo "    test does seem to be using igt_main() (should have subtests) and yet --list-subtests is empty!"
 		fail $test
 	fi
+
+	# check for duplicate subtests
+	echo "  Checking subtest uniqueness..."
+	if [ $RET -eq 0 ]; then
+	    DUPLICATES="`./$test --list-subtests | sort | uniq -d`"
+	    if [ -n "$DUPLICATES" ]; then
+		echo "    test has duplicate subtest names!"
+		echo $DUPLICATES
+		fail $test
+	    fi
+	fi
 }
 
 TESTLISTFILE="$tests_dir/test-list.txt"
-- 
2.30.2



More information about the igt-dev mailing list