* [OSSTEST PATCH v4-v4.1 delta 0/2] livepatch test support
@ 2017-06-12 13:29 Ian Jackson
2017-06-12 13:29 ` [OSSTEST PATCH 1/2] substep handling improvements Ian Jackson
2017-06-12 13:29 ` [OSSTEST PATCH 2/2] fixup! ts-xen-build: Build livepatches test-cases Ian Jackson
0 siblings, 2 replies; 3+ messages in thread
From: Ian Jackson @ 2017-06-12 13:29 UTC (permalink / raw)
To: xen-devel
I found that this series broke (of course) when run on xen.git trees
without the dist-test target. These two patches fix this. The second
patch will be folded into `ts-xen-build: Build livepatches test-cases'
and I am then going to try to push it (again).
Ian.
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel
^ permalink raw reply [flat|nested] 3+ messages in thread
* [OSSTEST PATCH 1/2] substep handling improvements
2017-06-12 13:29 [OSSTEST PATCH v4-v4.1 delta 0/2] livepatch test support Ian Jackson
@ 2017-06-12 13:29 ` Ian Jackson
2017-06-12 13:29 ` [OSSTEST PATCH 2/2] fixup! ts-xen-build: Build livepatches test-cases Ian Jackson
1 sibling, 0 replies; 3+ messages in thread
From: Ian Jackson @ 2017-06-12 13:29 UTC (permalink / raw)
To: xen-devel; +Cc: Ian Jackson
* Change sg-run-job to pass OSSTEST_TESTID to ts-* scripts
* If the specified $testid starts with /, prepend OSSTEST_TESTID
(with a fallback for ad-hoc by-hand invocations).
* Default $script to the leafname from $0.
* Provide substep_eval, which does the obvious thing with eval and $@.
Signed-off-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
---
Osstest/TestSupport.pm | 33 +++++++++++++++++++++++++++++++--
sg-run-job | 3 ++-
2 files changed, 33 insertions(+), 3 deletions(-)
diff --git a/Osstest/TestSupport.pm b/Osstest/TestSupport.pm
index fc1aa7d..ce9ffaa 100644
--- a/Osstest/TestSupport.pm
+++ b/Osstest/TestSupport.pm
@@ -43,7 +43,8 @@ BEGIN {
ts_get_host_guest ts_check_done
fail broken logm $logm_handle $logm_prefix
- substep_start substep_finish intended_blessing
+ substep_start substep_finish substep_eval
+ intended_blessing
get_filecontents
report_once
@@ -236,16 +237,44 @@ END
: "($flight.$job not marked $newst)");
}
-sub substep_start ($$) {
+sub complete_testid ($) {
+ my ($testidr) = @_;
+ $$testidr =~ s{^(?=/)}{
+ $ENV{OSSTEST_TESTID} // sprintf('SUBSTEP-%s-%s', time, $$)
+ }e;
+}
+
+sub substep_start ($;$) {
my ($testid,$script) = @_;
+ complete_testid(\$testid);
+ if (!defined $script) {
+ $script = $0;
+ $script =~ s{^.*/}{};
+ }
$mjobdb->step_start($testid,$script);
}
sub substep_finish ($$) {
my ($testid,$stepstatus) = @_;
+ complete_testid(\$testid);
$mjobdb->step_finish($testid,$stepstatus);
}
+sub substep_eval ($$;$) {
+ # substep_eval(TESTID, [SCRIPTNAME], sub { ... });
+ my $fn = pop @_;
+ my ($testid,$script) = @_;
+ substep_start($testid,$script);
+ eval { $fn->(); };
+ if (length $@) {
+ logm("substep ($testid) failed: $@");
+ substep_finish($testid,'fail');
+ } else {
+ substep_finish($testid,'pass');
+ }
+}
+
+
sub intended_blessing () {
# must be run outside transaction
my $intended;
diff --git a/sg-run-job b/sg-run-job
index 0af86fa..4b98e2b 100755
--- a/sg-run-job
+++ b/sg-run-job
@@ -253,11 +253,12 @@ proc spawn-ts {iffail testid args} {
[list sh -xc "
OSSTEST_JOB=$jobinfo(job)
export OSSTEST_JOB
+ OSSTEST_TESTID=\$1; shift; export OSSTEST_TESTID
$xprefix \"$@\" >&2
rc=\$?
date -u +\"%Y-%m-%d %H:%M:%S Z exit status \$rc\" >&2
exit \$rc
- " x ./$ts] \
+ " x $testid ./$ts] \
$real_args $redirects]
set fh [open |$cmd r]
return [list fh $fh $details]
--
2.1.4
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [OSSTEST PATCH 2/2] fixup! ts-xen-build: Build livepatches test-cases
2017-06-12 13:29 [OSSTEST PATCH v4-v4.1 delta 0/2] livepatch test support Ian Jackson
2017-06-12 13:29 ` [OSSTEST PATCH 1/2] substep handling improvements Ian Jackson
@ 2017-06-12 13:29 ` Ian Jackson
1 sibling, 0 replies; 3+ messages in thread
From: Ian Jackson @ 2017-06-12 13:29 UTC (permalink / raw)
To: xen-devel; +Cc: Ian Jackson
Use substep_eval, so we cope with xen.git revisions which do not
support `make dist-tests'.
Signed-off-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
---
ts-xen-build | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/ts-xen-build b/ts-xen-build
index eaf44b1..097ac0a 100755
--- a/ts-xen-build
+++ b/ts-xen-build
@@ -173,9 +173,11 @@ END
}
if ($enable_livepatch) {
- buildcmd_stamped_logged(600, 'xen', 'xenlpt', '',<<END,'')
+ substep_eval('/dist-test', sub {
+ buildcmd_stamped_logged(600, 'xen', 'xenlpt', '',<<END,'');
$make_prefix make $makeflags dist-tests
END
+ });
}
}
--
2.1.4
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel
^ permalink raw reply related [flat|nested] 3+ messages in thread
end of thread, other threads:[~2017-06-12 13:30 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-06-12 13:29 [OSSTEST PATCH v4-v4.1 delta 0/2] livepatch test support Ian Jackson
2017-06-12 13:29 ` [OSSTEST PATCH 1/2] substep handling improvements Ian Jackson
2017-06-12 13:29 ` [OSSTEST PATCH 2/2] fixup! ts-xen-build: Build livepatches test-cases Ian Jackson
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).