summaryrefslogtreecommitdiff
path: root/lib/tests
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2016-08-24 09:24:33 +0100
committerMarius Vlad <marius.c.vlad@intel.com>2016-09-01 09:59:49 +0300
commit7213c3e09621d9708a87d26cda4b1b71fe73d206 (patch)
tree2c9c41bc8e40ea908bd67ad1e2597ac0fd14284f /lib/tests
parentdb97b69c5c134be35177c8d1fd502ca90d5f304a (diff)
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 <chris@chris-wilson.co.uk>
Diffstat (limited to 'lib/tests')
-rwxr-xr-xlib/tests/igt_command_line.sh22
1 files changed, 15 insertions, 7 deletions
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