mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Steven Rostedt <rostedt@goodmis.org>
To: linux-kernel@vger.kernel.org
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Subject: [PATCH 06/20] ktest: Allow bisect test to restart where it left off
Date: Wed, 04 Jan 2012 22:48:01 -0500	[thread overview]
Message-ID: <20120105034822.714222035@goodmis.org> (raw)
In-Reply-To: <20120105034755.793909214@goodmis.org>

[-- Attachment #1: Type: text/plain, Size: 3017 bytes --]

From: Steven Rostedt <srostedt@redhat.com>

If a bisect is killed for some reason, have ktest detect that a bisect
is in progress and if so, allow the user to start the bisect where
it left off.

Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
---
 tools/testing/ktest/ktest.pl |   70 ++++++++++++++++++++++++++++++++++++++---
 1 files changed, 64 insertions(+), 6 deletions(-)

diff --git a/tools/testing/ktest/ktest.pl b/tools/testing/ktest/ktest.pl
index 77b4649..2ffb67c 100755
--- a/tools/testing/ktest/ktest.pl
+++ b/tools/testing/ktest/ktest.pl
@@ -239,20 +239,36 @@ $config_help{"REBOOT_SCRIPT"} = << "EOF"
 EOF
     ;
 
-sub read_yn {
-    my ($prompt) = @_;
+sub read_prompt {
+    my ($cancel, $prompt) = @_;
 
     my $ans;
 
     for (;;) {
-	print "$prompt [Y/n] ";
+	if ($cancel) {
+	    print "$prompt [y/n/C] ";
+	} else {
+	    print "$prompt [Y/n] ";
+	}
 	$ans = <STDIN>;
 	chomp $ans;
 	if ($ans =~ /^\s*$/) {
-	    $ans = "y";
+	    if ($cancel) {
+		$ans = "c";
+	    } else {
+		$ans = "y";
+	    }
 	}
 	last if ($ans =~ /^y$/i || $ans =~ /^n$/i);
-	print "Please answer either 'y' or 'n'.\n";
+	if ($cancel) {
+	    last if ($ans =~ /^c$/i);
+	    print "Please answer either 'y', 'n' or 'c'.\n";
+	} else {
+	    print "Please answer either 'y' or 'n'.\n";
+	}
+    }
+    if ($ans =~ /^c/i) {
+	exit;
     }
     if ($ans !~ /^y$/i) {
 	return 0;
@@ -260,6 +276,18 @@ sub read_yn {
     return 1;
 }
 
+sub read_yn {
+    my ($prompt) = @_;
+
+    return read_prompt 0, $prompt;
+}
+
+sub read_ync {
+    my ($prompt) = @_;
+
+    return read_prompt 1, $prompt;
+}
+
 sub get_ktest_config {
     my ($config) = @_;
     my $ans;
@@ -1895,6 +1923,13 @@ sub run_bisect {
     }
 }
 
+sub update_bisect_replay {
+    my $tmp_log = "$tmpdir/ktest_bisect_log";
+    run_command "git bisect log > $tmp_log" or
+	die "can't create bisect log";
+    return $tmp_log;
+}
+
 sub bisect {
     my ($i) = @_;
 
@@ -1934,8 +1969,31 @@ sub bisect {
 	$type = "boot";
     }
 
+    # Check if a bisect was running
+    my $bisect_start_file = "$builddir/.git/BISECT_START";
+
     my $check = $opt{"BISECT_CHECK[$i]"};
-    if (defined($check) && $check ne "0") {
+    my $do_check = defined($check) && $check ne "0";
+
+    if ( -f $bisect_start_file ) {
+	print "Bisect in progress found\n";
+	if ($do_check) {
+	    print " If you say yes, then no checks of good or bad will be done\n";
+	}
+	if (defined($replay)) {
+	    print "** BISECT_REPLAY is defined in config file **";
+	    print " Ignore config option and perform new git bisect log?\n";
+	    if (read_ync " (yes, no, or cancel) ") {
+		$replay = update_bisect_replay;
+		$do_check = 0;
+	    }
+	} elsif (read_yn "read git log and continue?") {
+	    $replay = update_bisect_replay;
+	    $do_check = 0;
+	}
+    }
+
+    if ($do_check) {
 
 	# get current HEAD
 	my $head = get_sha1("HEAD");
-- 
1.7.7.3



[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

  parent reply	other threads:[~2012-01-05  3:48 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-01-05  3:47 [PATCH 00/20] ktest: new and fancy updates Steven Rostedt
2012-01-05  3:47 ` [PATCH 01/20] ktest: Check parent options for iterated tests Steven Rostedt
2012-01-05  3:47 ` [PATCH 02/20] ktest: Save test output Steven Rostedt
2012-01-05  3:47 ` [PATCH 03/20] ktest: Allow success logs to be stored Steven Rostedt
2012-01-05  3:47 ` [PATCH 04/20] ktest: Add default for ssh-user, build-target and target-image Steven Rostedt
2012-01-05  3:48 ` [PATCH 05/20] ktest: When creating new config, allow the use of ${THIS_DIR} Steven Rostedt
2012-01-05  3:48 ` Steven Rostedt [this message]
2012-01-05  3:48 ` [PATCH 07/20] ktest: Ask for type of test when creating a new config Steven Rostedt
2012-01-05  3:48 ` [PATCH 08/20] ktest: Do not ask for some options if the only test is build Steven Rostedt
2012-01-05  3:48 ` [PATCH 09/20] ktest: When creating a new config, ask for BUILD_OPTIONS Steven Rostedt
2012-01-05  3:48 ` [PATCH 10/20] ktest: Only ask options needed for install Steven Rostedt
2012-01-05  3:48 ` [PATCH 11/20] ktest: Evaluate $KERNEL_VERSION in both install and post install Steven Rostedt
2012-01-05  3:48 ` [PATCH 12/20] ktest: Evaluate options before processing them Steven Rostedt
2012-01-05  3:48 ` [PATCH 13/20] ktest: Allow overriding bisect test results Steven Rostedt
2012-01-05  3:48 ` [PATCH 14/20] ktest: Add options SWITCH_TO_GOOD and SWITCH_TO_TEST Steven Rostedt
2012-01-05  3:48 ` [PATCH 15/20] ktest: Change initialization of defaults hash to perl format Steven Rostedt
2012-01-05  3:48 ` [PATCH 16/20] ktest: Have all values be set by defaults Steven Rostedt
2012-01-05  3:48 ` [PATCH 17/20] ktest: Detect typos in option names Steven Rostedt
2012-01-05  3:48 ` [PATCH 18/20] ktest: Fix compare script to test if options are not documented Steven Rostedt
2012-01-05  3:48 ` [PATCH 19/20] ktest: Still do reboot even for REBOOT_TYPE = script Steven Rostedt
2012-01-05  3:48 ` [PATCH 20/20] ktest: Add INGORE_ERRORS to ignore warnings in boot up Steven Rostedt

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20120105034822.714222035@goodmis.org \
    --to=rostedt@goodmis.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=torvalds@linux-foundation.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome