From: Ian Campbell <ian.campbell@citrix.com>
To: ian.jackson@eu.citrix.com
Cc: Ian Campbell <ian.campbell@citrix.com>, xen-devel@lists.xen.org
Subject: [PATCH OSSTEST 3/6] Serial: Refactor debug key sending into separate request_debug function
Date: Fri, 11 Oct 2013 16:54:20 +0100 [thread overview]
Message-ID: <1381506863-1888-3-git-send-email-ian.campbell@citrix.com> (raw)
In-Reply-To: <1381506785.24708.66.camel@kazak.uk.xensource.com>
This puts the list of keys to send into common code.
---
Osstest/Serial/noop.pm | 4 ++++
Osstest/Serial/sympathy.pm | 42 +++++++++++++++++++++++++-----------------
Osstest/TestSupport.pm | 12 ++++++++++++
3 files changed, 41 insertions(+), 17 deletions(-)
diff --git a/Osstest/Serial/noop.pm b/Osstest/Serial/noop.pm
index 1b980c2..d0de9cd 100644
--- a/Osstest/Serial/noop.pm
+++ b/Osstest/Serial/noop.pm
@@ -39,6 +39,10 @@ sub new {
return bless { }, $class;
}
+sub request_debug {
+ return 0;
+}
+
sub fetch_logs {
my ($mo) = @_;
logm("serial access method \`noop',".
diff --git a/Osstest/Serial/sympathy.pm b/Osstest/Serial/sympathy.pm
index 3128b68..d6bf425 100644
--- a/Osstest/Serial/sympathy.pm
+++ b/Osstest/Serial/sympathy.pm
@@ -57,21 +57,15 @@ sub new {
return bless $mo, $class;
}
-sub fetch_logs {
- my ($mo) = @_;
-
- my $started= $mjobdb->jobdb_flight_started_for_log_capture($flight);
+sub request_debug {
+ my ($mo,$conswitch,$xenkeys,$guestkeys) = @_;
- my $ho = $mo->{Host};
- my $logpat = $mo->{Pattern};
my $targhost= $mo->{Server};
- logm("requesting debug information");
-
my ($sshopts) = sshopts();
my $sympwrite= sub {
my ($what,$str,$pause) = @_;
- logm("sending $what");
+ logm("sympathy sending $what");
if (!eval {
local ($SIG{'PIPE'}) = 'IGNORE';
my $sock= $mo->{Socket};
@@ -89,18 +83,32 @@ sub fetch_logs {
}
return 1;
};
+
my $debugkeys= sub {
- my ($what, $keys) = @_;
- foreach my $k (split //, $keys) {
- $sympwrite->("$what debug info request, debug key $k", $k, 2);
- }
+ my ($what, $keys) = @_;
+ foreach my $k (split //, $keys) {
+ $sympwrite->("$what debug info request, debug key $k", $k, 2);
+ }
};
- $sympwrite->('request for input to Xen',"\x18\x18\x18",1);
- $debugkeys->('Xen',"0HMQacdegimnrstuvz");
+
+ $sympwrite->('request for input to Xen', $conswitch, 1);
+ $debugkeys->('Xen', $xenkeys);
sleep(10);
- $debugkeys->('guest',"q");
+ $debugkeys->('guest', $guestkeys);
sleep(10);
- $sympwrite->("RET to dom0","\x18\x18\x18\r", 5);
+ $sympwrite->("RET to dom0","$conswitch\r", 5);
+
+ return 1;
+}
+
+sub fetch_logs {
+ my ($mo) = @_;
+
+ my $started= $mjobdb->jobdb_flight_started_for_log_capture($flight);
+
+ my $ho = $mo->{Host};
+ my $logpat = $mo->{Pattern};
+ my $targhost= $mo->{Server};
logm("collecting serial logs since $started from $targhost");
diff --git a/Osstest/TestSupport.pm b/Osstest/TestSupport.pm
index 75fb7cc..f4ec055 100644
--- a/Osstest/TestSupport.pm
+++ b/Osstest/TestSupport.pm
@@ -635,7 +635,19 @@ sub serial_host_setup ($) {
sub serial_fetch_logs ($) {
my ($ho) = @_;
+
+ logm("serial: requesting debug information from $ho->{Name}");
+
+ foreach my $mo (@{ $ho->{SerialMethobjs} }) {
+ $mo->request_debug("\x18\x18\x18",
+ "0HMQacdegimnrstuvz",
+ "q") or next;
+ # use the first method which supports ->request_debug.
+ last;
+ }
+
logm("serial: collecting logs for $ho->{Name}");
+
foreach my $mo (@{ $ho->{SerialMethobjs} }) {
$mo->fetch_logs();
}
--
1.7.10.4
next prev parent reply other threads:[~2013-10-11 15:54 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-10-11 15:53 [PATCH OSSTEST 0/6] Support for serial logs from marilith boxes Ian Campbell
2013-10-11 15:54 ` [PATCH OSSTEST 1/6] Standalone: Collect logs modified in the last hour Ian Campbell
2013-10-11 15:54 ` [PATCH OSSTEST 2/6] TestSupport: allow multiple host serial methods Ian Campbell
2013-10-11 15:54 ` Ian Campbell [this message]
2013-10-11 15:54 ` [PATCH OSSTEST 4/6] Serial: collect serial logs from an http server Ian Campbell
2013-10-11 15:54 ` [PATCH OSSTEST 5/6] Serial: new module to send debug keys via xenuse Ian Campbell
2013-10-11 15:54 ` [PATCH OSSTEST 6/6] Serial/http: use mkdtemp instead of File::Temp->newdir Ian Campbell
2013-10-11 17:22 ` [PATCH OSSTEST 0/6] Support for serial logs from marilith boxes Ian Jackson
2013-10-13 9:19 ` Ian Campbell
2013-10-13 9:51 ` Ian Campbell
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=1381506863-1888-3-git-send-email-ian.campbell@citrix.com \
--to=ian.campbell@citrix.com \
--cc=ian.jackson@eu.citrix.com \
--cc=xen-devel@lists.xen.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;
as well as URLs for NNTP newsgroup(s).