diff mbox series

[OSSTEST,3/4] mg-repro-setup: Introduce `statictask' variable

Message ID 20190520154147.30675-4-ian.jackson@eu.citrix.com (mailing list archive)
State New, archived
Headers show
Series mg-*: easier transient autoalloc repro | expand

Commit Message

Ian Jackson May 20, 2019, 3:41 p.m. UTC
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 mbox series

Patch

diff --git a/mg-repro-setup b/mg-repro-setup
index 5a52e617..b60389d8 100755
--- a/mg-repro-setup
+++ b/mg-repro-setup
@@ -103,6 +103,7 @@  duration=28d
 blessing=play
 skipcapture=true
 autoalloc=false
+statictask=true
 
 while true; do
 	case "$1" in
@@ -117,7 +118,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
@@ -258,16 +259,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 \