[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [PATCH v1 5/7] ts-livepatch: Initial test-cases.
There are 32 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. Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@xxxxxxxxxx> --- ts-livepatch | 102 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 102 insertions(+) create mode 100755 ts-livepatch diff --git a/ts-livepatch b/ts-livepatch new file mode 100755 index 0000000..a996ee9 --- /dev/null +++ b/ts-livepatch @@ -0,0 +1,102 @@ +#!/usr/bin/perl -w +# 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 +# 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 Osstest; +use POSIX; +use Osstest::TestSupport; + +tsreadconfig(); + +my @livepatch_files = ("xen_hello_world.livepatch", "xen_replace_world.livepatch", + "xen_bye_world.livepatch", "xen_nop.livepatch"); + +my @livepatch_tests = ( + {cmd => "xen-livepatch list", rc => 0}, + {cmd => "xl info | grep xen_extra | grep -q \"Hello World\"", rc => 256}, + {cmd => "xen-livepatch revert xen_hello_world", rc => 256}, + {cmd => "xen-livepatch load xen_hello_world.livepatch", rc => 0}, + {cmd => "xen-livepatch load xen_hello_world.livepatch", rc => 256}, + {cmd => "xen-livepatch list | grep -q xen_hello_world", rc => 0}, + {cmd => "xl info | grep xen_extra | grep -q \"Hello World\"", rc => 0}, + {cmd => "xen-livepatch revert xen_hello_world", rc => 0}, + {cmd => "xl info | grep xen_extra | grep -q \"Hello World\"", rc => 256}, + {cmd => "xen-livepatch unload xen_hello_world", rc => 0}, + {cmd => "xen-livepatch unload xen_hello_world", rc => 256}, + {cmd => "xl info | grep xen_extra | grep -q \"Hello World\"", rc => 256}, + {cmd => "xen-livepatch load xen_hello_world.livepatch", rc => 0}, + {cmd => "xen-livepatch load xen_bye_world.livepatch", rc => 0}, + {cmd => "xl info | grep xen_extra | grep -q \"Bye World\"", rc => 0}, + {cmd => "xen-livepatch upload xen_replace xen_replace_world.livepatch", rc => 0}, + {cmd => "xen-livepatch replace xen_replace", rc => 0}, + {cmd => "xen-livepatch apply xen_hello_world", rc => 256}, + {cmd => "xen-livepatch apply xen_bye_world", rc => 256}, + {cmd => "xl info | grep xen_extra | grep -q \"Hello Again Wor\"", rc => 0}, + {cmd => "xen-livepatch apply xen_replace", rc => 0}, + {cmd => "xen-livepatch revert xen_replace", rc => 0}, + {cmd => "xen-livepatch unload xen_replace", rc => 0}, + {cmd => "xen-livepatch unload xen_hello_world", rc => 0}, + {cmd => "xen-livepatch unload xen_bye_world", rc => 0}, + {cmd => "xen-livepatch list | grep -q xen", rc => 256}, + {cmd => "xen-livepatch load xen_nop.livepatch", rc => 0}, + {cmd => "xen-livepatch revert xen_nop", rc => 0}, + {cmd => "xen-livepatch apply xen_nop", rc => 0}, + {cmd => "[ `xl info| grep \"xen_m\" | grep or | sed s/.*:// | uniq | wc -l` == 1 ]", rc => 0}, + {cmd => "xen-livepatch unload xen_nop", rc => 256}, + {cmd => "xen-livepatch revert xen_nop", rc => 0}, + {cmd => "xen-livepatch unload xen_nop", rc => 0}, + ); + +our $ho = selecthost('host'); + +sub livepatch_test () +{ + logm "Have $#livepatch_tests test-cases\n"; + my $rc=0; + for my $i ( 0 .. $#livepatch_tests ) { + my $expected_rc = $livepatch_tests[$i]{rc}; + my $cmd = "(cd /usr/lib/debug;$livepatch_tests[$i]{cmd})"; + logm "Executing: '$cmd:' .."; + my $rc=target_cmd_root_rc($ho, $cmd); + if ( $rc != $expected_rc ) { + logm "FAILED (got $rc, expected: $expected_rc): \n"; + return $rc; + } + logm ".. OK!\n"; + } + return $rc +} + +sub livepatch_check () +{ + foreach my $file (@livepatch_files) + { + if (!target_file_exists($ho, "/usr/lib/debug/$$file")) { + die "$file is missing!\n"; + } + } + return 0 +} + + +our $livepatch_result = livepatch_check(); +exit $livepatch_result if $livepatch_result; +$livepatch_result = livepatch_test(); + +logm("Livepatch test returned $livepatch_result"); + +exit $livepatch_result; -- 2.1.4 _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxx https://lists.xen.org/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |