[for-next][PATCH 21/23] ktest.pl: Allow dodie be recursive

From: Steven Rostedt
Date: Sun Apr 08 2018 - 16:20:02 EST


From: "Steven Rostedt (VMware)" <rostedt@xxxxxxxxxxx>

If dodie cause a function that itself will call dodie, then be able to
handle that. This will allow dodie functions to call run_command, which
could possibly call dodie. If dodie is called again, simply ignore it.

Signed-off-by: Steven Rostedt (VMware) <rostedt@xxxxxxxxxxx>
---
tools/testing/ktest/ktest.pl | 7 +++++++
1 file changed, 7 insertions(+)

diff --git a/tools/testing/ktest/ktest.pl b/tools/testing/ktest/ktest.pl
index 3400a23e6a41..ac6750bb5942 100755
--- a/tools/testing/ktest/ktest.pl
+++ b/tools/testing/ktest/ktest.pl
@@ -1433,7 +1433,14 @@ sub do_not_reboot {
($test_type eq "config_bisect" && $opt{"CONFIG_BISECT_TYPE[$i]"} eq "build");
}

+my $in_die = 0;
+
sub dodie {
+
+ # avoid recusion
+ return if ($in_die);
+ $in_die = 1;
+
doprint "CRITICAL FAILURE... ", @_, "\n";

my $i = $iteration;
--
2.16.3