All of lore.kernel.org
 help / color / mirror / Atom feed
From: Petri Latvala <petri.latvala@intel.com>
To: intel-gfx@lists.freedesktop.org
Subject: [PATCH i-g-t 2/3] igt_command_line.sh: Actually check things during distcheck
Date: Tue, 21 Mar 2017 14:50:09 +0200	[thread overview]
Message-ID: <1490100610-3069-2-git-send-email-petri.latvala@intel.com> (raw)
In-Reply-To: <1490100610-3069-1-git-send-email-petri.latvala@intel.com>

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>
---
 tests/igt_command_line.sh | 45 +++++++++++++++++++++++++++++----------------
 1 file changed, 29 insertions(+), 16 deletions(-)

diff --git a/tests/igt_command_line.sh b/tests/igt_command_line.sh
index 69fa843..7f80fc8 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:"
-- 
2.9.3

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

  reply	other threads:[~2017-03-21 12:50 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-21 12:50 [PATCH i-g-t 1/3] igt_command_line.sh: Handle the special cases of drv_selftest and drm_mm Petri Latvala
2017-03-21 12:50 ` Petri Latvala [this message]
2017-03-21 12:50 ` [PATCH i-g-t 3/3] lib/igt_kmod: Don't call igt_assert or igt_require without a fixture Petri Latvala

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1490100610-3069-2-git-send-email-petri.latvala@intel.com \
    --to=petri.latvala@intel.com \
    --cc=intel-gfx@lists.freedesktop.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.