mg-repro-* improvements
v2 cover mg-repro-* improvements
This fixes bugs I found trying to use the last version of this series. This version has been used successfully.
Ian Jackson (8):
mg-transient-task: New utility
mg-transient-task: Put the ownd fd on a high fd, say, 114
mg-repro-setup: Do all builds in their own tasks, regardless
mg-repro-setup: Do not imply that a --rebuild needs a +TREE
mg-repro-setup: Introduce `statictask' variable
mg-repro-setup: New mode --autoalloc
mg-repro-setup: actually accept --rebuild -rVAR=VALUE
mg-repro-setup: Do not wrongly reject multiple --rebuild
cs-adjust-flight | 2 +- mg-repro-setup | 53 ++++++++++++++++++++++++++++++++++--------------- mg-transient-task | 35 ++++++++++++++++++++++++++++++++ tcl/JobDB-Executive.tcl | 1 + 4 files changed, 74 insertions(+), 17 deletions(-) create mode 100755 mg-transient-task
Signature · 7 lines
2.11.0 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xenproject.org/mailman/listinfo/xen-devel
PATCH v2 1/8 mg-transient-task: New utility
Will be useful in combination with new mode(s) of mg-repro-setup.
--- mg-transient-task | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100755 mg-transient-task
mg-transient-task new file +32 -0
@@ -0,0 +1,32 @@ +#!/usr/bin/tclsh8.5 +# -*- Tcl -*- +# usage: ./mg-transient-task PROGRAM [ARGS...] + +# This is part of "osstest", an automated testing framework for Xen. +# Copyright (C) 2009-2019 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/>. + +package require Tclx + +source ./tcl/daemonlib.tcl + +jobdb::become-task [string range "$argv" 0 50] +exec 2>@ stderr perl -I. -e { + use Osstest; + use Osstest::Executive; + csreadconfig(); + findtask() +} +execl [lindex $argv 0] [lrange $argv 1 end]
Signature · 7 lines
2.11.0 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xenproject.org/mailman/listinfo/xen-devel
PATCH v2 2/8 mg-transient-task: Put the ownd fd on a high fd, say, 114
In reply to Ian JacksonThis avoids clashes with other shell scripts' etc. fds.
---
v2: New patch
--- mg-transient-task | 5 ++++- tcl/JobDB-Executive.tcl | 1 + 2 files changed, 5 insertions(+), 1 deletion(-)
mg-transient-task +4 -1
@@ -22,7 +22,10 @@ package require Tclx source ./tcl/daemonlib.tcl -jobdb::become-task [string range "$argv" 0 50] +set ownerqueue [jobdb::become-task [string range "$argv" 0 50]] +dup $ownerqueue file114 +close $ownerqueue + exec 2>@ stderr perl -I. -e { use Osstest; use Osstest::Executive;
tcl/JobDB-Executive.tcl +1 -0
@@ -435,6 +435,7 @@ proc become-task {comment} { AND refkey = [pg_quote [lindex $refinfo 1]] " } + return $ownerqueue } proc preserve-task {seconds} {
Signature · 7 lines
2.11.0 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xenproject.org/mailman/listinfo/xen-devel
PATCH v2 3/8 mg-repro-setup: Do all builds in their own tasks, regardless
In reply to Ian JacksonIn case OSSTEST_TASK was set by the caller, unset it. Unsetting it will cause each sg-run-job (inside mg-execute-task) to become its own task.
--- mg-repro-setup | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
mg-repro-setup +2 -1
@@ -247,7 +247,8 @@ progress "new flight is $flight" if [ "x$rebuilds_flight" != x ]; then progress "running build(s) $rebuilds_flight" - ./mg-execute-flight -B$rebuilds_blessing --progress-fd=2 \ + env -u OSSTEST_TASK \ + ./mg-execute-flight -B$rebuilds_blessing --progress-fd=2 \ "${mgexecflags[@]}" $rebuilds_flight mro=tmp/$rebuilds_flight.mro
Signature · 7 lines
2.11.0 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xenproject.org/mailman/listinfo/xen-devel
PATCH v2 4/8 mg-repro-setup: Do not imply that a --rebuild needs a +TREE
In reply to Ian JacksonThe +TREEs and other specifications are convolved.
--- mg-repro-setup | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
mg-repro-setup +2 -3
@@ -45,8 +45,7 @@ usage () { cat <<END REBUILD is --rebuild [-B<blessing>] [-r...] - [.BUILDJOB | =BUILDJOBRUNVAR...] - +TREE=URL#REVISION... + [.BUILDJOB | =BUILDJOBRUNVAR | +TREE=URL#REVISION ...] Also use a different build. Specifically, use URL and REVISION for certain builds which mention TREE and which are referenced (directly) in the job JOB in EXAMPLE-FLIGHT. The affected builds
@@ -55,7 +54,7 @@ usage () { cat <<END name is any of the BUILDJOB (in which case all references to that job are adjusted). If no .BUILDJOB and no =BUILDJOBRUNVAR are specified, then all jobs referred to from the example JOB - which mention TREE are affected. + which mention a TREE are affected. For example, --rebuild =xenbuildjob \
Signature · 7 lines
2.11.0 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xenproject.org/mailman/listinfo/xen-devel
PATCH v2 5/8 mg-repro-setup: Introduce `statictask' variable
In reply to Ian JacksonWe are going to make a mode where we don't set OSSTEST_TASK. The result is that our subprocesses will do whatever they usually do.
Those are mg-allocate (which would allocate for our static task) and mg-execute-flight which will make a dynamic task. We must therefore prevent mg-allocate from running since the allocations would not be useable for the flight execution.
No functional change yet, since nothing sets statictask=false and therefore OSSTEST_TASK would always be set.
--- mg-repro-setup | 28 +++++++++++++++++++--------- 1 file changed, 19 insertions(+), 9 deletions(-)
mg-repro-setup +19 -9
@@ -102,6 +102,7 @@ duration=28d blessing=play skipcapture=true autoalloc=false +statictask=true while true; do case "$1" in
@@ -116,7 +117,7 @@ while true; do -t?*) duration=${arg#-t} ;; --rogue) duration='' ;; --capture) skipcapture=false ;; - --autoalloc-nofree) autoalloc=true ;; + --autoalloc-nofree) autoalloc=true; statictask=true ;; -l*) logfile=${arg#-l} ;; -r^*|-r!*) adjustsets+=("${arg#-r}") ;; # ^ two patterns because there's no way in bash to write
@@ -257,16 +258,25 @@ if [ "x$rebuilds_flight" != x ]; then fi fi -OSSTEST_TASK=$(perl -e ' - use Osstest; - use Osstest::Executive; - csreadconfig(); - findtask(); - printf "%s\n", $ENV{'OSSTEST_TASK'} or die $!; -') -export OSSTEST_TASK +if $statictask; then + OSSTEST_TASK=$(perl -e ' + use Osstest; + use Osstest::Executive; + csreadconfig(); + findtask(); + printf "%s\n", $ENV{'OSSTEST_TASK'} or die $!; + ') + export OSSTEST_TASK +fi if [ "${alloc_idents[*]}" ]; then + if [ x"$OSSTEST_TASK" = x ]; then + # We would have to make a dynamic task and hold the + # fd for it in this script. Would be quite awkward. + echo >&2 'cannot hand-allocate in a way that will free' + exit 1 + fi + progress "allocating ${alloc_idents[*]} ..." alloc_output=tmp/$flight.allocations ./mg-allocate \
Signature · 7 lines
2.11.0 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xenproject.org/mailman/listinfo/xen-devel
PATCH v2 6/8 mg-repro-setup: New mode --autoalloc
In reply to Ian JacksonThis just involves turning autoalloc on and statictask off. It is most useful with mg-transient-task, as documented.
--- mg-repro-setup | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-)
mg-repro-setup +12 -2
@@ -28,7 +28,7 @@ usage () { cat <<END HOSTSPEC is [<ident>=][reuse:]<hostname> host must be allocated, skip host-install [<ident>=]wipe:<hostname> host must be allocated, wipe it - [<ident>=]alloc:<resource-spec> \`mg-allocate <resource-spec>', and wipe + [<ident>=]alloc:<resource-spec> \`mg-allocate <resource-spec>', and wipe[*] none: no hosts (should be only HOSTPSEC) (default <ident> is \`host')
@@ -42,6 +42,13 @@ usage () { cat <<END -E... -f... -P as for mg-execute-flight --autoalloc-nofree allocate hosts as for production, but keep them (specify no HOSTSPECS; remember to deallocate later) + --autoalloc use hosts as for production (specify no HOSTSPECS) + and free them afterwards[*] + + [*] If \$OSSTEST_TASK is set on entry, it will be used for these + allocations. So, in particular, + ./mg-transient-task ./mg-repro-setup .... alloc:... + will allocate as specified, but discard the hosts when done. REBUILD is --rebuild [-B<blessing>] [-r...]
@@ -104,6 +111,8 @@ skipcapture=true autoalloc=false statictask=true +if [ "x$OSSTEST_TASK" != x ]; then statictask=false; fi + while true; do case "$1" in -*) ;;
@@ -117,6 +126,7 @@ while true; do -t?*) duration=${arg#-t} ;; --rogue) duration='' ;; --capture) skipcapture=false ;; + --autoalloc) autoalloc=true; statictask=false ;; --autoalloc-nofree) autoalloc=true; statictask=true ;; -l*) logfile=${arg#-l} ;; -r^*|-r!*) adjustsets+=("${arg#-r}") ;;
@@ -297,7 +307,7 @@ if [ "${alloc_idents[*]}" ]; then progressf "\n" if $autoalloc; then echo >&2 \ - 'warning: --autoalloc-nofree and HOSTSPECs are do not work well together' + 'warning: --autoalloc[-nofree] and HOSTSPECs are do not work well together' fi fi
Signature · 7 lines
2.11.0 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xenproject.org/mailman/listinfo/xen-devel
PATCH v2 7/8 mg-repro-setup: actually accept --rebuild -rVAR=VALUE
In reply to Ian JacksonThe glob syntax here was wrong, and the code cs-adjust-flight did not handle it properly either. So --rebuild -r has not worked since it first appeared in:
a1e0e5846f7bb7d82a5db1d7cd643b9f5ca1b9a9
mg-repro-flight: Provide --rebuild to make variant build jobs
---
v2: New patch
--- cs-adjust-flight | 2 +- mg-repro-setup | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
cs-adjust-flight +1 -1
@@ -485,7 +485,7 @@ sub change__repro_buildjobs { my @refspecs; my @varspecs; my %treespecs; - while (@changes && $changes[0] =~ m/^[.=+]/) { + while (@changes && $changes[0] =~ m/^[.=+]|^-r/) { local $_ = shift @changes; if (m/^[.=]/) { push @refspecs, $_;
mg-repro-setup +1 -1
@@ -187,7 +187,7 @@ while [ $# -ne 0 ]; do rebuild_specs=() while true; do case "$1" in - [.=+]*|-r) rebuild_specs+=("$1"); shift ;; + [.=+]*|-r*) rebuild_specs+=("$1"); shift ;; -B?*) rebuilds_blessing=${1#-B}; shift ;; -*) badusage ': bad --rebuild option' ;; *) break ;;
Signature · 7 lines
2.11.0 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xenproject.org/mailman/listinfo/xen-devel
PATCH v2 8/8 mg-repro-setup: Do not wrongly reject multiple --rebuild
In reply to Ian Jackson--rebuild ends the current --rebuild specification.
---
v2: New patch
--- mg-repro-setup | 1 + 1 file changed, 1 insertion(+)
mg-repro-setup +1 -0
@@ -189,6 +189,7 @@ while [ $# -ne 0 ]; do case "$1" in [.=+]*|-r*) rebuild_specs+=("$1"); shift ;; -B?*) rebuilds_blessing=${1#-B}; shift ;; + --rebuild) break ;; -*) badusage ': bad --rebuild option' ;; *) break ;; esac
Signature · 7 lines
2.11.0 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xenproject.org/mailman/listinfo/xen-devel