Fix rump kernel tests
cover Fix rump kernel tests
With these 16 patches, we complete osstest's adaptation to the modern rumprun-based way of setting up and running rump kernel programs.
We replace the old networking test (based on the WOPR example, now removed from rump upstream) with our own test program. The net test should start working right away.
The xenstore-ls test has been broken by bitrot in the rumprun tree. It requires a corresponding rumprun patch series, which I am about to feed as a pull request to rumprun upstream.
The longstanding low-probability scheduler lockup bug remains outstanding.
Ian.
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
PATCH 1/16 rump-test-net: New test program
The rump kernel WOPR test is no more, so we reimplement it. This test program simply listens on a TCP socket and says hi when you connect to it. It's a portable program. So far, this has been tested on Linux, but not in the rump environment.
--- rump-test-net.c | 65 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 65 insertions(+) create mode 100644 rump-test-net.c
rump-test-net.c new file +65 -0
@@ -0,0 +1,65 @@ +/* +*/ + +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <unistd.h> +#include <assert.h> +#include <sys/socket.h> +#include <netinet/in.h> +#include <sys/fcntl.h> + +static int master; + +int main (int argc,const char *const *argv) { +struct sockaddr_in6 sin6; +int r; + +assert (argc==2 ); + + master =socket (AF_INET6 ,SOCK_STREAM ,0 ); +if (master<0 ) {perror ("socket" );exit (-1 ); } + +int port =atoi (argv[1 ]); + +memset (&sin6,0 ,sizeof (sin6)); + sin6.sin6_family =AF_INET6 ; + sin6.sin6_port =htons (port); + sin6.sin6_addr = in6addr_any; + + r =bind (master,(struct sockaddr *)&sin6,sizeof (sin6)); +if (r) {perror ("bind" );exit (-1 ); } + + r =listen (master,5 ); +if (r) {perror ("listen" );exit (-1 ); } + +fprintf (stderr,"listening on %d\n" ,port); + +int slave =-1 ; +for (;;) { +static const char message[] ="hello\r\n" ; +static const int messagel =sizeof (message)-1 ; + +if (slave >0 )close (slave); + + slave =accept (master,0 ,0 ); +if (slave <0 ) {perror ("accept" );continue ; } + + r =fcntl (slave,F_GETFL ); +if (r <0 ) {perror ("F_GETFL" );continue ; } + r =fcntl (slave,F_SETFL , r |O_NONBLOCK ); +if (r <0 ) {perror ("F_SETFL" );continue ; } + + r =write (slave, message, messagel); +if (r <0 ) {perror ("write" );continue ; } +else if (r != messagel) { +fprintf (stderr,"write: %d (!= %d" ,r,messagel); +continue ; + } + + r =close (slave); + slave =-1 ; +if (r <0 ) {perror ("close" );continue ; } + } +}
Signature · 7 lines
2.1.4 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xen.org/xen-devel
PATCH 2/16 rump-test-net: setsockopt V6ONLY off
In reply to Ian JacksonNetBSD (unlike Linux) has the V6ONLY socket option turned on by default. So to work in the rump kernel environment when tested with IPv4 we need to adjust this setting.
--- rump-test-net.c | 4 ++++ 1 file changed, 4 insertions(+)
rump-test-net.c +4 -0
@@ -21,6 +21,10 @@ int main(int argc, const char *const *argv) { master =socket (AF_INET6 ,SOCK_STREAM ,0 );if (master<0 ) {perror ("socket" );exit (-1 ); } +int no =0 ; + r =setsockopt (master,IPPROTO_IPV6 ,IPV6_V6ONLY , (void *)&no,sizeof (no)); +if (r<0 ) {perror ("IPV6_V6ONLY" );exit (-1 ); } +int port =atoi (argv[1 ]);memset (&sin6,0 ,sizeof (sin6));
Signature · 7 lines
2.1.4 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xen.org/xen-devel
PATCH 3/16 BuildSupport: builddirsprops: Clean up each builddir
In reply to Ian JacksonThis makes prepbuilddirs work if it is run a second time for the same builddirs, which is useful for ad-hoc testing.
--- Osstest/BuildSupport.pm | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
Osstest/BuildSupport.pm +2 -1
@@ -91,7 +91,8 @@ sub builddirsprops { sub prepbuilddirs { my (@xbuilddirs) = @_; my $cmd = "mkdir -p $builddir && rm -rf $builddir/*-stamp $builddir/dist"; - $cmd .= " && mkdir $builddir/$_" foreach @xbuilddirs; + $cmd .= " && rm -rf $builddir/$_ && mkdir $builddir/$_" + foreach @xbuilddirs; target_cmd($ho,$cmd,600); }
Signature · 7 lines
2.1.4 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xen.org/xen-devel
PATCH 4/16 Support guest-specific "toolstack" for guest creation
In reply to Ian JacksonSome guests need creation in a special way. For example, rump kernels are ideally started with rumprun. Honour a guest var which specifies a toolstack name.
Osstest::TestSupport::toolstack now takes an optional $gho so it can do this lookup when appropriate.
After creation the guest is necessarily managed with the toolstack for the host, so we honour this (ie we pass the $gho) only for create.
--- Osstest/TestSupport.pm | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-)
Osstest/TestSupport.pm +9 -6
@@ -1583,7 +1583,7 @@ sub guest_create ($) { my ($gho) = @_; my $ho = $gho->{Host}; guest_prepare_disk($gho); - toolstack($ho)->create($gho); + toolstack($ho,$gho)->create($gho); } sub guest_prepare_disk ($) {
@@ -2257,13 +2257,16 @@ sub guest_vncsnapshot_stash ($$$$) { target_getfile_root($ho,100, "$rfile", "$stash/$leaf"); } -sub toolstack ($) { - my ($ho) = @_; - return $ho->{_Toolstack} if $ho->{_Toolstack}; +sub toolstack ($;$) { + my ($ho,$gho) = @_; + + my $cache = $gho || $ho; + return $cache->{_Toolstack} if $cache->{_Toolstack}; my $tsname= $r{toolstack} || 'xend'; - $ho->{_Toolstack}= get_host_method_object($ho, 'Toolstack', $tsname); - return $ho->{_Toolstack}; + $tsname= guest_var($gho, 'toolstack', $tsname) if $gho; + $cache->{_Toolstack} = get_host_method_object($ho, 'Toolstack', $tsname); + return $cache->{_Toolstack}; } sub authorized_keys () {
Signature · 7 lines
2.1.4 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xen.org/xen-devel
PATCH 5/16 rump kernels: Provide rumprun toolstack
In reply to Ian JacksonThis is suitable as a guest-specific toolstack: it defers to xl for everything other than guest creation.
--- Osstest/Toolstack/rumprun.pm | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 Osstest/Toolstack/rumprun.pm
Osstest/Toolstack/rumprun.pm new file +33 -0
@@ -0,0 +1,33 @@ +# This is part of "osstest", an automated testing framework for Xen. +# Copyright (C) 2014 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/>. + + +package Osstest::Toolstack::rumprun; + +use strict; +use warnings; + +use Osstest::RumpRun; + +# Defer to xl driver for most things +use parent qw(Osstest::Toolstack::xl); + +sub create ($$) { + my ($self,$gho) = @_; + rumprun_guest_create($gho); +} + +1;
Signature · 7 lines
2.1.4 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xen.org/xen-devel
PATCH 6/16 rump kernels: Specify toolstack for rumprun demo to be rumprun
In reply to Ian JacksonThis causes ts-guest-start to use rumprun, rather than xl.
--- ts-rumprun-demo-setup | 1 + 1 file changed, 1 insertion(+)
ts-rumprun-demo-setup +1 -0
@@ -47,6 +47,7 @@ sub prep () { my $imagepath = $rkdist.'/'.$builtimage_subpath; store_runvar("${gn}_imagepath", $imagepath); + store_runvar("${gn}_toolstack", 'rumprun'); } prep();
Signature · 7 lines
2.1.4 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xen.org/xen-devel
PATCH 7/16 rump kernels: ts-rumprun-bake: Do not tolerate errors
In reply to Ian JacksonIf we skip due to missing the input pieces, make the warning noiser.
If we think we have all the input pieces, bomb out if they don't seem to contain the right bits, or if rumpbake fails.
--- ts-rumprun-bake | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-)
ts-rumprun-bake +5 -7
@@ -61,15 +61,14 @@ sub bakeimage ($$) { ($ho, "rumpbake-n-$name", $execpart, $buildjob || $job); }; if ($@) { - warn "skipping: $@"; + logm "*** WARNING: skipping $name: $@"; return; } my $execfile = $execdist.$execpath; target_cmd_build($ho, 1000, $imagesdir, <<END); - if test -f $execfile; then - $rumpbake xen_pv $name $execfile - fi + ls -al $execfile + $rumpbake xen_pv $name $execfile END }
@@ -81,9 +80,8 @@ while (@ARGV) { die unless @ARGV>=2; my $name = shift @ARGV; my $rumpexec = shift @ARGV; - eval { - bakeimage($name,$rumpexec); - }; + + bakeimage($name,$rumpexec); } stash();
Signature · 7 lines
2.1.4 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xen.org/xen-devel
PATCH 8/16 rump kernels: Provide proper DHCP instructions to rumprun
In reply to Ian JacksonOtherwise we just get an unconfigured network interface. (Requesting DHCP used to be implicit.)
--- Osstest/RumpRun.pm | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
Osstest/RumpRun.pm +2 -1
@@ -57,7 +57,8 @@ sub rumprun_guest_create ($) { my $cmd = "$rumprun xen"; $cmd .= " -N $gn"; - $cmd .= " -IIFTAG,IFBASENAME,mac=$gho->{Ether}"; + $cmd .= " -I xenif0,xenif,mac=$gho->{Ether}"; + $cmd .= " -W xenif0,inet,dhcp"; $cmd .= " $imagepath"; $cmd .= " $cmdline";
Signature · 7 lines
2.1.4 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xen.org/xen-devel
PATCH 9/16 rump kernels: Provide networking test
In reply to Ian JacksonIntroduce our own version of `nc -e echo', to replace the removed rump kernel WOPR test (which we were using to check that networking worked).
This test program works when compiled on Linux too.
--- make-flight | 4 ++-- sg-run-job | 6 +++++ ts-rumprun-demo-build | 66 +++++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 74 insertions(+), 2 deletions(-) create mode 100755 ts-rumprun-demo-build
make-flight +2 -2
@@ -219,8 +219,8 @@ do_rumpkernel_tests () { test-rumprun xl \ $xenarch $dom0arch \ guests_rumprunbuildjob=build-$rumparch-rumprun \ - rump_builtimage=rumprun:/usr/local/lib/xen/rump-kernel/rump-kernel \ - rump_cmdline=3 \ + nettest_builtimage=rumpimages:nettest \ + nettest_cmdline=4096 \ xenstorels_builtimage=rumpimages:xenstorels \ xenstorels_cmdline='ls -fp device' \ all_hostflags=$most_hostflags
sg-run-job +6 -0
@@ -460,6 +460,10 @@ proc test-guest-nomigr {g} { proc need-hosts/test-rumprun {} { return host } proc run-job/test-rumprun {} { + set g nettest + run-ts . = ts-rumprun-demo-setup + host $g + run-ts . = ts-guest-start + host $g + run-ts . = ts-guest-destroy + host $g set g xenstorels run-ts . = ts-rumprun-demo-setup + host + $g run-ts . = ts-rumprun-demo-xenstorels + host + $g
@@ -495,8 +499,10 @@ proc run-job/build-libvirt {} { proc run-job/build-rumprun {} { run-ts . = ts-rumprun-build + run-ts . = ts-rumprun-demo-build + host + nettest rump-test-net run-ts . = ts-xen-build + host --no-kconfig tools run-ts . = ts-rumprun-bake + host \ + nettest :nettest:/rump-test-net \ xenstorels ::/usr/local/bin/xenstore-ls }
ts-rumprun-demo-build new file +66 -0
66 lines not on this page · raw message
Signature · 7 lines
2.1.4 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xen.org/xen-devel
PATCH 10/16 TestSupport: guest_unprepare_disk: Make a no-op for guests with no Lvdev
In reply to Ian JacksonThis includes some rump kernel tests.
--- Osstest/TestSupport.pm | 1 + 1 file changed, 1 insertion(+)
Osstest/TestSupport.pm +1 -0
@@ -1601,6 +1601,7 @@ END sub guest_unprepare_disk ($) { my ($gho) = @_; + return unless defined $gho->{Lvdev}; return if $gho->{Diskfmt} eq "none"; target_cmd_root($gho->{Host}, <<END); umount $gho->{Lvdev} || :
Signature · 7 lines
2.1.4 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xen.org/xen-devel
PATCH 11/16 rumprun: xenstorels: Better new regexps for finding output
In reply to Ian JacksonThere is no need to match the _exit. We can match the main return as before, provided we tolerate the way it now says
main() of "program" returned 0
This is an update to ea13503bc853 "rumprun: xenstorels: New regexps for finding output" (which was insufficient to get the xenstorels test to pass).
--- ts-rumprun-demo-xenstorels | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
ts-rumprun-demo-xenstorels +1 -2
@@ -80,8 +80,7 @@ sub their_xenstorels () { while ($output{theirs} =~ m{\n=== calling ".*" main\(\) ===\n\n}) { $output{theirs} = $'; #'; } - $output{theirs} =~ m{\n=== main\(\) returned (\d+) ===\n} or - $output{theirs} =~ m{\n=== ERROR: _exit\((\d+)\) called ===\n} or die; + $output{theirs} =~ m{\n=== main\(\) .* returned (\d+) ===\n} or die; $output{theirs} = $`; die "EXIT STATUS $1 ?" if $1 ne '0'; $output{theirs} =~ s{^STUB \`\`\w+'' called\n}{}mg;
Signature · 7 lines
2.1.4 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xen.org/xen-devel
PATCH 12/16 rumprun: Disable unwanted builds
In reply to Ian Jackson--- make-flight | 8 ++++++++ 1 file changed, 8 insertions(+)
make-flight +8 -0
@@ -83,6 +83,14 @@ job_create_build_filter_callback () { *) return 1 ;; esac ;; + rumprun) + case "$job" in + build-*-pvops) ;; + build-*-rumprun) ;; + build-*-*) return 1 ;; + *) ;; + esac + ;; esac return 0 }
Signature · 7 lines
2.1.4 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xen.org/xen-devel
PATCH 13/16 rump kernels: Adjust indentation in run-job/test-rumprun
In reply to Ian JacksonWhitespace change only.
--- sg-run-job | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
sg-run-job +5 -5
@@ -461,16 +461,16 @@ proc test-guest-nomigr {g} { proc need-hosts/test-rumprun {} { return host } proc run-job/test-rumprun {} { set g nettest - run-ts . = ts-rumprun-demo-setup + host $g - run-ts . = ts-guest-start + host $g - run-ts . = ts-guest-destroy + host $g + run-ts . = ts-rumprun-demo-setup + host $g + run-ts . = ts-guest-start + host $g + run-ts . = ts-guest-destroy + host $g set g xenstorels run-ts . = ts-rumprun-demo-setup + host + $g run-ts . = ts-rumprun-demo-xenstorels + host + $g - run-ts . = ts-guest-destroy-hard + host + $g + run-ts . = ts-guest-destroy-hard + host + $g repeat-ts 150 =.repeat \ ts-rumprun-demo-xenstorels + host + $g + \; \ - ts-guest-destroy-hard host $g + + ts-guest-destroy-hard host $g + } if {[file exists sg-run-job-adhoc]} {
Signature · 7 lines
2.1.4 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xen.org/xen-devel
PATCH 14/16 rump kernels: Install binutils on test box
In reply to Ian JacksonThe rumprun' tool needs readelf' which is in binutils.
This introduces a new test step, which is idempotent.
--- sg-run-job | 1 + ts-rumprun-test-prep | 36 ++++++++++++++++++++++++++++++++++++ 2 files changed, 37 insertions(+) create mode 100755 ts-rumprun-test-prep
sg-run-job +1 -0
@@ -460,6 +460,7 @@ proc test-guest-nomigr {g} { proc need-hosts/test-rumprun {} { return host } proc run-job/test-rumprun {} { + run-ts . = ts-rumprun-test-prep + host set g nettest run-ts . = ts-rumprun-demo-setup + host $g run-ts . = ts-guest-start + host $g
ts-rumprun-test-prep new file +36 -0
@@ -0,0 +1,36 @@ +#!/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 POSIX; +use Osstest::TestSupport; +use Osstest::Debian; + +tsreadconfig(); + +our ($whhost) = @ARGV; +$whhost ||= 'host'; +our $ho= selecthost($whhost); + +sub packages () { + target_install_packages($ho, + qw(binutils)); +} + +packages();
Signature · 7 lines
2.1.4 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xen.org/xen-devel
PATCH 15/16 make-flight: Honour $bfi (build flight) for rump tests
In reply to Ian JacksonA quick search suggests there are other a similar bugs...
--- make-flight | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
make-flight +1 -1
@@ -226,7 +226,7 @@ do_rumpkernel_tests () { job_create_test test-$xenarch$kern-$dom0arch-rumprun-$rumparch \ test-rumprun xl \ $xenarch $dom0arch \ - guests_rumprunbuildjob=build-$rumparch-rumprun \ + guests_rumprunbuildjob=${bfi}build-$rumparch-rumprun \ nettest_builtimage=rumpimages:nettest \ nettest_cmdline=4096 \ xenstorels_builtimage=rumpimages:xenstorels \
Signature · 7 lines
2.1.4 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xen.org/xen-devel
PATCH 16/16 rump kernels: Build with RUMP_DEV_XEN_DEBUG and filter out debug messages
In reply to Ian Jackson--- ts-rumprun-build | 5 ++++- ts-rumprun-demo-xenstorels | 2 ++ 2 files changed, 6 insertions(+), 1 deletion(-)
ts-rumprun-build +4 -1
@@ -44,7 +44,10 @@ sub massage() { } sub build() { - target_cmd_build($ho, 7200, $rux, <<END); + my $debug_build = $r{rumprun_build_debug} || 'y'; + target_cmd_build($ho, 7200, $rux, ($debug_build ? <<END : ''). <<END); + export RUMP_DEV_XEN_DEBUG=1 +END export XEN_HEADERS=$xendist/usr/local/include/xen (./build-rr.sh xen && touch ../build-ok-stamp) |tee ../log test -f ../build-ok-stamp #/
ts-rumprun-demo-xenstorels +2 -0
@@ -84,6 +84,8 @@ sub their_xenstorels () { $output{theirs} = $`; die "EXIT STATUS $1 ?" if $1 ne '0'; $output{theirs} =~ s{^STUB \`\`\w+'' called\n}{}mg; + $output{theirs} =~ s{^/dev/xen/xenbus[:[].*\n}{}mg; + $output{theirs} =~ s{^xen devsw:.*\n}{}mg; }, <<END); cat /var/log/xen/console/guest-$gn.log END
Signature · 7 lines
2.1.4 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xen.org/xen-devel