|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [PATCH OSSTEST 3/6] Serial: Refactor debug key sending into separate request_debug function
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
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |