mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Andrew Jones <drjones@redhat.com>
To: linux-kernel@vger.kernel.org
Cc: drjones@redhat.com, rostedt@goodmis.org
Subject: [PATCH 04/10 v2] ktest: Introduce CONSOLE_RESET_TIME
Date: Fri, 12 Aug 2011 18:25:53 +0200	[thread overview]
Message-ID: <1313166353-3664-1-git-send-email-drjones@redhat.com> (raw)
In-Reply-To: <1313155932-20092-5-git-send-email-drjones@redhat.com>

When rebooting, some targets may lose their console connection. This
certainly happens with 'virsh console' when used with my xen guests.
Setting CONSOLE_RESET_TIME will tell ktest to reconnect the console
after reboot.
---
 tools/testing/ktest/ktest.pl    |   28 +++++++++++++++++++++++-----
 tools/testing/ktest/sample.conf |    8 ++++++++
 2 files changed, 31 insertions(+), 5 deletions(-)

diff --git a/tools/testing/ktest/ktest.pl b/tools/testing/ktest/ktest.pl
index 12c392e..8bc6dd8 100755
--- a/tools/testing/ktest/ktest.pl
+++ b/tools/testing/ktest/ktest.pl
@@ -108,6 +108,7 @@ my $monitor_cnt = 0;
 my $sleep_time;
 my $bisect_sleep_time;
 my $patchcheck_sleep_time;
+my $console_reset_time;
 my $ignore_warnings;
 my $store_failures;
 my $test_name;
@@ -606,6 +607,7 @@ sub run_command;
 sub start_monitor;
 sub end_monitor;
 sub wait_for_monitor;
+sub reset_monitor;
 
 sub reboot {
     my ($time) = @_;
@@ -626,6 +628,7 @@ sub reboot {
 	wait_for_monitor $time;
 	end_monitor;
     }
+    reset_monitor;
 }
 
 sub do_not_reboot {
@@ -685,7 +688,9 @@ sub close_console {
 }
 
 sub start_monitor {
-    if ($monitor_cnt++) {
+    my ($force) = @_;
+
+    if ($monitor_cnt++ && !defined($force)) {
 	return;
     }
     $monitor_fp = \*MONFD;
@@ -697,12 +702,23 @@ sub start_monitor {
 }
 
 sub end_monitor {
-    if (--$monitor_cnt) {
+    my ($force) = @_;
+
+    if (--$monitor_cnt && !defined($force)) {
 	return;
     }
     close_console($monitor_fp, $monitor_pid);
 }
 
+sub reset_monitor {
+    if ($monitor_cnt <= 0 || !defined($console_reset_time)) {
+	return;
+    }
+    end_monitor 'force';
+    sleep $console_reset_time;
+    start_monitor 'force';
+}
+
 sub wait_for_monitor {
     my ($time) = @_;
     my $line;
@@ -911,10 +927,11 @@ sub wait_for_input
 sub reboot_to {
     if ($reboot_type eq "grub") {
 	run_ssh "'(echo \"savedefault --default=$grub_number --once\" | grub --batch && reboot)'";
-	return;
+    } else {
+	run_command "$reboot_script";
     }
-
-    run_command "$reboot_script";
+    wait_for_monitor $sleep_time;
+    reset_monitor;
 }
 
 sub get_sha1 {
@@ -2817,6 +2834,7 @@ for (my $i = 1; $i <= $opt{"NUM_TESTS"}; $i++) {
     $sleep_time = set_test_option("SLEEP_TIME", $i);
     $bisect_sleep_time = set_test_option("BISECT_SLEEP_TIME", $i);
     $patchcheck_sleep_time = set_test_option("PATCHCHECK_SLEEP_TIME", $i);
+    $console_reset_time = set_test_option("CONSOLE_RESET_TIME", $i);
     $ignore_warnings = set_test_option("IGNORE_WARNINGS", $i);
     $bisect_manual = set_test_option("BISECT_MANUAL", $i);
     $bisect_skip = set_test_option("BISECT_SKIP", $i);
diff --git a/tools/testing/ktest/sample.conf b/tools/testing/ktest/sample.conf
index b8bcd14..ba430a7 100644
--- a/tools/testing/ktest/sample.conf
+++ b/tools/testing/ktest/sample.conf
@@ -491,6 +491,14 @@
 # (default 60)
 #PATCHCHECK_SLEEP_TIME = 60
 
+# If the console needs to be reset during a reboot cycle in
+# order to reestablish it's connection, then set this option
+# to the number of seconds ktest should wait between disconnect
+# and reconnect. This is needed when using 'virsh console' to
+# connect to guests.
+# (default undefined)
+#CONSOLE_RESET_TIME = 5
+
 # Reboot the target box on error (default 0)
 #REBOOT_ON_ERROR = 0
 
-- 
1.7.4.1


  parent reply	other threads:[~2011-08-12 16:26 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-08-12 13:32 [KTEST PATCH 00/10] collection of ktest patches Andrew Jones
2011-08-12 13:32 ` [PATCH 01/10] ktest: create outputdir, if it doesn't exist Andrew Jones
2011-08-12 13:32 ` [PATCH 02/10] ktest: small cleanup Andrew Jones
2011-08-12 13:32 ` [PATCH 03/10] ktest: factor reboot code Andrew Jones
2011-08-12 13:32 ` [PATCH 04/10] ktest: Introduce RESET_TIME Andrew Jones
2011-08-12 15:59   ` Steven Rostedt
2011-08-12 16:25   ` Andrew Jones [this message]
2011-08-18 21:28     ` [PATCH 04/10 v2] ktest: Introduce CONSOLE_RESET_TIME Steven Rostedt
2011-08-24  8:45       ` Andrew Jones
2011-08-12 13:32 ` [PATCH 05/10] ktest: refactor monitor/boot/test code Andrew Jones
2011-08-12 13:32 ` [PATCH 06/10] ktest: make start_monitor_and_boot true to its name Andrew Jones
2011-08-12 13:32 ` [PATCH 07/10] ktest: Introduce PASS_COUNT Andrew Jones
2011-08-12 16:49   ` Steven Rostedt
2011-08-12 17:09     ` Andrew Jones
2011-08-12 17:20       ` Steven Rostedt
2011-08-12 17:58   ` [PATCH 07/10 v2] ktest: Introduce RERUN Andrew Jones
2011-08-12 13:32 ` [PATCH 08/10] ktest: test faster, put REBOOT_ON_SUCCESS to more work Andrew Jones
2011-08-12 13:32 ` [PATCH 09/10] ktest: test faster, favor rsync over the tarball method Andrew Jones
2011-08-12 13:32 ` [PATCH 10/10] ktest: Introduce FAILURE_LINE Andrew Jones
2011-08-12 17:03   ` Steven Rostedt
2011-08-12 17:37   ` [PATCH 10/10 v2] " Andrew Jones
2011-08-12 17:44 ` [KTEST PATCH 00/10] collection of ktest patches Steven Rostedt
2011-08-12 18:03   ` Andrew Jones

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=1313166353-3664-1-git-send-email-drjones@redhat.com \
    --to=drjones@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rostedt@goodmis.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