public inbox for intel-gfx@lists.freedesktop.org
 help / color / mirror / Atom feed
* [PATCH i-g-t 1/5] lib/tests: fix tests and test list location
@ 2014-11-03 11:31 Thomas Wood
  2014-11-03 11:31 ` [PATCH i-g-t 2/5] lib/tests: don't use hard error status to indicate test failure Thomas Wood
                   ` (3 more replies)
  0 siblings, 4 replies; 8+ messages in thread
From: Thomas Wood @ 2014-11-03 11:31 UTC (permalink / raw)
  To: intel-gfx; +Cc: Daniel Vetter

The igt_command_line.sh script was moved by commit 685e577 (Move library
selftests to lib/tests), but the location of the tests and the test
lists was not updated.

Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Thomas Wood <thomas.wood@intel.com>
---
 lib/tests/Makefile.am         |  4 ++++
 lib/tests/igt_command_line.sh | 18 ++++++++++++------
 2 files changed, 16 insertions(+), 6 deletions(-)

diff --git a/lib/tests/Makefile.am b/lib/tests/Makefile.am
index 78279fb..bab0fcb 100644
--- a/lib/tests/Makefile.am
+++ b/lib/tests/Makefile.am
@@ -1,5 +1,9 @@
 include Makefile.sources
 
+AM_TESTS_ENVIRONMENT = \
+	top_builddir=$(top_builddir) \
+	top_srcdir=$(top_srcdir)
+
 EXTRA_DIST = $(check_SCRIPTS)
 
 AM_CFLAGS = $(DRM_CFLAGS) $(CWARNFLAGS) \
diff --git a/lib/tests/igt_command_line.sh b/lib/tests/igt_command_line.sh
index 075f1d5..7e6ca67 100755
--- a/lib/tests/igt_command_line.sh
+++ b/lib/tests/igt_command_line.sh
@@ -25,17 +25,23 @@
 # Check that command line handling works consistently across all tests
 #
 
-for test in `cat single-tests.txt multi-tests.txt`; do
+TESTLIST=`cat $top_builddir/tests/single-tests.txt $top_builddir/tests/multi-tests.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 the test is a script, it will be in $srcdir
-	if [ ! -x $test ]; then
-		if [ -x $srcdir/$test ]; then
-			test=$srcdir/$test
-		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:"
-- 
2.1.0

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

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

* [PATCH i-g-t 2/5] lib/tests: don't use hard error status to indicate test failure
  2014-11-03 11:31 [PATCH i-g-t 1/5] lib/tests: fix tests and test list location Thomas Wood
@ 2014-11-03 11:31 ` Thomas Wood
  2014-11-03 15:02   ` Daniel Vetter
  2014-11-03 11:31 ` [PATCH i-g-t 3/5] testdisplay: ensure invalid long option exit status is non-zero Thomas Wood
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 8+ messages in thread
From: Thomas Wood @ 2014-11-03 11:31 UTC (permalink / raw)
  To: intel-gfx

Signed-off-by: Thomas Wood <thomas.wood@intel.com>
---
 lib/tests/igt_command_line.sh | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/lib/tests/igt_command_line.sh b/lib/tests/igt_command_line.sh
index 7e6ca67..5cf2584 100755
--- a/lib/tests/igt_command_line.sh
+++ b/lib/tests/igt_command_line.sh
@@ -48,20 +48,20 @@ for test in $TESTLIST; do
 
 	# check invalid option handling
 	echo "  Checking invalid option handling..."
-	./$test --invalid-option 2> /dev/null && exit 99
+	./$test --invalid-option 2> /dev/null && exit 1
 
 	# check valid options succeed
 	echo "  Checking valid option handling..."
-	./$test --help > /dev/null || exit 99
+	./$test --help > /dev/null || exit 1
 
 	# check --list-subtests works correctly
 	echo "  Checking subtest enumeration..."
 	./$test --list-subtests > /dev/null
 	if [ $? -ne 0 -a $? -ne 79 ]; then
-		exit 99
+		exit 1
 	fi
 
 	# check invalid subtest handling
 	echo "  Checking invalid subtest handling..."
-	./$test --run-subtest invalid-subtest > /dev/null 2>&1 && exit 99
+	./$test --run-subtest invalid-subtest > /dev/null 2>&1 && exit 1
 done
-- 
2.1.0

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

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

