[PATCH igt] lib/core: Add option to exit on first failure

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxxxxxxxxx>
---
 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@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/intel-gfx




[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]
  Powered by Linux