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 5/6] Serial: new module to send debug keys via xenuse
Date: Fri, 11 Oct 2013 16:54:22 +0100 [thread overview]
Message-ID: <1381506863-1888-5-git-send-email-ian.campbell@citrix.com> (raw)
In-Reply-To: <1381506785.24708.66.camel@kazak.uk.xensource.com>
No log retreival here, that is handled via a separate conserver.
---
Osstest/Serial/xenuse.pm | 100 ++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 100 insertions(+)
create mode 100644 Osstest/Serial/xenuse.pm
diff --git a/Osstest/Serial/xenuse.pm b/Osstest/Serial/xenuse.pm
new file mode 100644
index 0000000..6b9d955
--- /dev/null
+++ b/Osstest/Serial/xenuse.pm
@@ -0,0 +1,100 @@
+# This is part of "osstest", an automated testing framework for Xen.
+# Copyright (C) 2009-2013 Citrix Inc.
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+# Send debug keys via xenuse.
+
+package Osstest::Serial::xenuse;
+
+use strict;
+use warnings;
+
+use Osstest;
+use Osstest::TestSupport;
+
+use File::Temp;
+use File::Copy;
+
+BEGIN {
+ use Exporter ();
+ our ($VERSION, @ISA, @EXPORT, @EXPORT_OK, %EXPORT_TAGS);
+ $VERSION = 1.00;
+ @ISA = qw(Exporter);
+ @EXPORT = qw();
+ %EXPORT_TAGS = ( );
+
+ @EXPORT_OK = qw();
+}
+
+sub new {
+ my ($class, $ho, $methname, @args) = @_;
+ my $mo = { Host => $ho, Name => $ho->{Name} };
+
+ logm("serial method $methname $mo->{Host}{Name}: @args");
+ return bless $mo, $class;
+}
+
+sub request_debug {
+ my ($mo,$conswitch,$xenkeys,$guestkeys) = @_;
+ my $xenuse= $c{XenUsePath} || "xenuse";
+
+ my $ho= $mo->{Host};
+
+ my $writer= sub {
+ my ($what,$str,$pause) = @_;
+ logm("xenuse sending $what");
+ if (!eval {
+ print XENUSEWRITE $str or die $!;
+ sleep($pause);
+ 1;
+ }) {
+ warn "failed to send $what: $@\n";
+ return 0;
+ }
+ return 1;
+ };
+
+ my $debugkeys= sub {
+ my ($what, $keys) = @_;
+ foreach my $k (split //, $keys) {
+ $writer->("$what debug info request, debug key $k", $k, 2);
+ }
+ };
+
+ local ($SIG{'PIPE'}) = 'IGNORE';
+ open XENUSEWRITE, "|$xenuse -t $ho->{Name}" or die $!;
+ autoflush XENUSEWRITE 1;
+
+ $writer->('force attach', "\x05cf", 1); # ^E c f == force attach
+
+ $writer->('request for input to Xen', $conswitch, 1);
+ $debugkeys->('Xen', $xenkeys);
+ sleep(10);
+ $debugkeys->('guest', $guestkeys);
+ sleep(10);
+ $writer->("RET to dom0","$conswitch\r", 5);
+
+ $writer->('dettach', "\x05c.", 1); # ^E c . == disconnect
+
+ close XENUSEWRITE or die "$? $!";
+
+ return 1;
+}
+
+sub fetch_logs {
+ return;
+}
+
+1;
--
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 ` [PATCH OSSTEST 3/6] Serial: Refactor debug key sending into separate request_debug function Ian Campbell
2013-10-11 15:54 ` [PATCH OSSTEST 4/6] Serial: collect serial logs from an http server Ian Campbell
2013-10-11 15:54 ` Ian Campbell [this message]
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-5-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).