[Intel-gfx] [PATCH igt] lib/core: Add option to exit on first failure
Daniel Vetter
daniel at ffwll.ch
Mon Mar 21 09:49:47 UTC 2016
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 at 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 at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/intel-gfx
--
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
More information about the Intel-gfx
mailing list