xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Ian Jackson <ian.jackson@eu.citrix.com>
To: xen-devel@lists.xenproject.org
Cc: Ian Jackson <Ian.Jackson@eu.citrix.com>,
	Ian Campbell <ian.campbell@citrix.com>
Subject: [OSSTEST PATCH 13/13] rump kernel tests: Run xenstore-ls demo
Date: Tue, 15 Jul 2014 16:22:27 +0100	[thread overview]
Message-ID: <1405437747-12753-14-git-send-email-ian.jackson@eu.citrix.com> (raw)
In-Reply-To: <1405437747-12753-1-git-send-email-ian.jackson@eu.citrix.com>

We can use the newly-generalised ts-rumpuserxen-demo-setup to set up
the config file etc. to run xenstore-ls from the xen.git build.

We have a bespoke script to actually execute it: we extract the actual
program output from the guest console log, and compare the results to
those we expect (based on running xenstore-ls in dom0).

Signed-off-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
---
 make-flight                    |    2 +
 sg-run-job                     |    4 ++
 ts-rumpuserxen-demo-xenstorels |  111 ++++++++++++++++++++++++++++++++++++++++
 3 files changed, 117 insertions(+)
 create mode 100755 ts-rumpuserxen-demo-xenstorels

diff --git a/make-flight b/make-flight
index ccfa3e3..b02720f 100755
--- a/make-flight
+++ b/make-flight
@@ -125,6 +125,8 @@ do_rumpkernel_tests () {
             guests_rumpuserxenbuildjob=build-$rumparch-rumpuserxen   \
             rump_builtimage=rumpuserxen:/usr/local/lib/xen/rump-kernel \
             rump_cmdline=3                                           \
+            xenstorels_builtimage=:/usr/local/bin/xenstore           \
+            xenstorels_cmdline='ls -fp device'                       \
             all_hostflags=$most_hostflags
 }
 
diff --git a/sg-run-job b/sg-run-job
index ab9f333..2cf810a 100755
--- a/sg-run-job
+++ b/sg-run-job
@@ -315,6 +315,10 @@ proc run-job/test-rumpuserxen {} {
     run-ts . =   ts-rumpuserxen-demo-setup + host $g
     run-ts . =   ts-guest-start            + host $g
     run-ts . =   ts-guest-destroy          + host $g
+    set g xenstorels
+    run-ts . =   ts-rumpuserxen-demo-setup      + host + $g
+    run-ts . =   ts-rumpuserxen-demo-xenstorels + host + $g
+    run-ts . =   ts-guest-destroy-hard          + host + $g
 }
 
 #---------- builds ----------
