[Xen-devel] [OSSTEST PATCH v2 5/8] mg-repro-setup: Introduce `statictask' variable

Ian Jackson posted 8 patches 6 years, 7 months ago
[Xen-devel] [OSSTEST PATCH v2 5/8] mg-repro-setup: Introduce `statictask' variable
Posted by Ian Jackson 6 years, 7 months ago
We 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.

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
---
 mg-repro-setup | 28 +++++++++++++++++++---------
 1 file changed, 19 insertions(+), 9 deletions(-)

diff --git a/mg-repro-setup b/mg-repro-setup
index 9a81c565..45c56f6a 100755
--- a/mg-repro-setup
+++ b/mg-repro-setup
@@ -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 \
-- 
2.11.0


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel