Skip to contentSkip to conversation

livepatch test support

PATCH In review Ian Jackson 2 participants 17 messages Jun 7, 2017 – Jun 11, 2017

lore
Share & tools
lore
#1 lore raw

PATCH v4 1/11 TestSupport: target_cmd_root_status: New sub which returns return code.

In reply to Ian Jackson

From: Konrad Rzeszutek Wilk <[email protected]>

All the different target_cmd_* end up calling tcmdex which has the unfortunate side-effect of calling 'die' if the SSH sessions results in any return code not zero.

That is fine, except for tests where we want to get a non-zero return value.

This patch adds the $badstatusok to tcmdex - and makes all the existing callers pass in the value of zero to it. This way the commands behave the normal old way.
to all the other functions which use tcmdex.

The only exposed function that does it differently is target_cmd_root_status.

---
v1: New submission
v2: Change to target_cmd_root_status
Continue doing the 'die' in tcmdex, but only if $badstatusok is zero. Plumb the $badstatusok through to tcmd.
v3: Removed the extra space in tcmdex
Added Ian's Ack
v4: Edited commit message a bit

---
 Osstest/TestSupport.pm | 23 +++++++++++++----------
 1 file changed, 13 insertions(+), 10 deletions(-)
Osstest/TestSupport.pm +13 -10
index c23ac13..c36dc76 100644
@@ -52,6 +52,7 @@ BEGIN {
                       unique_incrementing_runvar next_unique_name
                       stashfilecontents
 
+                      target_cmd_root_status
                       target_cmd_root target_cmd target_cmd_build
                       target_cmd_output_root target_cmd_output
                       target_cmd_inputfh_root sshuho
@@ -441,20 +442,21 @@ sub sshopts () {
 }
 
 sub tcmdex {
-    my ($timeout,$stdin,$stdout,$cmd,$optsref,@args) = @_;
+    my ($timeout,$stdin,$stdout,$badstatusok,$cmd,$optsref,@args) = @_;
     logm("executing $cmd ... @args");
     # We use timeout(1) as a backstop, in case $cmd doesn't die.  We
     # need $cmd to die because we won't release the resources we own
     # until all of our children are dead.
     my $r= cmd($timeout,$stdin,$stdout,
 	       'timeout',$timeout+30, $cmd,@$optsref,@args);
+    return $r if $badstatusok;
     $r and die "status $r";
 }
 
 sub tgetfileex {
     my ($ruser, $ho,$timeout, $rsrc,$ldst) = @_;
     unlink $ldst or $!==&ENOENT or die "$ldst $!";
-    tcmdex($timeout,undef,undef,
+    tcmdex($timeout,undef,undef, 0,
            'scp', sshopts(),
            sshuho($ruser,$ho).":$rsrc", $ldst);
 } 
@@ -471,12 +473,12 @@ sub tputfileex {
     my ($ruser, $ho,$timeout, $lsrc,$rdst, $rsync) = @_;
     my @args= ($lsrc, sshuho($ruser,$ho).":$rdst");
     if (!defined $rsync) {
-        tcmdex($timeout,undef,undef,
+        tcmdex($timeout,undef,undef, 0,
                'scp', sshopts(),
                @args);
     } else {
         unshift @args, $rsync if length $rsync;
-        tcmdex($timeout,undef,undef,
+        tcmdex($timeout,undef,undef, 0,
                'rsync', [ '-e', 'ssh '.join(' ',@{ sshopts() }) ],
                @args);
     }
@@ -682,20 +684,21 @@ sub target_await_down ($$) {
 }    
 
 sub tcmd { # $tcmd will be put between '' but not escaped
-    my ($stdin,$stdout,$user,$ho,$tcmd,$timeout,$extrasshopts) = @_;
+    my ($stdin,$stdout,$badstatusok,$user,$ho,$tcmd,$timeout,$extrasshopts) = @_;
     $timeout=30 if !defined $timeout;
     target_adjust_timeout($ho,\$timeout);
     $tcmd = ' ' if $tcmd eq ''; # ssh host '' logs in !
-    tcmdex($timeout,$stdin,$stdout,
+    tcmdex($timeout,$stdin,$stdout, $badstatusok,
            'ssh', sshopts(), @{ $extrasshopts || [] },
            sshuho($user,$ho), $tcmd);
 }
-sub target_cmd ($$;$$) { tcmd(undef,undef,'osstest',@_); }
-sub target_cmd_root ($$;$$) { tcmd(undef,undef,'root',@_); }
+sub target_cmd ($$;$$) { tcmd(undef,undef,0, 'osstest',@_); }
+sub target_cmd_root ($$;$$) { tcmd(undef,undef,0, 'root',@_); }
+sub target_cmd_root_status ($$;$$) { tcmd(undef,undef,1, 'root',@_); }
 
 sub tcmdout {
     my $stdout= IO::File::new_tmpfile();
-    tcmd(undef,$stdout,@_);
+    tcmd(undef,$stdout,0,@_);
     $stdout->seek(0,0) or die "$stdout $!";
     my $r;
     { local ($/) = undef;
@@ -710,7 +713,7 @@ sub target_cmd_output_root ($$;$) { tcmdout('root',@_); }
 
 sub target_cmd_inputfh_root ($$$;$$) {
     my ($tho,$stdinfh,$tcmd,@rest) = @_;
-    tcmd($stdinfh,undef,'root',$tho,$tcmd,@rest);
+    tcmd($stdinfh,undef,0,'root',$tho,$tcmd,@rest);
 }
 
 sub poll_loop ($$$&) {
Signature · 7 lines
2.1.4


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
#0 lore raw

v4 cover livepatch test support

Thanks to Konrad, who passed me his git branch under the table. I have tidied up some loose ends, and tested it with my xen.git Makefile patches.

Konrad, would you please take a look at this to make sure you don't think I've broken anything and that my changes look sane ? In particlar the patches I have marked with `#' below.

 m  01   TestSupport: target_cmd_root_status: New sub which returns return code.
 -  02   TestSupport: target_cmd_*: Add some doc comments
 -  03   TestSupport: target_cmd_output_root_status: New sub
 *# 04   mfi-common: Add an enable_livepatch runvar to the Xen build jobs
 *# 05   ts-xen-build: Build livepatches test-cases
 -  06   ts-livepatch: Initial test-cases.
 -  07   sg-run-job: Add the test-livepatch.
 m  08   make-flight: Add livepatch build/test target in the matrix.
 *# 09   PDU/lab: Similar to xenuse
 +  10   cs-adjust-flight: Rework runvar-build-set new value handling
 +  11   sg-check-tested: Provide --flight option

Key:

 m   Changed only the commit message
 -   Very minor changes
 *   Actual changes
 +   Added patch (not really related, TBH)
  #  Konrad, please review this! 

(All compared to Konrad's v3)

Thanks,
Ian.

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel

#5 lore raw

PATCH v4 5/11 ts-xen-build: Build livepatches test-cases

From: Konrad Rzeszutek Wilk <[email protected]>

Livepatch compiles and works on x86/ARM{32|64} so we can enable it in the Xen config when requested by the enable_livepatch runvar.

When we are trying to build with enable_livepatch, run `make dist-tests' as well, to ship the test cases. This depends on a corresponding change to xen.git.

Finally, split the livepatch tests into their own stashed deliverable from this job.

---
v1: New posting
v2: Put the livepatch test-cases in xentlpdist.tar.gz file
v3: Use enable_livepatch to gate the build and tarring the test-cases.
v4: Call `make dist-tests' rather than calling directly deep
into the xen.git build system.
Split the output ourselves in `divide' (since make dist-tests
puts things into dist/install/.)
Expect the livepath output in DESTDIR/usr/lib/debug/xen-livepatch
rather than directly in DESTDIR/usr/lib/debug.
Minor style fix.
Rewrote the commit message.

---
 ts-xen-build | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)
ts-xen-build +21 -0
index 31acb9d..eaf44b1 100755
@@ -51,6 +51,7 @@ $dashdashdash //= -1;
 builddirsprops();
 
 my $enable_xsm = ($r{enable_xsm}//'false') =~ m/true/ ? 1 : 0;
+my $enable_livepatch = ($r{enable_livepatch}//'false') =~ m/true/ ? 1 : 0;
 
 $buildcmd_global_prefix= <<END;
     export XEN_CONFIG_EXPERT=y
@@ -95,6 +96,12 @@ sub checkout () {
 	echo >>.config LIBLEAFDIR_x86_64=lib
 	echo >>.config KERNELS=''
 END
+               (${enable_livepatch} ? <<END : '').
+	if test -f xen/Kconfig; then
+		echo >>xen/.config CONFIG_LIVEPATCH=y
+		echo >>xen/.config CONFIG_FAST_SYMBOL_LOOKUP=y
+    fi
+END
                (nonempty($r{enable_xsm}) ? <<END : '').
 	if test -f xen/Kconfig; then
 		echo >>xen/.config CONFIG_XSM='${build_xsm}'
@@ -164,6 +171,12 @@ END
 END
 	store_runvar("flaskpolicy", "xenpolicy-" . $xen_version);
     }
+
+    if ($enable_livepatch) {
+        buildcmd_stamped_logged(600, 'xen', 'xenlpt', '',<<END,'')
+            $make_prefix make $makeflags dist-tests
+END
+    }
 }
 
 sub divide () {
@@ -193,6 +206,12 @@ sub divide () {
                 mv \$mvfiles xeninstall/boot/.
             fi
         fi
+        lp=usr/lib/debug/xen-livepatch
+        mkdir -p xenlpt/\$lp
+        if test -d install/\$lp; then
+            mvfiles=`find install/\$lp '(' -name 'xen-syms*' -o -name '*.map' -o -name '*.livepatch' ')' -print`
+            mv \$mvfiles xenlpt/\$lp/.
+        fi
 	if test -d install/usr/lib64/efi/; then
             if test -f install/usr/lib64/efi/xen.efi; then
                 mkdir -p xeninstall/usr/lib64/efi
@@ -209,6 +228,8 @@ sub stash () {
                     "xen/dist/${part}install",
                     "${part}dist");
     }
+    built_stash($ho, $builddir, "xen/dist/xenlpt", "xenlptdist")
+	if $enable_livepatch;
     built_stash_file($ho, $builddir, "xen-syms", "xen/xen/xen-syms", 1);
     built_stash_file($ho, $builddir, "xen-config", "xen/.config", 1);
     built_stash_file($ho, $builddir, "xen-hv-config", "xen/xen/.config", 1);
Signature · 7 lines
2.1.4


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
#6 lore raw

PATCH v4 6/11 ts-livepatch: Initial test-cases.

In reply to Ian Jackson

From: Konrad Rzeszutek Wilk <[email protected]>

There are 37 of the test-cases in there. Before we run any of them we verify that the payload files are present in /usr/lib/debug.

If so we go through all of the test-cases.

---
v1: Initial submission.
v2: Add ts-livepatch-install
Rename ts-livepatch to ts-livepatch-run
Use target_cmd_root_status instead of target_cmd_root_rc Use target_cmd_output_status as well
Remove tabs, replace with spaces
Use Perl for string matching :-)
Use subroutines for more complex string testing
Use proper style for variable
v4: Expect the livepath output in DESTDIR/usr/lib/debug/xen-livepatch
rather than directly in DESTDIR/usr/lib/debug.
Very minor style changes.

---
 ts-livepatch-install |  37 +++++++++++
 ts-livepatch-run     | 171 +++++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 208 insertions(+)
 create mode 100755 ts-livepatch-install
 create mode 100755 ts-livepatch-run
ts-livepatch-install new file +37 -0
new file mode 100755
index 0000000..d25d482
@@ -0,0 +1,37 @@
+#!/usr/bin/perl -w
+# This is part of "osstest", an automated testing framework for Xen.
+# Copyright (c) 2017 Oracle and/or its affiliates. All rights reserved.
+#
+# 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;
+
+tsreadconfig();
+
+our ($whhost) = @ARGV;
+$whhost ||= 'host';
+
+our $ho= selecthost($whhost);
+
+sub extract () {
+    my %distpath;
+    target_extract_jobdistpath($ho, "xen", "path_xenlptdist",
+            $r{"$ho->{Ident}_xenbuildjob"} // $r{"xenbuildjob"},
+             \%distpath);
+}
+
+extract();
ts-livepatch-run new file +171 -0

171 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
#9 lore raw

PATCH v4 9/11 PDU/lab: Similar to xenuse

In reply to Ian Jackson

From: Konrad Rzeszutek Wilk <[email protected]>

But a bit different. Here is the syntax:

usage: lab [-v] arguments
arguments are: {on|off|reboot|info|clear|pxe} tstXXX
or: pxe tstXXX [baudrate]
or: connect tstXXX [baudrate]
or: speed tstXXX baudrate
or: setpxe tstXXX pxeYYY
or: setmac tstXXX xx:xx:xx:xx:xx:xx
where tstXXX is a system name; e.g. tst180
pxeYYY is a pxeboot directory in pxeboot:/shares/tftpboot/lab/; e.g. pxe-bug6512 xx:xx:xx:xx:xx:xx is a mac address; e.g. 00:e0:81:75:e3:fe baudrate is one of [300, 600, 1200, 2400, 4800, 9600, 19200, 38400] -v for verbose

---
v4: Change config setting names from XenUse* to OracleLab*

---
 Osstest/PDU/lab.pm | 56 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 56 insertions(+)
 create mode 100644 Osstest/PDU/lab.pm
Osstest/PDU/lab.pm new file +56 -0
new file mode 100644
index 0000000..5d95fc9
@@ -0,0 +1,56 @@
+# This is part of "osstest", an automated testing framework for Xen.
+# Copyright (c) 2016 Oracle and/or its affiliates. All rights reserved.
+# 
+# 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::PDU::lab;
+
+use strict;
+use warnings;
+
+use Osstest;
+use Osstest::TestSupport;
+use IO::File;
+
+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) = @_;
+    return bless { Host => $ho }, $class;
+}
+
+sub pdu_power_state {
+    my ($mo, $on) = @_;
+    my $onoff= $on ? "on" : "off";
+    my $lab= $c{OracleLabPath} || "lab";
+    my $user= get_host_property($mo->{Host}, "OracleLabUser", $c{OracleLabUser} || undef);
+
+    (
+	logm("lab overriding \$USER to $user"),
+	local $ENV{USER} = $user
+    ) if $user;
+    system_checked($lab, "$onoff", "$mo->{Host}{Name}");
+}
+
+1;
Signature · 7 lines
2.1.4


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
#11 lore raw

PATCH v4 11/11 sg-check-tested: Provide --flight option

In reply to Ian Jackson

This is mostly useful in ad-hoc situations. For example, it can be usefully used with ./mg-adjust-flight-makexrefs.

---
v4: New patch, which helps with issues I tripped over while trying
to ad-hoc test the livepatch series.

---
 sg-check-tested | 4 ++++
 1 file changed, 4 insertions(+)
sg-check-tested +4 -0
index 3c09aac..a0a2db7 100755
@@ -98,6 +98,10 @@ END
                 AND j.flight = flights.flight
                 AND j.status = 'pass')
 END
+    } elsif (m/^--flight=(.*)$/) {
+	my @flts = split /,/, $1;
+	push @conds_vars, @flts;
+	push @conds, "(".(join " OR ", map { "flight=?" } @flts).")";
     } elsif (m/^--print-revision=(.*)$/) {
         die if $prrev;
         $prrev= $1;
Signature · 7 lines
2.1.4


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
#2 lore raw

PATCH v4 2/11 TestSupport: target_cmd_*: Add some doc comments

In reply to Ian Jackson

---
v4: Split off from the patch introducing target_cmd_output_root_status.
Rewrote all the comments to be true.

---
 Osstest/TestSupport.pm | 11 +++++++++++
 1 file changed, 11 insertions(+)
Osstest/TestSupport.pm +11 -0
index c36dc76..f54962a 100644
@@ -692,8 +692,18 @@ sub tcmd { # $tcmd will be put between '' but not escaped
            'ssh', sshopts(), @{ $extrasshopts || [] },
            sshuho($user,$ho), $tcmd);
 }
+
+# target_cmd[_VARIANT]($ho, $cmd, [ $timeout, \@EXTRASSHOPTS ]);
+#
+# target_cmd executes $cmd with the shell as the osstest user on $ho.
+# stdout goes to our own stdout.  dies if the command exits nonzero.
 sub target_cmd ($$;$$) { tcmd(undef,undef,0, 'osstest',@_); }
+
+# Like target_cmd but as root.
 sub target_cmd_root ($$;$$) { tcmd(undef,undef,0, 'root',@_); }
+
+# Like target_cmd_root, but does not die if the command fails.
+# Instead, returns the wait status (ie, what came in $?)
 sub target_cmd_root_status ($$;$$) { tcmd(undef,undef,1, 'root',@_); }
 
 sub tcmdout {
@@ -708,6 +718,7 @@ sub tcmdout {
     return $r;
 }
 
+# Like target_cmd[_root], but collect the stdout and return it as a string.
 sub target_cmd_output ($$;$) { tcmdout('osstest',@_); }
 sub target_cmd_output_root ($$;$) { tcmdout('root',@_); }
 
Signature · 7 lines
2.1.4


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
#3 lore raw

PATCH v4 3/11 TestSupport: target_cmd_output_root_status: New sub

In reply to Ian Jackson

From: Konrad Rzeszutek Wilk <[email protected]>

Similar to target_cmd_root_status except it outputs both output _and_ status.

---
v2: Initial posting
v3: Sprinkle some comments.
v4: Move doc comments out of this patch (and rewrite them).
Edit commit message.

---
 Osstest/TestSupport.pm | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)
Osstest/TestSupport.pm +10 -4
index f54962a..fc1aa7d 100644
@@ -52,7 +52,7 @@ BEGIN {
                       unique_incrementing_runvar next_unique_name
                       stashfilecontents
 
-                      target_cmd_root_status
+                      target_cmd_root_status target_cmd_output_root_status
                       target_cmd_root target_cmd target_cmd_build
                       target_cmd_output_root target_cmd_output
                       target_cmd_inputfh_root sshuho
@@ -708,19 +708,25 @@ sub target_cmd_root_status ($$;$$) { tcmd(undef,undef,1, 'root',@_); }
 
 sub tcmdout {
     my $stdout= IO::File::new_tmpfile();
-    tcmd(undef,$stdout,0,@_);
+    my $badstatusok = $_[1];
+    my $rc = tcmd(undef,$stdout,@_);
     $stdout->seek(0,0) or die "$stdout $!";
     my $r;
     { local ($/) = undef;
       $r= <$stdout>; }
     die "$stdout $!" if !defined $r or $stdout->error or !close $stdout;
     chomp($r);
+    return ($rc, $r) if $badstatusok;
     return $r;
 }
 
 # Like target_cmd[_root], but collect the stdout and return it as a string.
-sub target_cmd_output ($$;$) { tcmdout('osstest',@_); }
-sub target_cmd_output_root ($$;$) { tcmdout('root',@_); }
+# Like target_cmd[_root], but collects the stdout and returns it as a string.
+sub target_cmd_output ($$;$) { tcmdout(0, 'osstest',@_); }
+sub target_cmd_output_root ($$;$) { tcmdout(0, 'root',@_); }
+
+# Like target_cmd_root_status but returns a tuple ($?, $stdout_data).
+sub target_cmd_output_root_status ($$;$$) { tcmdout(1, 'root',@_); }
 
 sub target_cmd_inputfh_root ($$$;$$) {
     my ($tho,$stdinfh,$tcmd,@rest) = @_;
Signature · 7 lines
2.1.4


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
#7 lore raw

PATCH v4 7/11 sg-run-job: Add the test-livepatch.

In reply to Ian Jackson

From: Konrad Rzeszutek Wilk <[email protected]>

---
v4: Tiny style change.

---
 sg-run-job | 6 ++++++
 1 file changed, 6 insertions(+)
sg-run-job +6 -0
index ceb7980..35bc785 100755
@@ -441,6 +441,12 @@ proc run-job/test-xtf {} {
     run-ts . = ts-xtf-run
 }
 
+proc need-hosts/test-livepatch {} { return host }
+proc run-job/test-livepatch {} {
+    run-ts . = ts-livepatch-install + host
+    run-ts . = ts-livepatch-run     + host
+}
+
 proc test-guest-migr {g} {
     set to_reap [spawn-ts . = ts-migrate-support-check + host $g 1]
     set can_migrate [reap-ts $to_reap]
Signature · 7 lines
2.1.4


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
#8 lore raw

PATCH v4 8/11 make-flight: Add livepatch build/test target in the matrix.

In reply to Ian Jackson

From: Konrad Rzeszutek Wilk <[email protected]>

So we can have "test-amd64-amd64-livepatch" or such.

Changes to the flights are as follows. In these branches:

    osstest
    xen-4.8-testing
    xen-4.9-testing
    xen-unstable
add the new jobs:
    test-amd64-amd64-livepatch
    test-amd64-i386-livepatch
which look a bit like this (test-amd64-amd64-livepatch example):
    all_host_di_version     current
    all_host_suite          jessie
    all_hostflags           arch-amd64,arch-xen-amd64,suite-jessie,purpose-test
    arch                    amd64
    buildjob                build-amd64
    kernbuildjob            build-amd64-pvops
    kernkind                pvops
    toolstack               xl
    xen_boot_append         loglvl=all
    xenbuildjob             build-amd64

Note that we do not add these jobs to xen-unstable-smoke of course, although we did (earlier) turn livepatching for the Xen build configuration in those flights, and try building the livepatch test cases (since those things are cheap).

---
v4: Added flight changes info to the commit message.

---
 make-flight | 12 ++++++++++++
 1 file changed, 12 insertions(+)
make-flight +12 -0
index 7833605..11cc01e 100755
@@ -517,6 +517,17 @@ do_xtf_tests () {
   done
 }
 
+do_livepatch_tests () {
+  if ! branch_wants_livepatch; then
+      return
+  fi
+
+  job_create_test test-$xenarch$kern-$dom0arch-livepatch             \
+       test-livepatch xl $xenarch $dom0arch                          \
+       xen_boot_append='loglvl=all'                                  \
+       all_hostflags=$most_hostflags
+}
+
 do_multivcpu_tests () {
   if [ $xenarch != $dom0arch ]; then
     return
@@ -817,6 +828,7 @@ test_matrix_do_one () {
   do_pvgrub_tests
 
   do_xtf_tests
+  do_livepatch_tests
 }
 
 if [ x$buildflight = x ]; then
Signature · 7 lines
2.1.4


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
#4 lore raw

PATCH v4 4/11 mfi-common: Add an enable_livepatch runvar to the Xen build jobs

In reply to Ian Jackson

From: Konrad Rzeszutek Wilk <[email protected]>

Set it to true on branches that support livepatching (Xen versions 4.9 and higher). Currently nothing reads this variable, so no overall functional change.

Changes to the flights are as follows. On these branches:

        osstest
	xen-4.8-testing
	xen-4.9-testing
	xen-unstable
	xen-unstable-smoke
in these jobs:
	build-amd64    build-amd64-xsm
	build-arm64    build-arm64-xsm
	build-armhf    build-armhf-xsm
	build-i386     build-i386-xsm

add the runvar setting `enable_livepatch=true'.

---
v3: New patch
v4: Regularise branch_wants_livepatch exit status
(shell functions return 0 for true and non-0 for false).
Use the `livepatch_runvars' pattern, so that we do not add
enable_livepatch=false to any jobs.
Enable livepatch testing on osstest branch and disable it
on all other non-Xen branches.
Rewrote commit message.

---
 mfi-common | 25 +++++++++++++++++++++++--
 1 file changed, 23 insertions(+), 2 deletions(-)
mfi-common +23 -2
index ec31e2e..7b1e60c 100644
@@ -76,6 +76,23 @@ branch_wants_xtf_tests () {
   esac
 }
 
+branch_wants_livepatch () {
+  case "$branch" in
+    xen-3.*)    return 1;;
+    xen-4.0*)   return 1;;
+    xen-4.1*)   return 1;;
+    xen-4.2*)   return 1;;
+    xen-4.3*)   return 1;;
+    xen-4.4*)   return 1;;
+    xen-4.5*)   return 1;;
+    xen-4.6*)   return 1;;
+    xen-4.7*)   return 1;;
+    xen-*)      return 0;;
+    osstest*)   return 0;;
+    *)          return 1;;
+  esac
+}
+
 job_create_build () {
   job_create_build_filter_callback "$@" || return 0
 
@@ -104,6 +121,7 @@ create_build_jobs () {
   local want_xend build_defxend build_extraxend
   local enable_ovmf
   local build_hostflags
+  local livepatch_runvars
 
   if [ "x$BUILD_LVEXTEND_MAX" != x ]; then
      BUILD_RUNVARS+=" build_lvextend_max=$BUILD_LVEXTEND_MAX "
@@ -197,6 +215,9 @@ create_build_jobs () {
         fi
     fi
 
+    if branch_wants_livepatch; then
+       livepatch_runvars='enable_livepatch=true'
+    fi
     eval "
         arch_runvars=\"\$ARCH_RUNVARS_$arch\"
     "
@@ -211,7 +232,7 @@ create_build_jobs () {
       fi
       job_create_build build-$arch$xsm_suffix build                          \
                 arch=$arch enable_xend=$build_defxend enable_ovmf=$enable_ovmf\
-                enable_xsm=$enable_xsm                                       \
+                enable_xsm=$enable_xsm $livepatch_runvars		     \
         tree_qemu=$TREE_QEMU                                                 \
         tree_qemuu=$TREE_QEMU_UPSTREAM                                       \
         tree_xen=$TREE_XEN                                                   \
@@ -239,7 +260,7 @@ create_build_jobs () {
         # $REVISION_PREVXEN.
         job_create_build build-$arch-prev build                       \
                     arch=$arch enable_xend=false enable_ovmf=$enable_prevovmf\
-                    enable_xsm=false                                         \
+                    enable_xsm=false $livepatch_runvars                      \
             tree_xen=$TREE_XEN                                               \
                     $RUNVARS $BUILD_RUNVARS $BUILD_XEN_RUNVARS $arch_runvars \
                     $hostos_runvars                                          \
Signature · 7 lines
2.1.4


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
#10 lore raw

PATCH v4 10/11 cs-adjust-flight: Rework runvar-build-set new value handling

In reply to Ian Jackson

Previously, if it didn't contain a `.', it would be taken as a flight name and completed with the old job name. (This was not documented.)

This meant that there was no way to adjust to refer to a differnet job in the flight being manipulated without specifying the flight number (which is not desirable, nor even possible with new:)

Instead, we adopt the convention that a trailing . completes the value with the old job name. Values without a . are taken literally as a job name, resulting in intra-flight references to that job.

---
v4: New patch, which helps with issues I tripped over while trying
to ad-hoc test the livepatch series.

---
 cs-adjust-flight | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)
cs-adjust-flight +5 -4
index 9812d12..03257a6 100755
@@ -32,6 +32,8 @@
 #                   and, <old-value> is matched against a value
 #                    containing the being-manipulated flight name
 #                    even if the actual runvar value omits it
+#                   and, if <new-value> ends in ., it is
+#                    completed with the <old-value>'s job name
 #
 # <dst-flight>:
 #   <flight>
@@ -361,12 +363,11 @@ sub change__runvar_build_set {
 	return unless $name =~ m/buildjob$/;
 
 	my $oldval = $varrow->{val};
-	$oldval = flight_otherjob($dstflight,$oldval);
-	return unless $oldvalok_fn->($oldval);
+	my ($oldflt,$oldjob) = flight_otherjob($dstflight,$oldval);
+	return unless $oldvalok_fn->("$oldflt.$oldjob");
 
 	$matches++;
-	$oldval =~ s/^\d+\.//; # strip out previous flight
-	my $newval = $specval =~ m/\./ ? $specval : "$specval.$oldval";
+	my $newval = $specval =~ m/\.$/ ? "$specval$oldjob": $specval;
         runvar_set($job, $name, $newval, " (modified from \`$oldval')")
 	    if $newval ne $oldval;
     }, 'IGNORE');
Signature · 7 lines
2.1.4


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
#12 lore raw
In reply to Ian Jackson

Ian Jackson writes ("[OSSTEST PATCH v4 00/11] livepatch test support"):

Quoted 3 lines

Thanks to Konrad, who passed me his git branch under the table. I have tidied up some loose ends, and tested it with my xen.git Makefile patches.

Oh, I should probably share this test report.
(Sorry, the log url is still broken.)

Ian.

From: Ian Jackson <[email protected]>
To: <[email protected]>
Subject: [adhoc test] 71531: all pass
Date: Wed, 7 Jun 2017 18:38:28 +0100

[adhoc play] <3testing.git (detached from 4f6660d) /dev/pts/82> harness 4f6660d: FIX
71531: all pass

flight 71531 xen-unstable play [adhoc]
http://osstest.xs.citrite.net/~osstest/testlogs/logs/71531/

Perfect :-)
All tests in this flight passed as required
baseline version:
flight 71387

jobs:

 build-amd64                                                  pass    
 build-i386                                                   pass    
 test-amd64-amd64-livepatch                                   pass    
 test-amd64-i386-livepatch                                    pass    

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel

#13 lore raw
In reply to Ian Jackson
Quoted 3 lines · Ian Jackson

Thanks to Konrad, who passed me his git branch under the table. I have tidied up some loose ends, and tested it with my xen.git Makefile patches.

Yeey! Thank you for taking them over.

Quoted 3 lines

Konrad, would you please take a look at this to make sure you don't think I've broken anything and that my changes look sane ? In

They look splendid!

Quoted 7 lines

particlar the patches I have marked with `#' below.

 m  01   TestSupport: target_cmd_root_status: New sub which returns return code.
 -  02   TestSupport: target_cmd_*: Add some doc comments
 -  03   TestSupport: target_cmd_output_root_status: New sub
 *# 04   mfi-common: Add an enable_livepatch runvar to the Xen build jobs
 *# 05   ts-xen-build: Build livepatches test-cases

Both Reviewed-by (albeit they have my SoB so that is kind of silly, but eh).

Quoted 4 lines
 -  06   ts-livepatch: Initial test-cases.
 -  07   sg-run-job: Add the test-livepatch.
 m  08   make-flight: Add livepatch build/test target in the matrix.
 *# 09   PDU/lab: Similar to xenuse

I would ditch that one. That 'lab' thing is what I use at home and I am OK keeping it in my local branch.

Quoted 9 lines
 +  10   cs-adjust-flight: Rework runvar-build-set new value handling
 +  11   sg-check-tested: Provide --flight option

Key:

 m   Changed only the commit message
 -   Very minor changes
 *   Actual changes
 +   Added patch (not really related, TBH)
  #  Konrad, please review this! 

Done. I am satisfied with them.

Quoted 4 lines

(All compared to Konrad's v3)

Thanks,
Ian.

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel

#14 lore raw

Konrad Rzeszutek Wilk writes ("Re: [OSSTEST PATCH v4 00/11] livepatch test support"):

Quoted 8 lines · Ian Jackson
Quoted 4 lines
 -  06   ts-livepatch: Initial test-cases.
 -  07   sg-run-job: Add the test-livepatch.
 m  08   make-flight: Add livepatch build/test target in the matrix.
 *# 09   PDU/lab: Similar to xenuse

I would ditch that one. That 'lab' thing is what I use at home and I am OK keeping it in my local branch.

Ah. Fair enough. I'm happy to carry it (under a different name if you like) though. That way if we change the API it'll get fixed for you (well, probably...)

Quoted 1 line

Done. I am satisfied with them.

Thanks,
Ian.

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel

#16 lore raw
In reply to Konrad Rzeszutek Wilk

Konrad Rzeszutek Wilk writes ("Re: [OSSTEST PATCH v4 00/11] livepatch test support"):

Quoted 1 line

Done. I am satisfied with them.

Great, thanks. I have pushed this to osstest pretest. I think it should go through without regressions; the new tests will fail, of course, on Xen branches that don't have the Makefile patches yet.

Ian.

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel

#15 lore raw
In reply to Ian Jackson
Quoted 7 lines · Ian Jackson

Konrad Rzeszutek Wilk writes ("Re: [OSSTEST PATCH v4 00/11] livepatch test support"):

Quoted 6 lines · Ian Jackson
Quoted 4 lines
 -  06   ts-livepatch: Initial test-cases.
 -  07   sg-run-job: Add the test-livepatch.
 m  08   make-flight: Add livepatch build/test target in the matrix.
 *# 09   PDU/lab: Similar to xenuse
Quoted 6 lines
Quoted 2 lines

I would ditch that one. That 'lab' thing is what I use at home and I am OK keeping it in my local branch.

Ah. Fair enough. I'm happy to carry it (under a different name if you like) though. That way if we change the API it'll get fixed for you (well, probably...)

Let me redo it a bit. I never got it to capture the serial port and that is something I would really want to work first.

Quoted 5 lines
Quoted 2 lines

Done. I am satisfied with them.

Thanks,
Ian.

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel