summaryrefslogtreecommitdiff
path: root/tests/igt_command_line.sh
diff options
context:
space:
mode:
authorPetri Latvala <petri.latvala@intel.com>2017-03-21 11:47:34 +0200
committerPetri Latvala <petri.latvala@intel.com>2017-03-31 12:34:32 +0300
commit3174974759f5f1d6e2877181c117790ee4dbd68d (patch)
tree7999b302dce13da5418a368af933eb3f9c5b43b5 /tests/igt_command_line.sh
parentfa5dc96ce3f7f7d1f51736aa75bc803a30acc4ca (diff)
igt_command_line.sh: Actually check things during distcheck
This script is invoked in several different ways and the directories to use vary depending on the invocation. The handling of test-list.txt has been working before, but executing the individual command line handling tests have just skipped everything except shell scripts. Now "make distcheck" checks everything "make check" does, as does executing the script by hand. Signed-off-by: Petri Latvala <petri.latvala@intel.com>
Diffstat (limited to 'tests/igt_command_line.sh')
-rwxr-xr-xtests/igt_command_line.sh45
1 files changed, 29 insertions, 16 deletions
diff --git a/tests/igt_command_line.sh b/tests/igt_command_line.sh
index 69fa843d..7f80fc80 100755
--- a/tests/igt_command_line.sh
+++ b/tests/igt_command_line.sh
@@ -25,19 +25,28 @@
# Check that command line handling works consistently across all tests
#
-if [ -z "$top_builddir" ]; then
- top_builddir="$(dirname $0)"
+# top_builddir is not set during distcheck. Distcheck executes this
+# script in the directory where the built binaries are so just use '.'
+# as the directory if top_builddir is not set.
+
+tests_dir="$top_builddir"
+if [ -z "$tests_dir" ]; then
+ tests_dir="."
+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
-# allow to run this script from top directory
-TESTLIST=`cat $top_builddir/test-list.txt`
+TESTLIST=`cat $TESTLISTFILE`
if [ $? -ne 0 ]; then
- # distcheck requires this hack
- TESTLIST=$(cat test-list.txt)
- if [ $? -ne 0 ]; then
- echo "Error: Could not read test lists"
- exit 99
- fi
+ echo "Error: Could not read test lists"
+ exit 99
fi
fail () {
@@ -50,12 +59,16 @@ for test in $TESTLIST; do
continue
fi
- # top_builddir is empty for distcheck
- test=$top_builddir/$test
-
- # distcheck requires this hack
- if [ ! -x "$test" ]; then
- continue
+ testname="$test"
+ if [ -x "$tests_dir/$test" ]; then
+ test="$tests_dir/$test"
+ else
+ # Possibly a script, not found in builddir but in srcdir
+ if [ -x "$srcdir/$test" ]; then
+ test="$srcdir/$test"
+ else
+ fail "Cannot execute $test"
+ fi
fi
echo "$test:"