All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH igt] lib/core: Add option to exit on first failure
@ 2016-03-19 16:15 Chris Wilson
  2016-03-21  9:49 ` Daniel Vetter
  0 siblings, 1 reply; 2+ messages in thread
From: Chris Wilson @ 2016-03-19 16:15 UTC (permalink / raw)
  To: intel-gfx

When bisecting a test failure (one of many possibile subtests), we want
to exit as early as possible after the first subtest fails.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
---
 lib/igt_core.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/lib/igt_core.c b/lib/igt_core.c
index ad79498..a7d6766 100644
--- a/lib/igt_core.c
+++ b/lib/igt_core.c
@@ -231,6 +231,7 @@ const char *igt_interactive_debug;
 
 /* subtests helpers */
 static bool list_subtests = false;
+static bool kill_on_fail = false;
 static char *run_single_subtest = NULL;
 static bool run_single_subtest_found = false;
 static const char *in_subtest = NULL;
@@ -258,6 +259,7 @@ enum {
  OPT_DESCRIPTION,
  OPT_DEBUG,
  OPT_INTERACTIVE_DEBUG,
+ OPT_KILL = 'k',
  OPT_HELP = 'h'
 };
 
@@ -585,11 +587,12 @@ static int common_init(int *argc, char **argv,
 		{"help-description", 0, 0, OPT_DESCRIPTION},
 		{"debug", optional_argument, 0, OPT_DEBUG},
 		{"interactive-debug", optional_argument, 0, OPT_INTERACTIVE_DEBUG},
+		{"kill", 0, 0, OPT_KILL},
 		{"help", 0, 0, OPT_HELP},
 		{0, 0, 0, 0}
 	};
 	char *short_opts;
-	const char *std_short_opts = "h";
+	const char *std_short_opts = "kh";
 	struct option *combined_opts;
 	int extra_opt_count;
 	int all_opt_count;
@@ -700,6 +703,9 @@ static int common_init(int *argc, char **argv,
 			print_test_description();
 			ret = -1;
 			goto out;
+		case OPT_KILL:
+			kill_on_fail = true;
+			break;
 		case OPT_HELP:
 			print_usage(help_str, false);
 			ret = -1;
@@ -1148,6 +1154,8 @@ void igt_fail(int exitcode)
 			exit_subtest("TIMEOUT");
 		else
 			exit_subtest("FAIL");
+		if (kill_on_fail)
+			igt_exit();
 	} else {
 		assert(!test_with_subtests || in_fixture);
 
-- 
2.8.0.rc3

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

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

* Re: [PATCH igt] lib/core: Add option to exit on first failure
  2016-03-19 16:15 [PATCH igt] lib/core: Add option to exit on first failure Chris Wilson
@ 2016-03-21  9:49 ` Daniel Vetter
  0 siblings, 0 replies; 2+ messages in thread
From: Daniel Vetter @ 2016-03-21  9:49 UTC (permalink / raw)
  To: Chris Wilson; +Cc: intel-gfx

On Sat, Mar 19, 2016 at 04:15:29PM +0000, Chris Wilson wrote:
> When bisecting a test failure (one of many possibile subtests), we want
> to exit as early as possible after the first subtest fails.
> 
> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>

Please also extend the help text in print_usage() and the doc overview.
With that addressed seemse like a useful idea, ack.
-Daniel

> ---
>  lib/igt_core.c | 10 +++++++++-
>  1 file changed, 9 insertions(+), 1 deletion(-)
> 
> diff --git a/lib/igt_core.c b/lib/igt_core.c
> index ad79498..a7d6766 100644
> --- a/lib/igt_core.c
> +++ b/lib/igt_core.c
> @@ -231,6 +231,7 @@ const char *igt_interactive_debug;
>  
>  /* subtests helpers */
>  static bool list_subtests = false;
> +static bool kill_on_fail = false;
>  static char *run_single_subtest = NULL;
>  static bool run_single_subtest_found = false;
>  static const char *in_subtest = NULL;
> @@ -258,6 +259,7 @@ enum {
>   OPT_DESCRIPTION,
>   OPT_DEBUG,
>   OPT_INTERACTIVE_DEBUG,
> + OPT_KILL = 'k',
>   OPT_HELP = 'h'
>  };
>  
> @@ -585,11 +587,12 @@ static int common_init(int *argc, char **argv,
>  		{"help-description", 0, 0, OPT_DESCRIPTION},
>  		{"debug", optional_argument, 0, OPT_DEBUG},
>  		{"interactive-debug", optional_argument, 0, OPT_INTERACTIVE_DEBUG},
> +		{"kill", 0, 0, OPT_KILL},
>  		{"help", 0, 0, OPT_HELP},
>  		{0, 0, 0, 0}
>  	};
>  	char *short_opts;
> -	const char *std_short_opts = "h";
> +	const char *std_short_opts = "kh";
>  	struct option *combined_opts;
>  	int extra_opt_count;
>  	int all_opt_count;
> @@ -700,6 +703,9 @@ static int common_init(int *argc, char **argv,
>  			print_test_description();
>  			ret = -1;
>  			goto out;
> +		case OPT_KILL:
> +			kill_on_fail = true;
> +			break;
>  		case OPT_HELP:
>  			print_usage(help_str, false);
>  			ret = -1;
> @@ -1148,6 +1154,8 @@ void igt_fail(int exitcode)
>  			exit_subtest("TIMEOUT");
>  		else
>  			exit_subtest("FAIL");
> +		if (kill_on_fail)
> +			igt_exit();
>  	} else {
>  		assert(!test_with_subtests || in_fixture);
>  
> -- 
> 2.8.0.rc3
> 
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/intel-gfx

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

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

end of thread, other threads:[~2016-03-21  9:49 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-03-19 16:15 [PATCH igt] lib/core: Add option to exit on first failure Chris Wilson
2016-03-21  9:49 ` Daniel Vetter

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.