[Intel-gfx] [PATCH igt] lib: Make igt_command_line.sh selftest standalone
Chris Wilson
chris at chris-wilson.co.uk
Wed Aug 24 08:24:33 UTC 2016
Allow the casual user to run igt_command_line.sh to discover what make
check is complaining about.
Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
---
lib/tests/igt_command_line.sh | 22 +++++++++++++++-------
1 file changed, 15 insertions(+), 7 deletions(-)
diff --git a/lib/tests/igt_command_line.sh b/lib/tests/igt_command_line.sh
index e83a548..35f580f 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
--
2.9.3
More information about the Intel-gfx
mailing list