Integrate XTF into OSSTest
v2 cover Integrate XTF into OSSTest
Hi all
This patch series integrates XTF into OSSTest. It still depends on quite a few things (listed below) but I think it has gotten to point that it can be posted for review.
It depends on having a canonical location for xtf.git. Currently this series contains a patch to point to my own xtf.git tree.
It depends on Ian's work:
1. Add a "skip" state to OSSTest.
2. Add diverse flag.
To make the XTf jobs reliable, we also need to:
1. Fix synchronisation issues in xenconsole related code in Xen.
2. Fix synchronisation issue in xtf-runner.
The effect of synchronisations can be seen in [0]. Test 1 and 5 failed. I've posted patches for them ([2], [3]).
I created a dummy test case that always fails. We expect ts-xtf-run to continue running after that. The result is at [1].
The test flight in [4] contained a hack that removed "skip" from accepcted states, so test-pv64-xsa-167 became "never pass" (should be "skip" in normal case). In job 4 test-pv32-pae-pv-iopl~vmassist failed due to xenconsole race. The code correctly caused rest of the job to be skipped. The same race also caused xtf-fep to fail in job 2, but that test won't cause the job to be aborted anymore.
Wei.
[0] http://osstest.xs.citrite.net/~osstest/testlogs/logs/66910/
[1] http://osstest.xs.citrite.net/~osstest/testlogs/logs/66916/
[2] <[email protected]>
[3] <[email protected]>
[4] http://osstest.xs.citrite.net/~osstest/testlogs/logs/66926/
[0] and [1] are from v1 of this series, [4] is from v2 (this version).
* Currently all logs are only accessible from within Citrix. Sorry. :-/
Wei Liu (14):
ts-xen-build: always compile in FEP support
DO NOT APPLY ts-leak-check: sleep 5 seconds before collecting stuff
ap-common: add xtf tree
DO NOT APPLY point xtf to my personal tree
BuildSupport: move buildcmd_stamped_logged here Introduce ts-xtf-build
sg-run-job: create xtf build recipe
Introduce ts-xtf-install
mfi-common: create xtf build job for 4.8 onwards Introduce ts-xtf-fep
Introduce ts-xtf-run
sg-run-job: test-xtf recipe
make-flight: create 5 xtf jobs
Create XTF branch
Osstest/BuildSupport.pm | 15 ++++++ ap-common | 4 ++ ap-fetch-version | 4 ++ ap-print-url | 3 ++ ap-push | 5 ++ cr-daily-branch | 8 ++++ cr-for-branches | 2 +- cri-common | 1 + make-flight | 40 ++++++++++++++++ mfi-common | 29 ++++++++++++ sg-run-job | 15 ++++++ ts-leak-check | 3 ++ ts-xen-build | 25 ++++------ ts-xtf-build | 54 +++++++++++++++++++++ ts-xtf-fep | 37 +++++++++++++++ ts-xtf-install | 37 +++++++++++++++ ts-xtf-run | 122 ++++++++++++++++++++++++++++++++++++++++++++++++ 17 files changed, 386 insertions(+), 18 deletions(-) create mode 100755 ts-xtf-build create mode 100755 ts-xtf-fep create mode 100755 ts-xtf-install create mode 100755 ts-xtf-run
Signature · 7 lines
2.1.4 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xen.org/xen-devel
RFC PATCH v2 1/14 ts-xen-build: always compile in FEP support
By default FEP depends on debug flag. When we are near release the debug flag will be turned off. In order to test a release build, we explicitly enable FEP in build configuration.
Since we target Xen versions that already have Kconfig support, only a Kconfig option is created for now.
We can easily add config option for older Xen when necessary.
Note that this only compiles in FEP support. To enable it a user needs to explicitly specify fep=1 in hypervisor command line.
--- ts-xen-build | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
ts-xen-build +6 -1
@@ -84,9 +84,14 @@ END (nonempty($earlyprintk) ? <<END : ''). echo >>.config CONFIG_EARLY_PRINTK=$earlyprintk END - ($ho->{Suite} =~ m/squeeze|wheezy/ ? <<END : '') #Debian #693721 + ($ho->{Suite} =~ m/squeeze|wheezy/ ? <<END : ''). #Debian #693721 echo >>.config PYTHON_PREFIX_ARG= END + <<END + if test -f xen/Kconfig; then + echo >>xen/.config CONFIG_HVM_FEP=y + fi +END ); }
Signature · 7 lines
2.1.4 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xen.org/xen-devel
Re: [OSSTEST PATCH RFC v2 01/14] ts-xen-build: always compile in FEP support
Wei Liu writes ("[OSSTEST PATCH RFC v2 01/14] ts-xen-build: always compile in FEP support"):
Quoted 3 lines
By default FEP depends on debug flag. When we are near release the debug flag will be turned off. In order to test a release build, we explicitly enable FEP in build configuration.
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
RFC PATCH v2 2/14 DO NOT APPLY ts-leak-check: sleep 5 seconds before collecting stuff
In reply to Wei LiuThe system could be in the process of freeing up resources. Give it some time to finish.
---
This won't be necessary once we fix all synchronisation issues in xtf-runner.
--- ts-leak-check | 3 +++ 1 file changed, 3 insertions(+)
ts-leak-check +3 -0
@@ -170,6 +170,9 @@ sub inventory () { } if (!eval { + # Sleep 5 seconds before colleting stuff in case some resources are + # being freed. + sleep 5; &{ "start_$mode" }(); inventory(); &{ "finish_$mode" }();
Signature · 7 lines
2.1.4 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xen.org/xen-devel
RFC PATCH v2 3/14 ap-common: add xtf tree
In reply to Wei Liu--- ap-common | 4 ++++ 1 file changed, 4 insertions(+)
ap-common +4 -0
@@ -33,6 +33,10 @@ : ${TREEVCS_LINUX:=git} +: ${TREE_XTF:=git://xenbits.xen.org/xtf.git} +: ${PUSH_TREE_XTF:=$XENBITS:/home/xen/git/osstest/xtf.git} +: ${BASE_TREE_XTF:=git://xenbits.xen.org/osstest/xtf.git} + : ${TREE_LIBVIRT:=git://libvirt.org/libvirt.git} : ${PUSH_TREE_LIBVIRT:=$XENBITS:/home/xen/git/libvirt.git} : ${BASE_TREE_LIBVIRT:=git://xenbits.xen.org/libvirt.git}
Signature · 7 lines
2.1.4 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xen.org/xen-devel
Re: [OSSTEST PATCH RFC v2 03/14] ap-common: add xtf tree
Wei Liu writes ("[OSSTEST PATCH RFC v2 03/14] ap-common: add xtf tree"):
Quoted 1 line
Signed-off-by Wei Liu <[email protected]>
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
RFC PATCH v2 4/14 DO NOT APPLY point xtf to my personal tree
In reply to Wei Liu--- ap-common | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
ap-common +3 -3
@@ -33,9 +33,9 @@ : ${TREEVCS_LINUX:=git} -: ${TREE_XTF:=git://xenbits.xen.org/xtf.git} -: ${PUSH_TREE_XTF:=$XENBITS:/home/xen/git/osstest/xtf.git} -: ${BASE_TREE_XTF:=git://xenbits.xen.org/osstest/xtf.git} +: ${TREE_XTF:=git://xenbits.xen.org/people/liuw/xtf.git} +: ${PUSH_TREE_XTF:=/export/home/weil/xtf.git/.git} +: ${BASE_TREE_XTF:=git://xenbits.xen.org/people/liuw/xtf.git} : ${TREE_LIBVIRT:=git://libvirt.org/libvirt.git} : ${PUSH_TREE_LIBVIRT:=$XENBITS:/home/xen/git/libvirt.git}
Signature · 7 lines
2.1.4 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xen.org/xen-devel
RFC PATCH v2 5/14 BuildSupport: move buildcmd_stamped_logged here
In reply to Wei Liu... so that other build scripts can use it, too.
It now accepts one more parameter called "component" to be useful in other build scripts.
No functional change.
---
v2: new
--- Osstest/BuildSupport.pm | 15 +++++++++++++++ ts-xen-build | 18 ++---------------- 2 files changed, 17 insertions(+), 16 deletions(-)
Osstest/BuildSupport.pm +15 -0
@@ -36,6 +36,7 @@ BEGIN { $whhost $ho builddirsprops + buildcmd_stamped_logged $builddir $makeflags prepbuilddirs
@@ -56,6 +57,20 @@ our ($whhost,$ho); our ($builddir,$makeflags); our ($xendist); +sub buildcmd_stamped_logged ($$$$$$) { + my ($timeout, $component, $stampname, $prefix, $cmd, $suffix) = @_; + target_cmd_build($ho, $timeout, $builddir, <<END); + cd $component + $prefix + ( $cmd 2>&1 && touch ../$stampname-ok-stamp + ) |tee ../$stampname-log + test -f ../$stampname-ok-stamp + $suffix + echo ok. +END +#/; +} + sub selectbuildhost { # pass \@ARGV my ($av) = @_;
ts-xen-build +2 -16
@@ -95,20 +95,6 @@ END ); } -sub buildcmd_stamped_logged ($$$$$) { - my ($timeout, $stampname, $prefix, $cmd, $suffix) = @_; - target_cmd_build($ho, $timeout, $builddir, <<END); - cd xen - $prefix - ( $cmd 2>&1 && touch ../$stampname-ok-stamp - ) |tee ../$stampname-log - test -f ../$stampname-ok-stamp - $suffix - echo ok. -END -#/; -} - sub build () { my $xend_opt= $r{enable_xend} =~ m/true/ ? "--enable-xend" : "--disable-xend"; my $ovmf_opt= $r{enable_ovmf} =~ m/true/ ? "--enable-ovmf" : "--disable-ovmf";
@@ -116,7 +102,7 @@ sub build () { my $configure_prefix = $r{cmdprefix_configure} // ''; my $make_prefix = $r{cmdprefix_make} // ''; - buildcmd_stamped_logged(600, 'configure', <<END,<<END,<<END); + buildcmd_stamped_logged(600, 'xen', 'configure', <<END,<<END,<<END); if test -f configure; then if grep -q -- $xend_opt tools/configure ; then xend=$xend_opt
@@ -130,7 +116,7 @@ END fi END #/; - buildcmd_stamped_logged(9000, 'build', '',<<END,''); + buildcmd_stamped_logged(9000, 'xen', 'build', '',<<END,''); if test -f xen/Kconfig; then $make_prefix make -C xen olddefconfig fi
Signature · 7 lines
2.1.4 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xen.org/xen-devel
Re: [OSSTEST PATCH RFC v2 05/14] BuildSupport: move buildcmd_stamped_logged here
Wei Liu writes ("[OSSTEST PATCH RFC v2 05/14] BuildSupport: move buildcmd_stamped_logged here"):
Quoted 4 lines
... so that other build scripts can use it, too.
It now accepts one more parameter called "component" to be useful in other build scripts.
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
RFC PATCH v2 6/14 Introduce ts-xtf-build
In reply to Wei LiuClone, build and package XTF for later use.
---
v2:
1. use buildcmd_stamped_logged
2. pass @ARGV to make
3. use /home/xtf
--- ts-xtf-build | 54 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) create mode 100755 ts-xtf-build
ts-xtf-build new file +54 -0
@@ -0,0 +1,54 @@ +#!/usr/bin/perl -w +# This is part of "osstest", an automated testing framework for Xen. +# Copyright (C) 2016 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 File::Path; +use POSIX; +use Osstest::TestSupport; +use Osstest::BuildSupport; + +tsreadconfig(); +selectbuildhost(\@ARGV); +# remaining arguments are passed as targets to "make" +builddirsprops(); + +sub checkout () { + prepbuilddirs(); + + build_clone($ho, 'xtf', $builddir, 'xtf'); +} + +sub build_and_install () { + + buildcmd_stamped_logged(300, 'xtf', 'build', '', <<END, ''); + make xtfdir=/home/xtf @ARGV +END + + buildcmd_stamped_logged(300, 'xtf', 'dist', '', <<END, ''); + make xtfdir=/home/xtf DESTDIR=$builddir/xtfdist install +END +} + +sub stash () { + built_stash($ho, $builddir, "xtfdist", "xtfdist"); +} + +checkout(); +build_and_install(); +stash();
Signature · 7 lines
2.1.4 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xen.org/xen-devel
Re: [OSSTEST PATCH RFC v2 06/14] Introduce ts-xtf-build
Wei Liu writes ("[OSSTEST PATCH RFC v2 06/14] Introduce ts-xtf-build"):
Quoted 3 lines
Clone, build and package XTF for later use.
Signed-off-by Wei Liu <[email protected]>
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
RFC PATCH v2 7/14 sg-run-job: create xtf build recipe
In reply to Wei Liu--- sg-run-job | 5 +++++ 1 file changed, 5 insertions(+)
sg-run-job +5 -0
@@ -480,6 +480,7 @@ proc need-hosts/build {} { return BUILD } proc need-hosts/build-kern {} { return BUILD } proc need-hosts/build-libvirt {} { return BUILD } proc need-hosts/build-rumpuserxen {} { return BUILD } +proc need-hosts/build-xtf {} { return BUILD } proc run-job/build {} { run-ts . = ts-xen-build
@@ -498,6 +499,10 @@ proc run-job/build-rumpuserxen {} { run-ts . = ts-xen-build + host tools } +proc run-job/build-xtf {} { + run-ts . = ts-xtf-build +} + proc prepare-build-host {} { global jobinfo run-ts broken = ts-hosts-allocate + host
Signature · 7 lines
2.1.4 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xen.org/xen-devel
RFC PATCH v2 8/14 Introduce ts-xtf-install
In reply to Wei LiuExtract XTF to the desire location.
---
v2: remove reference of runvar xtfdir
--- ts-xtf-install | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100755 ts-xtf-install
ts-xtf-install new file +37 -0
@@ -0,0 +1,37 @@ +#!/usr/bin/perl -w +# This is part of "osstest", an automated testing framework for Xen. +# Copyright (C) 2016 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; + +tsreadconfig(); + +our ($whhost) = @ARGV; +$whhost ||= 'host'; + +our $ho= selecthost($whhost); + +sub extract () { + my %distpath; + + target_extract_jobdistpath($ho, "xtf", "path_xtfdist", + $r{xtfbuildjob}, \%distpath); +} + +extract();
Signature · 7 lines
2.1.4 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xen.org/xen-devel
Re: [OSSTEST PATCH RFC v2 08/14] Introduce ts-xtf-install
Wei Liu writes ("[OSSTEST PATCH RFC v2 08/14] Introduce ts-xtf-install"):
Quoted 1 line
Extract XTF to the desire location.
^d
Ian.
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
RFC PATCH v2 9/14 mfi-common: create xtf build job for 4.8 onwards
In reply to Wei Liu--- mfi-common | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+)
mfi-common +29 -0
@@ -67,6 +67,21 @@ xenbranch_xsm_variants () { esac } +xenbranch_wants_xtf_tests () { + case "$xenbranch" in + xen-3.*-testing) return 1;; + xen-4.0-testing) return 1;; + xen-4.1-testing) return 1;; + xen-4.2-testing) return 1;; + xen-4.3-testing) return 1;; + xen-4.4-testing) return 1;; + xen-4.5-testing) return 1;; + xen-4.6-testing) return 1;; + xen-4.7-testing) return 1;; + *) return 0;; + esac +} + job_create_build () { job_create_build_filter_callback "$@" || return 0
@@ -265,6 +280,20 @@ create_build_jobs () { fi + if xenbranch_wants_xtf_tests; then + # Only x86, build once for amd64 and use the same result for + # both amd64 and i386 + if [ x$arch = xamd64 ] ; then + job_create_build build-$arch-xtf build-xtf \ + arch=$arch \ + $RUNVARS $BUILD_RUNVARS $BUILD_XTF_RUNVARS $arch_runvars \ + $hostos_runvars \ + host_hostflags=$build_hostflags \ + tree_xtf=$TREE_XTF \ + revision_xtf=$REVISION_XTF + fi + fi + if branch_wants_rumpkernel_tests; then case $arch in
Signature · 7 lines
2.1.4 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xen.org/xen-devel
Re: [OSSTEST PATCH RFC v2 09/14] mfi-common: create xtf build job for 4.8 onwards
Wei Liu writes ("[OSSTEST PATCH RFC v2 09/14] mfi-common: create xtf build job for 4.8 onwards"):
Quoted 1 line
Signed-off-by Wei Liu <[email protected]>
FAOD I am expecting xtf to be useable for older branches by the time this patch series is non-RFC.
Thanks,
Ian.
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
Re: [OSSTEST PATCH RFC v2 09/14] mfi-common: create xtf build job for 4.8 onwards
Quoted 6 lines · Ian Jackson
Wei Liu writes ("[OSSTEST PATCH RFC v2 09/14] mfi-common: create xtf build job for 4.8 onwards"):
Quoted 1 line
Signed-off-by Wei Liu <[email protected]>FAOD I am expecting xtf to be useable for older branches by the time this patch series is non-RFC.
Andrew, I think you have thought about this?
Wei.
Quoted 4 lines
Thanks,
Ian.
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
Re: [OSSTEST PATCH RFC v2 09/14] mfi-common: create xtf build job for 4.8 onwards
Quoted 7 lines · Wei Liu
Quoted 5 lines · Ian Jackson
Wei Liu writes ("[OSSTEST PATCH RFC v2 09/14] mfi-common: create xtf build job for 4.8 onwards"):
Quoted 1 line
Signed-off-by Wei Liu <[email protected]>FAOD I am expecting xtf to be useable for older branches by the time this patch series is non-RFC.
Andrew, I think you have thought about this?
We should aim for that.
IIRC, all we need is the ./xtf-runner mode to read from xenconsoled log files rather than using xl console ?
~Andrew
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
Re: [OSSTEST PATCH RFC v2 09/14] mfi-common: create xtf build job for 4.8 onwards
Quoted 7 lines · Andrew Cooper
Quoted 6 lines · Wei Liu
Quoted 5 lines · Ian Jackson
Wei Liu writes ("[OSSTEST PATCH RFC v2 09/14] mfi-common: create xtf build job for 4.8 onwards"):
Quoted 1 line
Signed-off-by Wei Liu <[email protected]>FAOD I am expecting xtf to be useable for older branches by the time this patch series is non-RFC.
Quoted 7 lines
Quoted 1 line
Andrew, I think you have thought about this?
We should aim for that.
IIRC, all we need is the ./xtf-runner mode to read from xenconsoled log files rather than using
xl console?
Yes.
Wei.
Quoted 1 line
~Andrew
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
RFC PATCH v2 10/14 Introduce ts-xtf-fep
In reply to Wei LiuTest the availability of FEP during runtime.
---
v2:
1. use target_cmd_output_root to get output
2. die if the output is not in expected format
3. use fep test result as exit code of the script
4. remove the use of xtfdir runvar
--- ts-xtf-fep | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100755 ts-xtf-fep
ts-xtf-fep new file +37 -0
@@ -0,0 +1,37 @@ +#!/usr/bin/perl -w +# This is part of "osstest", an automated testing framework for Xen. +# Copyright (C) 2016 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 Osstest; +use POSIX; +use Osstest::TestSupport; + +tsreadconfig(); + +our $ho = selecthost('host'); + +sub fep_test () { + my $output = target_cmd_output_root($ho, <<END); + /home/xtf/xtf-runner fep 1>&2; echo \$? +END + + $output =~ m/^(\d+)$/ or die "$output ?"; + + return $1; +} + +exit fep_test();
Signature · 7 lines
2.1.4 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xen.org/xen-devel
Re: [OSSTEST PATCH RFC v2 10/14] Introduce ts-xtf-fep
Wei Liu writes ("[OSSTEST PATCH RFC v2 10/14] Introduce ts-xtf-fep"):
Quoted 1 line
Test the availability of FEP during runtime.
...
ts-xtf-fep line 37
Quoted 6 lines
ts-xtf-fep new file +6
-0+ $output =~ m/^(\d+)$/ or die "$output ?"; + + return $1; +} + +exit fep_test();
I think something in this script should log the exit status. Digging the exit status out of the logs is not particularly easy.
Ian.
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
RFC PATCH v2 11/14 Introduce ts-xtf-run
In reply to Wei LiuThis is the main script for running XTF. It will first perform selftest, and then run each XTF test case as a substep.
It does the following things:
1. Run self tests for individual environment and record the result.
2. Collect tests according to available environments.
3. Run the collected tests one by one.
The script may exit early if it detects the test host is down or xtf-runner returns non-recognisable exit code.
--- ts-xtf-run | 122 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 122 insertions(+) create mode 100755 ts-xtf-run
ts-xtf-run new file +122 -0
@@ -0,0 +1,122 @@ +#!/usr/bin/perl -w +# This is part of "osstest", an automated testing framework for Xen. +# Copyright (C) 2016 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 Osstest; +use POSIX; +use Osstest::TestSupport; + +tsreadconfig(); + +our $ho = selecthost('host'); + +our $runner = "/home/xtf/xtf-runner"; +our @tests; +our @all_environments; +our @environments; + +# XTF results (runner returned numeric values) and OSStest results: +# +# SUCCESS(0) -> pass +# SKIP(3) -> skip +# ERROR(4) -> fail +# FAILURE(5) -> fail +# +sub xtf_result_to_osstest_result ($) { + my ($xret) = @_; + + return "pass" if $xret == 0; + return "skip" if $xret == 3; + return "fail" if $xret == 4; + return "fail" if $xret == 5; + die "xtf runner gave unexpected result $xret"; +} + +sub get_environments () { + my $output = target_cmd_output_root($ho, <<END); + $runner --list --environments +END + push @all_environments, split /\n/, $output; +} + +# Call the runner on one test case, generate a substep for it in final test +# report. Return runner exit code to caller. May exit the script early if +# things go really bad. +sub do_one_test ($) { + my ($name) = @_; + my $tid = "xtf/$name"; + my $cmd = "xtf-runner $name"; + my $output; + my $ret; + my $osstest_result; + + substep_start($tid, $cmd); + + if (! eval { + $output = target_cmd_output_root($ho, <<END, 600); + $runner $name 1>&2; echo \$? +END + $output =~ m/^(\d+)$/ or die "$output ?"; + $ret = $1; + + target_cmd_output_root($ho, 'echo ok.'); + $osstest_result = xtf_result_to_osstest_result($ret); + 1; + }) { + logm("XTF test threw exception:\n$@"); + substep_finish($tid, "fail"); + exit 0; + } + + logm("Test $name, XTF returned $ret -> OSSTest $osstest_result"); + substep_finish($tid, $osstest_result); + + return $ret; +} + +# Run selftest for each environment, record the ones that are +# functional to get maximum coverage. +sub do_selftest () { + foreach my $e (sort @all_environments) { + my $output = target_cmd_output_root($ho, <<END); + $runner --list $e selftest +END + my $ret = do_one_test($output); + push @environments, $e if $ret == 0; + } +} + +sub get_tests_list () { + foreach my $e (sort @environments) { + my $output = target_cmd_output_root($ho, <<END); + $runner --list $e --all --host +END + push @tests, split /\n/, $output; + } +} + +sub do_all_tests () { + foreach my $t (sort @tests) { + do_one_test($t); + } +} + +get_environments(); +do_selftest(); +get_tests_list(); +do_all_tests(); +exit 0;
Signature · 7 lines
2.1.4 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xen.org/xen-devel
Re: [OSSTEST PATCH RFC v2 11/14] Introduce ts-xtf-run
Wei Liu writes ("[OSSTEST PATCH RFC v2 11/14] Introduce ts-xtf-run"):
Quoted 2 lines
This is the main script for running XTF. It will first perform selftest, and then run each XTF test case as a substep.
...
Quoted 5 lines
ts-xtf-run new file +5
-0+# XTF results (runner returned numeric values) and OSStest results: +# +# SUCCESS(0) -> pass +# SKIP(3) -> skip +# ERROR(4) -> fail
ts-xtf-run line 46
Quoted 10 lines
ts-xtf-run new file +10
-0+# FAILURE(5) -> fail +# +sub xtf_result_to_osstest_result ($) { + my ($xret) = @_; + + return "pass" if $xret == 0; + return "skip" if $xret == 3; + return "fail" if $xret == 4; + return "fail" if $xret == 5; + die "xtf runner gave unexpected result $xret";
Wouldn't it be nicer to delete the separate comment and write
+ return "pass" if $xret == 0; # XTF SUCCESS
etc. ?
Quoted 1 line
+ if (! eval {
^
This space is anomalous coding style.
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
Re: [OSSTEST PATCH RFC v2 11/14] Introduce ts-xtf-run
Quoted 24 lines · Ian Jackson
Wei Liu writes ("[OSSTEST PATCH RFC v2 11/14] Introduce ts-xtf-run"):
Quoted 2 lines
This is the main script for running XTF. It will first perform selftest, and then run each XTF test case as a substep.
...
Quoted 5 lines
ts-xtf-run new file +5
-0+# XTF results (runner returned numeric values) and OSStest results: +# +# SUCCESS(0) -> pass +# SKIP(3) -> skip +# ERROR(4) -> failts-xtf-run line 46
Quoted 10 lines
ts-xtf-run new file +10
-0+# FAILURE(5) -> fail +# +sub xtf_result_to_osstest_result ($) { + my ($xret) = @_; + + return "pass" if $xret == 0; + return "skip" if $xret == 3; + return "fail" if $xret == 4; + return "fail" if $xret == 5; + die "xtf runner gave unexpected result $xret";Wouldn't it be nicer to delete the separate comment and write
+ return "pass" if $xret == 0; # XTF SUCCESS
Quoted 8 lines
etc. ?
Quoted 1 line
+ if (! eval {
^This space is anomalous coding style.
Acked-by Ian Jackson <[email protected]>
Fixed both issues and added your ack. Thanks.
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
Re: [OSSTEST PATCH RFC v2 11/14] Introduce ts-xtf-run
In reply to Wei LiuQuoted 11 lines · Wei Liu
This is the main script for running XTF. It will first perform selftest, and then run each XTF test case as a substep.
It does the following things:
1. Run self tests for individual environment and record the result.
2. Collect tests according to available environments.
3. Run the collected tests one by one.The script may exit early if it detects the test host is down or xtf-runner returns non-recognisable exit code.
What is OSSTests general approach to recovering crashed hosts?
XenRT recovers the host and continues testing, so subsequent steps are not blocked. (especially in a case like this, where there is a distinctly more likely chance that the host might crash.)
~Andrew
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
Re: [OSSTEST PATCH RFC v2 11/14] Introduce ts-xtf-run
Andrew Cooper writes ("Re: [Xen-devel] [OSSTEST PATCH RFC v2 11/14] Introduce ts-xtf-run"):
Quoted 1 line · Wei Liu
...
Quoted 4 lines
Quoted 2 lines
The script may exit early if it detects the test host is down or xtf-runner returns non-recognisable exit code.
What is OSSTests general approach to recovering crashed hosts?
osstest will attempt to recover the host by power cycling it, for the purposes of capturing logs.
It won't resume the test job where it left off. I don't think that's desirable.
Quoted 3 lines
XenRT recovers the host and continues testing, so subsequent steps are not blocked. (especially in a case like this, where there is a distinctly more likely chance that the host might crash.)
The effect of Wei's patch is that, if one of the XTF tests causes the host to crash:
- this will be treated as a failure of that specific XTF test
- the osstest log capture will initially fail and the host will be power cycled in an attempt to be able to capture logs stored on the host hard disk
- the remaining XTF tests in that job will not be run
- the other jobs in the same flight will run (and perhaps experience the same bug, or perhaps not)
- the next flight to allocate the crashed host will wipe it by power cycling it and netbooting debian-installer
Ian.
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
RFC PATCH v2 12/14 sg-run-job: test-xtf recipe
In reply to Wei LiuInstall XTF, run FEP test and then run all available tests.
---
v2: spawn and reap ts-xtf-fep to make it non-fatal
--- sg-run-job | 10 ++++++++++ 1 file changed, 10 insertions(+)
sg-run-job +10 -0
@@ -411,6 +411,16 @@ proc run-job/test-nested {} { run-ts . = ts-guest-stop l1 l2 } +proc need-hosts/test-xtf {} { return host } +proc run-job/test-xtf {} { + run-ts . = ts-xtf-install + + # Spawn and reap fep test to make it non-fatal + reap-ts [spawn-ts . = ts-xtf-fep] + + run-ts . = ts-xtf-run +} + 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
Re: [OSSTEST PATCH RFC v2 12/14] sg-run-job: test-xtf recipe
Wei Liu writes ("[OSSTEST PATCH RFC v2 12/14] sg-run-job: test-xtf recipe"):
Quoted 1 line
Install XTF, run FEP test and then run all available tests.
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
RFC PATCH v2 13/14 make-flight: create 5 xtf jobs
In reply to Wei LiuCreate jobs only for x86 and set host flag diverse-xtf-x86.
--- make-flight | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+)
make-flight +22 -0
@@ -422,6 +422,26 @@ do_rtds_tests () { $debian_runvars all_hostflags=$most_hostflags } +do_xtf_tests () { + if ! xenbranch_wants_xtf_tests; then + return + fi + + # xtf is only meaningful to x86. And amd64 and i386 should be the same, + # create only for one subarch is good enough. + if [ x$xenarch != xamd64 -o x$dom0arch != xamd64 ]; then + return; + fi + + for i in `seq 1 5`; do + job_create_test test-xtf-$xenarch-$dom0arch-$i \ + test-xtf xl $xenarch $dom0arch \ + xtfbuildjob=build-$xenarch-xtf \ + xen_boot_append='hvm_fep=1' \ + all_hostflags=$most_hostflags,diverse-xtf-x86 + done +} + do_multivcpu_tests () { if [ $xenarch != $dom0arch ]; then return
@@ -705,6 +725,8 @@ test_matrix_do_one () { do_pygrub_tests do_pvgrub_tests + + do_xtf_tests } if [ x$buildflight = x ]; then
Signature · 7 lines
2.1.4 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xen.org/xen-devel
Re: [OSSTEST PATCH RFC v2 13/14] make-flight: create 5 xtf jobs
Wei Liu writes ("[OSSTEST PATCH RFC v2 13/14] make-flight: create 5 xtf jobs"):
Quoted 1 line
Create jobs only for x86 and set host flag diverse-xtf-x86.
I think I acked this one previously. Anyway,
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
RFC PATCH v2 14/14 Create XTF branch
In reply to Wei LiuThis branch contains Xen and Linux build jobs and all jobs which contain xtf in their name.
---
I'm not sure if everything is ok because I can't test all changes.
--- ap-fetch-version | 4 ++++ ap-print-url | 3 +++ ap-push | 5 +++++ cr-daily-branch | 8 ++++++++ cr-for-branches | 2 +- cri-common | 1 + make-flight | 18 ++++++++++++++++++ 7 files changed, 40 insertions(+), 1 deletion(-)
ap-fetch-version +4 -0
@@ -98,6 +98,10 @@ seabios) repo_tree_rev_fetch_git seabios \ $TREE_SEABIOS_UPSTREAM master $LOCALREV_SEABIOS ;; +xtf) + repo_tree_rev_fetch_git xtf \ + $TREE_XTF_UPSTREAM master $LOCALREV_XTF + ;; ovmf) repo_tree_rev_fetch_git ovmf \ $TREE_OVMF_UPSTREAM master $LOCALREV_OVMF
ap-print-url +3 -0
@@ -58,6 +58,9 @@ rumpuserxen) seabios) echo $TREE_SEABIOS_UPSTREAM ;; +xtf) + echo $TREE_XTF_UPSTREAM + ;; ovmf) echo $TREE_OVMF_UPSTREAM ;;
ap-push +5 -0
@@ -40,6 +40,7 @@ TREE_LIBVIRT=$PUSH_TREE_LIBVIRT TREE_RUMPUSERXEN=$PUSH_TREE_RUMPUSERXEN TREE_SEABIOS=$PUSH_TREE_SEABIOS TREE_OVMF=$PUSH_TREE_OVMF +TREE_XTF=$PUSH_TREE_XTF if info_linux_tree "$branch"; then cd $repos/linux
@@ -120,6 +121,10 @@ seabios) cd $repos/seabios git push $TREE_SEABIOS $revision:refs/heads/xen-tested-master ;; +xtf) + cd $repos/xtf + git push $TREE_XTF $revision:refs/heads/xen-tested-master + ;; ovmf) cd $repos/ovmf git push $TREE_OVMF $revision:refs/heads/xen-tested-master
cr-daily-branch +8 -0
@@ -195,6 +195,10 @@ if [ "x$REVISION_LIBVIRT" = x ]; then determine_version REVISION_LIBVIRT libvirt LIBVIRT export REVISION_LIBVIRT fi +if [ "x$REVISION_XTF" = x ]; then + determine_version REVISION_XTF xtf XTF + export REVISION_XTF +fi if [ "x$REVISION_RUMPUSERXEN" = x ]; then determine_version REVISION_RUMPUSERXEN rumpuserxen RUMPUSERXEN export REVISION_RUMPUSERXEN
@@ -248,6 +252,10 @@ seabios) realtree=seabios NEW_REVISION=$REVISION_SEABIOS ;; +xtf) + realtree=xtf + NEW_REVISION=$REVISION_XTF + ;; ovmf) realtree=ovmf NEW_REVISION=$REVISION_OVMF
cr-for-branches +1 -1
@@ -31,7 +31,7 @@ scriptoptions="$1"; shift LOGFILE=tmp/cr-for-branches.log export LOGFILE -: ${BRANCHES:=osstest xen-4.0-testing xen-4.1-testing xen-4.2-testing xen-4.3-testing xen-4.4-testing xen-4.5-testing xen-4.6-testing xen-4.7-testing xen-unstable qemu-mainline qemu-upstream-unstable qemu-upstream-4.2-testing qemu-upstream-4.3-testing qemu-upstream-4.4-testing qemu-upstream-4.5-testing qemu-upstream-4.6-testing qemu-upstream-4.7-testing linux-4.1 linux-3.18 linux-3.16 linux-3.14 linux-3.10 linux-3.4 linux-arm-xen seabios ovmf ${EXTRA_BRANCHES}} +: ${BRANCHES:=osstest xen-4.0-testing xen-4.1-testing xen-4.2-testing xen-4.3-testing xen-4.4-testing xen-4.5-testing xen-4.6-testing xen-4.7-testing xen-unstable qemu-mainline qemu-upstream-unstable qemu-upstream-4.2-testing qemu-upstream-4.3-testing qemu-upstream-4.4-testing qemu-upstream-4.5-testing qemu-upstream-4.6-testing qemu-upstream-4.7-testing linux-4.1 linux-3.18 linux-3.16 linux-3.14 linux-3.10 linux-3.4 linux-arm-xen seabios ovmf xtf ${EXTRA_BRANCHES}} export BRANCHES fetchwlem=$wlem
cri-common +1 -0
@@ -78,6 +78,7 @@ select_xenbranch () { libvirt) tree=libvirt; xenbranch=xen-unstable ;; rumpuserxen) tree=rumpuserxen; xenbranch=xen-unstable ;; seabios) tree=seabios; xenbranch=xen-unstable ;; + xtf) tree=xtf; xenbranch=xen-unstable ;; ovmf) tree=ovmf; xenbranch=xen-unstable ;; distros-*) tree=none; xenbranch=xen-unstable ;; osstest) tree=osstest; xenbranch=xen-unstable ;;
make-flight +18 -0
@@ -75,6 +75,14 @@ job_create_build_filter_callback () { *) return 1 ;; esac ;; + xtf) + case "$job" in + build-amd64) ;; + build-amd64-pvops) ;; + build-*-xtf) ;; + *) return 1 ;; + esac + ;; esac return 0 }
@@ -116,6 +124,16 @@ job_create_test_filter_callback () { return 1;; esac ;; + xtf) + case "$xenarch:$dom0arch" in + amd64:amd64) ;; + *) return 1;; + esac + case $job in + *-xtf-*) ;; + *) return 1;; + esac + ;; seabios) case $xenarch in amd64|i386) ;;
Signature · 7 lines
2.1.4 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xen.org/xen-devel