diff --git a/ts-rumpuserxen-demo-xenstorels b/ts-rumpuserxen-demo-xenstorels
new file mode 100755
index 0000000..07388a4
--- /dev/null
+++ b/ts-rumpuserxen-demo-xenstorels
@@ -0,0 +1,111 @@
+#!/usr/bin/perl -w
+# 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/>.
+
+use strict qw(vars);
+use DBI;
+use Osstest;
+use Osstest::TestSupport;
+use Data::Dumper;
+
+tsreadconfig();
+
+our ($ho,$gho) = ts_get_host_guest(@ARGV);
+
+our $domid;
+
+our $gn = $gho->{Guest};
+
+sub start () {
+    my $cmd= toolstack()->{Command}." create ".
+        $r{ $gho->{Guest}.'_'. toolstack()->{CfgPathVar} };
+    target_cmd_root($ho, $cmd, 30);
+
+    $domid = target_cmd_output_root($ho,"xl domid $gho->{Guest}");
+}
+
+sub await_end () {
+    poll_loop(30,3, "await ending of $gho->{Guest}", sub {
+        my $st= guest_get_state($ho,$gho);
+	return undef if $st =~ m/s/;
+        return "guest state is $st";
+    });
+}
+
+our (%file);
+our (%output);
+
+sub stash ($$) {
+    my ($data, $what) = @_;
+    my $leaf = "xenstore-ls-device--$gn--$what";
+    my $stashh = open_unique_stashfile(\$leaf);
+    print $stashh $data or die $!;
+    close $stashh or die $!;
+    $file{$what} = "$stash/$leaf";
+}
+
+sub some_xenstorels ($$$) {
+    my ($what, $massage, $cmd) = @_;
+    $output{$what} = target_cmd_output_root($ho,$cmd);
+    stash($output{$what}, "$what-raw");
+    $massage->();
+    $output{$what} = join "\n", sort split /\n/, $output{$what};
+    $output{$what} .= "\n";
+    stash($output{$what}, "$what-massaged");
+}
+
+sub our_xenstorels () {
+    some_xenstorels('ours', sub {
+	$output{ours} =~ s{^/local/domain/$domid/}{}gm;
+    }, <<END);
+        xenstore-ls -fp /local/domain/$domid/device
+END
+}
+
+sub their_xenstorels () {
+    some_xenstorels('theirs', sub {
+	$output{theirs} =~ s{\r\n}{\n}g;
+	while ($output{theirs} =~ m{\n=== calling main\(\) ===\n\n}) {
+	    $output{theirs} = $'; #';
+	}
+	$output{theirs} =~ m{\n=== main\(\) returned (\d+) ===\n} or die;
+	$output{theirs} = $`;
+	die "$1 ?" if $1 ne '0';
+	$output{theirs} =~ s{^STUB \`\`\w+'' called\n}{}mg;
+    }, <<END);
+        cat /var/log/xen/console/guest-$gn.log
+END
+}
+
+sub check_output () {
+    eval {
+	our_xenstorels();
+	their_xenstorels();
+	1;
+    };
+    if ($@) {
+	die Dumper(\%output)."$@";
+    }
+    if ($output{ours} ne $output{theirs}) {
+	system qw(diff -u), map { $file{"$_-massaged"} } qw(ours theirs);
+	die "$? COMPARISON FAILED";
+    }
+}
+
+start();
+await_end();
+check_output();
+logm("all good.");
-- 
1.7.10.4

  parent reply	other threads:[~2014-07-15 15:22 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-07-15 15:22 [OSSTEST PATCH 00/13] Build and test rump kernel xenstore-ls Ian Jackson
2014-07-15 15:22 ` [OSSTEST PATCH 01/13] selectguest: log a message Ian Jackson
2014-07-15 15:22 ` [OSSTEST PATCH 02/13] BuildSupport: make selectbuildhost modify @ARGV Ian Jackson
2014-07-15 15:22 ` [OSSTEST PATCH 03/13] sg-run-job: Support toggling `adding' by repeating `+' Ian Jackson
2014-07-16  9:17   ` Ian Campbell
2014-07-15 15:22 ` [OSSTEST PATCH 04/13] building: Delete when cloning, not when preparing $builddir Ian Jackson
2014-07-16  9:19   ` Ian Campbell
2014-07-16  9:58     ` Ian Jackson
2014-07-16 10:06       ` Ian Campbell
2014-07-16 10:18         ` Ian Jackson
2014-07-16 10:20           ` Ian Campbell
2014-07-16 10:29             ` Ian Jackson
2014-07-16 11:25               ` Ian Campbell
2014-07-15 15:22 ` [OSSTEST PATCH 05/13] make-flight: rumpuserxen tests: use same buildjob for all guests Ian Jackson
2014-07-16  9:19   ` Ian Campbell
2014-07-16 10:10     ` Ian Jackson
2014-07-15 15:22 ` [OSSTEST PATCH 06/13] ts-xen-build: Allow specification of make targets Ian Jackson
2014-07-15 15:22 ` [OSSTEST PATCH 07/13] ts-xen-build: Honour cmdprefix_configure, cmdprefix_make Ian Jackson
2014-07-15 15:22 ` [OSSTEST PATCH 08/13] rump kernel tests: Do a xen.git tools build Ian Jackson
2014-07-15 15:22 ` [OSSTEST PATCH 09/13] rump kernel tests: Use guest-specific fs images location Ian Jackson
2014-07-15 15:22 ` [OSSTEST PATCH 10/13] rump kernel tests: Specify kernel via runvar Ian Jackson
2014-07-15 15:22 ` [OSSTEST PATCH 11/13] rump kernel tests: Specify cmdline " Ian Jackson
2014-07-15 15:22 ` [OSSTEST PATCH 12/13] ts-guest-destroy-hard: New script Ian Jackson
2014-07-16  9:24   ` Ian Campbell
2014-07-16 10:10     ` Ian Jackson
2014-07-16 10:12       ` Ian Campbell
2014-07-16 10:20         ` Ian Jackson
2014-07-16 10:21           ` Ian Campbell
2014-07-16 10:30             ` Ian Jackson
2014-07-15 15:22 ` Ian Jackson [this message]
2014-07-16  9:26   ` [OSSTEST PATCH 13/13] rump kernel tests: Run xenstore-ls demo Ian Campbell
2014-07-16 10:15     ` Ian Jackson
2014-07-16 10:17       ` Ian Campbell
2014-07-16  9:26 ` [OSSTEST PATCH 00/13] Build and test rump kernel xenstore-ls 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=1405437747-12753-14-git-send-email-ian.jackson@eu.citrix.com \
    --to=ian.jackson@eu.citrix.com \
    --cc=ian.campbell@citrix.com \
    --cc=xen-devel@lists.xenproject.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).