diff mbox

[v1,OSSTEST,3/3] ts-livepatch: Expand testcase to include global/local symbols

Message ID 20170620024759.32562-4-konrad.wilk@oracle.com (mailing list archive)
State New, archived
Headers show

Commit Message

Konrad Rzeszutek Wilk June 20, 2017, 2:47 a.m. UTC
testing. The test is to verify that the local symbols
of payloads are ignored during loading.

See Xen's patch "livepatch: Add local and global symbol resolution."

Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
---
 ts-livepatch-run | 26 ++++++++++++++++++++++++--
 1 file changed, 24 insertions(+), 2 deletions(-)

Comments

Ian Jackson June 20, 2017, 3:18 p.m. UTC | #1
Konrad Rzeszutek Wilk writes ("[PATCH v1 OSSTEST 3/3] ts-livepatch: Expand testcase to include global/local symbols"):
> testing. The test is to verify that the local symbols
> of payloads are ignored during loading.

Can we do this with substeps rather than a conditional test
execution ?

For example, if xen.git should suddenly stop producing this file, it
ought to be a test failure.

Maybe we should make each test into a separate testid ?

Ian.
diff mbox

Patch

diff --git a/ts-livepatch-run b/ts-livepatch-run
index f119458..1eaceff 100755
--- a/ts-livepatch-run
+++ b/ts-livepatch-run
@@ -27,6 +27,7 @@  my @livepatch_files = qw(xen_hello_world.livepatch
                          xen_bye_world.livepatch
 			 xen_nop.livepatch);
 
+my $livepatch_dir="/usr/lib/debug/xen-livepatch";
 my $xen_extra_info;
 my $xen_minor_ver;
 
@@ -128,6 +129,24 @@  my @livepatch_tests = (
     { C => "xen-livepatch unload xen_nop" },
     );
 
+my @livepatch_tests_symbols = (
+    { C => "xen-livepatch load xen_hello_world.livepatch" },
+    { C => "xen-livepatch list",
+      OutputCheck => sub { m/xen_hello_world/ } },
+    { C => "xl info",
+      OutputCheck => \&check_for_hello_world },
+    # This would normally fail as xen_local_symbols has the same local
+    # symbols as xen_hello_world.livepatch but with
+    # "livepatch: Add local and global symbol resolution." it works.
+    { C => "xen-livepatch upload xen_local_symbols xen_local_symbols.livepatch" },
+    { C => "xen-livepatch replace xen_local_symbols" },
+    { C => "xl info",
+      OutputCheck => \&check_for_hello_world },
+    { C => "xen-livepatch revert xen_local_symbols" },
+    { C => "xen-livepatch unload xen_hello_world" },
+    { C => "xen-livepatch unload xen_local_symbols" },
+    );
+
 our $ho = selecthost('host');
 
 sub livepatch_test () {
@@ -138,7 +157,7 @@  sub livepatch_test () {
     foreach my $test (@livepatch_tests) {
         # Default rc is zero.
         my $expected_rc = defined($test->{rc}) ? $test->{rc} : 0;
-        my $cmd = "(set -e;cd /usr/lib/debug/xen-livepatch;$test->{C})";
+        my $cmd = "(set -e;cd $livepatch_dir;$test->{C})";
         my ($rc, $output) = target_cmd_output_root_status($ho, $cmd);
 
         if ($rc != $expected_rc) {
@@ -158,10 +177,13 @@  sub livepatch_test () {
 
 sub livepatch_check () {
     foreach my $file (@livepatch_files) {
-        if (!target_file_exists($ho, "/usr/lib/debug/xen-livepatch/$$file")) {
+        if (!target_file_exists($ho, "$$livepatch_dir/$$file")) {
             die "$file is missing!\n";
         }
     }
+    if (target_file_exists($ho, "$livepatch_dir/xen_local_symbols.livepatch")) {
+        @livepatch_tests = (@livepatch_tests, @livepatch_tests_symbols);
+    }
 }