* [PATCH i-g-t 3/5] testdisplay: ensure invalid long option exit status is non-zero
  2014-11-03 11:31 [PATCH i-g-t 1/5] lib/tests: fix tests and test list location Thomas Wood
  2014-11-03 11:31 ` [PATCH i-g-t 2/5] lib/tests: don't use hard error status to indicate test failure Thomas Wood
@ 2014-11-03 11:31 ` Thomas Wood
  2014-11-03 11:31 ` [PATCH i-g-t 4/5] testdiplay: add a "--help" option Thomas Wood
  2014-11-03 11:31 ` [PATCH i-g-t 5/5] configure: fix issues when running outside the source tree Thomas Wood
  3 siblings, 0 replies; 8+ messages in thread
From: Thomas Wood @ 2014-11-03 11:31 UTC (permalink / raw)
  To: intel-gfx

The optopt variable is not set if an invalid long option is used, so
check the current option character instead.

Signed-off-by: Thomas Wood <thomas.wood@intel.com>
---
 tests/testdisplay.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/tests/testdisplay.c b/tests/testdisplay.c
index 09e07f0..8c6bc62 100644
--- a/tests/testdisplay.c
+++ b/tests/testdisplay.c
@@ -545,7 +545,7 @@ int update_display(void)
 
 static char optstr[] = "3hiaf:s:d:p:mrto:j:";
 
-static void __attribute__((noreturn)) usage(char *name)
+static void __attribute__((noreturn)) usage(char *name, char opt)
 {
 	igt_info("usage: %s [-hiasdpmtf]\n", name);
 	igt_info("\t-i\tdump info\n");
@@ -563,7 +563,7 @@ static void __attribute__((noreturn)) usage(char *name)
 	igt_info("\t\t<vdisp>,<vsync-start>,<vsync-end>,<vtotal>\n");
 	igt_info("\t\ttest force mode\n");
 	igt_info("\tDefault is to test all modes.\n");
-	exit((optopt) ? -1 : 0);
+	exit((opt != 'h') ? -1 : 0);
 }
 
 #define dump_resource(res) if (res) dump_##res()
@@ -665,7 +665,7 @@ int main(int argc, char **argv)
 			if(sscanf(optarg,"%f,%hu,%hu,%hu,%hu,%hu,%hu,%hu,%hu",
 				&force_clock,&force_timing.hdisplay, &force_timing.hsync_start,&force_timing.hsync_end,&force_timing.htotal,
 				&force_timing.vdisplay, &force_timing.vsync_start, &force_timing.vsync_end, &force_timing.vtotal)!= 9)
-				usage(argv[0]);
+				usage(argv[0], c);
 			force_timing.clock = force_clock*1000;
 
 			break;
@@ -685,7 +685,7 @@ int main(int argc, char **argv)
 			if (sscanf(optarg, "%d,%d,%d,%d,%d,%d", &plane_width,
 				   &plane_height, &crtc_x, &crtc_y,
 				   &crtc_w, &crtc_h) != 6)
-				usage(argv[0]);
+				usage(argv[0], c);
 			test_plane = 1;
 			break;
 		case 'm':
@@ -707,7 +707,7 @@ int main(int argc, char **argv)
 		default:
 			/* fall through */
 		case 'h':
-			usage(argv[0]);
+			usage(argv[0], c);
 			break;
 		}
 	}
-- 
2.1.0

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

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

* [PATCH i-g-t 4/5] testdiplay: add a "--help" option
  2014-11-03 11:31 [PATCH i-g-t 1/5] lib/tests: fix tests and test list location Thomas Wood
  2014-11-03 11:31 ` [PATCH i-g-t 2/5] lib/tests: don't use hard error status to indicate test failure Thomas Wood
  2014-11-03 11:31 ` [PATCH i-g-t 3/5] testdisplay: ensure invalid long option exit status is non-zero Thomas Wood
@ 2014-11-03 11:31 ` Thomas Wood
  2014-11-03 11:31 ` [PATCH i-g-t 5/5] configure: fix issues when running outside the source tree Thomas Wood
  3 siblings, 0 replies; 8+ messages in thread
From: Thomas Wood @ 2014-11-03 11:31 UTC (permalink / raw)
  To: intel-gfx

Signed-off-by: Thomas Wood <thomas.wood@intel.com>
---
 tests/testdisplay.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/tests/testdisplay.c b/tests/testdisplay.c
index 8c6bc62..b7e1541 100644
--- a/tests/testdisplay.c
+++ b/tests/testdisplay.c
@@ -642,6 +642,7 @@ int main(int argc, char **argv)
 	struct option long_opts[] = {
 		{"list-subtests", 0, 0, SUBTEST_OPTS},
 		{"run-subtest", 1, 0, SUBTEST_OPTS},
+		{"help", 0, 0, 'h'},
 		{ 0, 0, 0, 0 }
 	};
 
-- 
2.1.0

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

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

* [PATCH i-g-t 5/5] configure: fix issues when running outside the source tree
  2014-11-03 11:31 [PATCH i-g-t 1/5] lib/tests: fix tests and test list location Thomas Wood
                   ` (2 preceding siblings ...)
  2014-11-03 11:31 ` [PATCH i-g-t 4/5] testdiplay: add a "--help" option Thomas Wood
@ 2014-11-03 11:31 ` Thomas Wood
  3 siblings, 0 replies; 8+ messages in thread
From: Thomas Wood @ 2014-11-03 11:31 UTC (permalink / raw)
  To: intel-gfx

Signed-off-by: Thomas Wood <thomas.wood@intel.com>
---
 configure.ac | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/configure.ac b/configure.ac
index d3faa19..a2569b8 100644
--- a/configure.ac
+++ b/configure.ac
@@ -203,7 +203,7 @@ AC_DEFINE_UNQUOTED(TARGET_CPU_PLATFORM, ["$host_cpu"], [Target platform])
 
 files="broadwell cherryview haswell ivybridge sandybridge valleyview skylake"
 for file in $files; do
-	QUICK_DUMP_EXTRA_DIST="$QUICK_DUMP_EXTRA_DIST $file `tr '\n' ' ' < tools/quick_dump/$file`"
+	QUICK_DUMP_EXTRA_DIST="$QUICK_DUMP_EXTRA_DIST $file `tr '\n' ' ' < $srcdir/tools/quick_dump/$file`"
 done
 AC_SUBST(QUICK_DUMP_EXTRA_DIST)
 
-- 
2.1.0

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

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

* Re: [PATCH i-g-t 2/5] lib/tests: don't use hard error status to indicate test failure
  2014-11-03 11:31 ` [PATCH i-g-t 2/5] lib/tests: don't use hard error status to indicate test failure Thomas Wood
@ 2014-11-03 15:02   ` Daniel Vetter
  2014-11-03 15:42     ` Thomas Wood
  0 siblings, 1 reply; 8+ messages in thread
From: Daniel Vetter @ 2014-11-03 15:02 UTC (permalink / raw)
  To: Thomas Wood; +Cc: intel-gfx

On Mon, Nov 03, 2014 at 11:31:02AM +0000, Thomas Wood wrote:
> Signed-off-by: Thomas Wood <thomas.wood@intel.com>
> ---
>  lib/tests/igt_command_line.sh | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/lib/tests/igt_command_line.sh b/lib/tests/igt_command_line.sh
> index 7e6ca67..5cf2584 100755
> --- a/lib/tests/igt_command_line.sh
> +++ b/lib/tests/igt_command_line.sh
> @@ -48,20 +48,20 @@ for test in $TESTLIST; do
>  
>  	# check invalid option handling
>  	echo "  Checking invalid option handling..."
> -	./$test --invalid-option 2> /dev/null && exit 99
> +	./$test --invalid-option 2> /dev/null && exit 1

Just a curious question: What's better with hardcoding 1 than hardcoding
99? Otherwise series lgtm.
-Daniel
-- 
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

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

* Re: [PATCH i-g-t 2/5] lib/tests: don't use hard error status to indicate test failure
  2014-11-03 15:02   ` Daniel Vetter
@ 2014-11-03 15:42     ` Thomas Wood
  2014-11-03 16:44       ` Daniel Vetter
  0 siblings, 1 reply; 8+ messages in thread
From: Thomas Wood @ 2014-11-03 15:42 UTC (permalink / raw)
  To: Daniel Vetter; +Cc: Intel Graphics Development

On 3 November 2014 15:02, Daniel Vetter <daniel@ffwll.ch> wrote:
> On Mon, Nov 03, 2014 at 11:31:02AM +0000, Thomas Wood wrote:
>> Signed-off-by: Thomas Wood <thomas.wood@intel.com>
>> ---
>>  lib/tests/igt_command_line.sh | 8 ++++----
>>  1 file changed, 4 insertions(+), 4 deletions(-)
>>
>> diff --git a/lib/tests/igt_command_line.sh b/lib/tests/igt_command_line.sh
>> index 7e6ca67..5cf2584 100755
>> --- a/lib/tests/igt_command_line.sh
>> +++ b/lib/tests/igt_command_line.sh
>> @@ -48,20 +48,20 @@ for test in $TESTLIST; do
>>
>>       # check invalid option handling
>>       echo "  Checking invalid option handling..."
>> -     ./$test --invalid-option 2> /dev/null && exit 99
>> +     ./$test --invalid-option 2> /dev/null && exit 1
>
> Just a curious question: What's better with hardcoding 1 than hardcoding
> 99? Otherwise series lgtm.

From the automake manual:

"When no test protocol is in use, an exit status of 0 from a test
script will denote a success, an exit status of 77 a skipped test, an
exit status of 99 an hard error, and any other exit status will denote
a failure."

So, an exit status of 99 is reported separately in the summary as an
error, rather than as a test failure.


> -Daniel
> --
> Daniel Vetter
> Software Engineer, Intel Corporation
> +41 (0) 79 365 57 48 - http://blog.ffwll.ch
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/intel-gfx
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

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

* Re: [PATCH i-g-t 2/5] lib/tests: don't use hard error status to indicate test failure
  2014-11-03 15:42     ` Thomas Wood
@ 2014-11-03 16:44       ` Daniel Vetter
  0 siblings, 0 replies; 8+ messages in thread
From: Daniel Vetter @ 2014-11-03 16:44 UTC (permalink / raw)
  To: Thomas Wood; +Cc: Intel Graphics Development

On Mon, Nov 03, 2014 at 03:42:06PM +0000, Thomas Wood wrote:
> On 3 November 2014 15:02, Daniel Vetter <daniel@ffwll.ch> wrote:
> > On Mon, Nov 03, 2014 at 11:31:02AM +0000, Thomas Wood wrote:
> >> Signed-off-by: Thomas Wood <thomas.wood@intel.com>
> >> ---
> >>  lib/tests/igt_command_line.sh | 8 ++++----
> >>  1 file changed, 4 insertions(+), 4 deletions(-)
> >>
> >> diff --git a/lib/tests/igt_command_line.sh b/lib/tests/igt_command_line.sh
> >> index 7e6ca67..5cf2584 100755
> >> --- a/lib/tests/igt_command_line.sh
> >> +++ b/lib/tests/igt_command_line.sh
> >> @@ -48,20 +48,20 @@ for test in $TESTLIST; do
> >>
> >>       # check invalid option handling
> >>       echo "  Checking invalid option handling..."
> >> -     ./$test --invalid-option 2> /dev/null && exit 99
> >> +     ./$test --invalid-option 2> /dev/null && exit 1
> >
> > Just a curious question: What's better with hardcoding 1 than hardcoding
> > 99? Otherwise series lgtm.
> 
> From the automake manual:
> 
> "When no test protocol is in use, an exit status of 0 from a test
> script will denote a success, an exit status of 77 a skipped test, an
> exit status of 99 an hard error, and any other exit status will denote
> a failure."
> 
> So, an exit status of 99 is reported separately in the summary as an
> error, rather than as a test failure.

Ah, makes sense. Can you please add this bit of important information to
the commit message before pushing?

Thanks, Daniel
-- 
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

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

end of thread, other threads:[~2014-11-03 16:44 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-11-03 11:31 [PATCH i-g-t 1/5] lib/tests: fix tests and test list location Thomas Wood
2014-11-03 11:31 ` [PATCH i-g-t 2/5] lib/tests: don't use hard error status to indicate test failure Thomas Wood
2014-11-03 15:02   ` Daniel Vetter
2014-11-03 15:42     ` Thomas Wood
2014-11-03 16:44       ` Daniel Vetter
2014-11-03 11:31 ` [PATCH i-g-t 3/5] testdisplay: ensure invalid long option exit status is non-zero Thomas Wood
2014-11-03 11:31 ` [PATCH i-g-t 4/5] testdiplay: add a "--help" option Thomas Wood
2014-11-03 11:31 ` [PATCH i-g-t 5/5] configure: fix issues when running outside the source tree Thomas Wood

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox