diff mbox

[i-g-t,1/2] autotools: Check target requires to a have the list of tests built.

Message ID 1461935480-31688-1-git-send-email-marius.c.vlad@intel.com (mailing list archive)
State New, archived
Headers show

Commit Message

Marius Vlad April 29, 2016, 1:11 p.m. UTC
We need to have the test list generated before running the check target.
Migrated igt_command_line.sh to tests/ from lib/tests/, which allows to
building the tests and execute the script.

This would allow cleaning followed by a make check.

Signed-off-by: Marius Vlad <marius.c.vlad@intel.com>
---
 lib/tests/Makefile.am         |  1 -
 lib/tests/Makefile.sources    |  3 --
 lib/tests/igt_command_line.sh | 76 -------------------------------------------
 tests/Makefile.am             |  2 +-
 tests/Makefile.sources        |  8 +++++
 tests/igt_command_line.sh     | 74 +++++++++++++++++++++++++++++++++++++++++
 6 files changed, 83 insertions(+), 81 deletions(-)
 delete mode 100755 lib/tests/igt_command_line.sh
 create mode 100755 tests/igt_command_line.sh

Comments

Chris Wilson Aug. 24, 2016, 8:43 a.m. UTC | #1
On Fri, Apr 29, 2016 at 04:11:19PM +0300, Marius Vlad wrote:
> We need to have the test list generated before running the check target.
> Migrated igt_command_line.sh to tests/ from lib/tests/, which allows to
> building the tests and execute the script.
> 
> This would allow cleaning followed by a make check.
> 
> Signed-off-by: Marius Vlad <marius.c.vlad@intel.com>

I stumbled across this make check failure, and this looks like the fix.
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
-Chris
diff mbox

Patch

diff --git a/lib/tests/Makefile.am b/lib/tests/Makefile.am
index 582cc3e..99ab724 100644
--- a/lib/tests/Makefile.am
+++ b/lib/tests/Makefile.am
@@ -4,7 +4,6 @@  AM_TESTS_ENVIRONMENT = \
 	top_builddir=$(top_builddir) \
 	top_srcdir=$(top_srcdir)
 
-EXTRA_DIST = $(check_SCRIPTS)
 
 AM_CFLAGS = $(DRM_CFLAGS) $(CWARNFLAGS) $(DEBUG_CFLAGS) \
 	-I$(srcdir)/../.. \
diff --git a/lib/tests/Makefile.sources b/lib/tests/Makefile.sources
index 707c445..37126f1 100644
--- a/lib/tests/Makefile.sources
+++ b/lib/tests/Makefile.sources
@@ -15,9 +15,6 @@  check_PROGRAMS = \
 	igt_exit_handler \
 	$(NULL)
 
-check_SCRIPTS = \
-	igt_command_line.sh \
-	$(NULL)
 
 TESTS = \
 	$(check_PROGRAMS) \
diff --git a/lib/tests/igt_command_line.sh b/lib/tests/igt_command_line.sh
deleted file mode 100755
index e83a548..0000000
--- a/lib/tests/igt_command_line.sh
+++ /dev/null
@@ -1,76 +0,0 @@ 
-#!/bin/sh
-#
-# Copyright © 2014 Intel Corporation
-#
-# Permission is hereby granted, free of charge, to any person obtaining a
-# copy of this software and associated documentation files (the "Software"),
-# to deal in the Software without restriction, including without limitation
-# the rights to use, copy, modify, merge, publish, distribute, sublicense,
-# and/or sell copies of the Software, and to permit persons to whom the
-# Software is furnished to do so, subject to the following conditions:
-#
-# The above copyright notice and this permission notice (including the next
-# paragraph) shall be included in all copies or substantial portions of the
-# Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
-# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
-# IN THE SOFTWARE.
-
-#
-# Check that command line handling works consistently across all tests
-#
-
-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
-
-	if [ "$test" = "TESTLIST" -o "$test" = "END" ]; then
-		continue
-	fi
-
-	if [ -x $top_builddir/tests/$test ]; then
-		test=$top_builddir/tests/$test
-	else
-		# if the test is a script, it will be in $srcdir
-		test=$top_srcdir/tests/$test
-	fi
-
-	echo "$test:"
-
-	# check invalid option handling
-	echo "  Checking invalid option handling..."
-	./$test --invalid-option 2> /dev/null && exit 1
-
-	# check valid options succeed
-	echo "  Checking valid option handling..."
-	./$test --help > /dev/null || exit 1
-
-	# 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
-	fi
-
-	if [ $RET -eq 79 -a -n "$LIST" ]; then
-		exit 1
-	fi
-
-	if [ $RET -eq 0 -a -z "$LIST" ]; then
-		exit 1
-	fi
-
-	# check invalid subtest handling
-	echo "  Checking invalid subtest handling..."
-	./$test --run-subtest invalid-subtest > /dev/null 2>&1 && exit 1
-done
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 45e3359..79a7324 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -49,7 +49,7 @@  all-local: .gitignore
 pkgdata_DATA = test-list.txt test-list-full.txt
 
 EXTRA_PROGRAMS = $(HANG)
-EXTRA_DIST = $(common_files)
+EXTRA_DIST = $(common_files) $(check_SCRIPTS)
 
 CLEANFILES = $(EXTRA_PROGRAMS) test-list.txt test-list-full.txt .gitignore
 
diff --git a/tests/Makefile.sources b/tests/Makefile.sources
index b73f48d..28e8695 100644
--- a/tests/Makefile.sources
+++ b/tests/Makefile.sources
@@ -287,6 +287,14 @@  testdisplay_SOURCES = \
 
 TESTS_progs += testdisplay
 
+check_SCRIPTS = \
+		igt_command_line.sh \
+		$(NULL)
+
+TESTS = \
+	$(check_SCRIPTS) \
+	$(NULL)
+
 common_files = \
 	       eviction_common.c \
 	       $(NULL)
diff --git a/tests/igt_command_line.sh b/tests/igt_command_line.sh
new file mode 100755
index 0000000..fd09981
--- /dev/null
+++ b/tests/igt_command_line.sh
@@ -0,0 +1,74 @@ 
+#!/bin/sh
+#
+# Copyright © 2014 Intel Corporation
+#
+# Permission is hereby granted, free of charge, to any person obtaining a
+# copy of this software and associated documentation files (the "Software"),
+# to deal in the Software without restriction, including without limitation
+# the rights to use, copy, modify, merge, publish, distribute, sublicense,
+# and/or sell copies of the Software, and to permit persons to whom the
+# Software is furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice (including the next
+# paragraph) shall be included in all copies or substantial portions of the
+# Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+# IN THE SOFTWARE.
+
+#
+# Check that command line handling works consistently across all tests
+#
+
+TESTLIST=`cat test-list.txt`
+if [ $? -ne 0 ]; then
+	echo "Error: Could not read test lists"
+	exit 99
+fi
+
+for test in $TESTLIST; do
+
+	if [ "$test" = "TESTLIST" -o "$test" = "END" ]; then
+		continue
+	fi
+
+	# make distcheck happy
+	if [ ! -x "$test" ]; then
+		continue
+	fi
+
+	echo "$test:"
+
+	# check invalid option handling
+	echo "  Checking invalid option handling..."
+	./$test --invalid-option 2> /dev/null && exit 1
+
+	# check valid options succeed
+	echo "  Checking valid option handling..."
+	./$test --help > /dev/null || exit 1
+
+	# 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
+	fi
+
+	if [ $RET -eq 79 -a -n "$LIST" ]; then
+		exit 1
+	fi
+
+	if [ $RET -eq 0 -a -z "$LIST" ]; then
+		exit 1
+	fi
+
+	# check invalid subtest handling
+	echo "  Checking invalid subtest handling..."
+	./$test --run-subtest invalid-subtest > /dev/null 2>&1 && exit 1
+done