All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH i-g-t 1/3] igt_command_line.sh: Handle the special cases of drv_selftest and drm_mm
@ 2017-03-21 12:50 Petri Latvala
  2017-03-21 12:50 ` [PATCH i-g-t 2/3] igt_command_line.sh: Actually check things during distcheck Petri Latvala
  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
  0 siblings, 2 replies; 3+ messages in thread
From: Petri Latvala @ 2017-03-21 12:50 UTC (permalink / raw)
  To: intel-gfx

Kernel selftest launchers use dynamic subtest enumeration. When
running on a kernel without selftests, they output nothing from
--list-subtests and exit with 0. Handle this specialty in the checker.

Signed-off-by: Petri Latvala <petri.latvala@intel.com>
---
 tests/igt_command_line.sh | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/tests/igt_command_line.sh b/tests/igt_command_line.sh
index a20e44c..69fa843 100755
--- a/tests/igt_command_line.sh
+++ b/tests/igt_command_line.sh
@@ -81,7 +81,12 @@ for test in $TESTLIST; do
 	fi
 
 	if [ $RET -eq 0 -a -z "$LIST" ]; then
-		fail $test
+		# Subtest enumeration of kernel selftest launchers depends
+		# on the running kernel. If selftests are not enabled,
+		# they will output nothing and exit with 0.
+		if [ "$testname" != "drv_selftest" -a "$testname" != "drm_mm" ]; then
+			fail $test
+		fi
 	fi
 
 	# check invalid subtest handling
-- 
2.9.3

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

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [PATCH i-g-t 2/3] igt_command_line.sh: Actually check things during distcheck
  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
  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
  1 sibling, 0 replies; 3+ messages in thread
From: Petri Latvala @ 2017-03-21 12:50 UTC (permalink / raw)
  To: intel-gfx

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

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [PATCH i-g-t 3/3] lib/igt_kmod: Don't call igt_assert or igt_require without a fixture
  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 ` [PATCH i-g-t 2/3] igt_command_line.sh: Actually check things during distcheck Petri Latvala
@ 2017-03-21 12:50 ` Petri Latvala
  1 sibling, 0 replies; 3+ messages in thread
From: Petri Latvala @ 2017-03-21 12:50 UTC (permalink / raw)
  To: intel-gfx

If kmod_module_new_from_name fails, igt_kselftest ends up calling
igt_skip (through igt_require) when not in a fixture. Instead return
normally from igt_kselftest, matching behaviour when the module
loading is successful but it doesn't contain selftests.

Also change one igt_assert to a return for the same reason.

Signed-off-by: Petri Latvala <petri.latvala@intel.com>
CC: Chris Wilson <chris@chris-wilson.co.uk>
---
 lib/igt_kmod.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/lib/igt_kmod.c b/lib/igt_kmod.c
index 4b8ea81..b366ade 100644
--- a/lib/igt_kmod.c
+++ b/lib/igt_kmod.c
@@ -419,7 +419,8 @@ int igt_kselftest_init(struct igt_kselftest *tst,
 	memset(tst, 0, sizeof(*tst));
 
 	tst->module_name = strdup(module_name);
-	igt_assert(tst->module_name);
+	if (!tst->module_name)
+		return 1;
 
 	tst->kmsg = -1;
 
@@ -502,7 +503,9 @@ void igt_kselftests(const char *module_name,
 	IGT_LIST(tests);
 	struct igt_kselftest_list *tl, *tn;
 
-	igt_require(igt_kselftest_init(&tst, module_name) == 0);
+	if (igt_kselftest_init(&tst, module_name) != 0)
+		return;
+
 	igt_fixture
 		igt_require(igt_kselftest_begin(&tst) == 0);
 
-- 
2.9.3

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

^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2017-03-21 12:50 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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 ` [PATCH i-g-t 2/3] igt_command_line.sh: Actually check things during distcheck Petri Latvala
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

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.