From 7213c3e09621d9708a87d26cda4b1b71fe73d206 Mon Sep 17 00:00:00 2001 From: Chris Wilson Date: Wed, 24 Aug 2016 09:24:33 +0100 Subject: lib: Make igt_command_line.sh selftest standalone Allow the casual user to run igt_command_line.sh to discover what make check is complaining about. Signed-off-by: Chris Wilson --- lib/tests/igt_command_line.sh | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) (limited to 'lib/tests') diff --git a/lib/tests/igt_command_line.sh b/lib/tests/igt_command_line.sh index e83a548b..35f580f0 100755 --- a/lib/tests/igt_command_line.sh +++ b/lib/tests/igt_command_line.sh @@ -25,14 +25,22 @@ # Check that command line handling works consistently across all tests # +if [ -z "$top_builddir" ]; then + top_builddir="$(dirname $0)/../.." +fi + TESTLIST=`cat $top_builddir/tests/test-list.txt` if [ $? -ne 0 ]; then echo "Error: Could not read test lists" exit 99 fi -for test in $TESTLIST; do +fail () { + echo "FAIL: $1" + exit 1 +} +for test in $TESTLIST; do if [ "$test" = "TESTLIST" -o "$test" = "END" ]; then continue fi @@ -48,29 +56,29 @@ for test in $TESTLIST; do # check invalid option handling echo " Checking invalid option handling..." - ./$test --invalid-option 2> /dev/null && exit 1 + ./$test --invalid-option 2> /dev/null && fail $test # check valid options succeed echo " Checking valid option handling..." - ./$test --help > /dev/null || exit 1 + ./$test --help > /dev/null || fail $test # check --list-subtests works correctly echo " Checking subtest enumeration..." LIST=`./$test --list-subtests` RET=$? if [ $RET -ne 0 -a $RET -ne 79 ]; then - exit 1 + fail $test fi if [ $RET -eq 79 -a -n "$LIST" ]; then - exit 1 + fail $test fi if [ $RET -eq 0 -a -z "$LIST" ]; then - exit 1 + fail $test fi # check invalid subtest handling echo " Checking invalid subtest handling..." - ./$test --run-subtest invalid-subtest > /dev/null 2>&1 && exit 1 + ./$test --run-subtest invalid-subtest > /dev/null 2>&1 && fail $test done -- cgit v1.2.3