]> xenbits.xensource.com Git - people/aperard/osstest.git/commitdiff
mg-repro-setup: --autoalloc-nofree option
authorIan Jackson <ian.jackson@eu.citrix.com>
Thu, 19 Oct 2017 10:13:37 +0000 (11:13 +0100)
committerIan Jackson <Ian.Jackson@eu.citrix.com>
Thu, 19 Oct 2017 10:35:12 +0000 (11:35 +0100)
This lets you run the automatic allocator within your own task, so you
get to keep whatever it found.

Signed-off-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
CC: Wei Liu <wei.liu2@citrix.com>
---
v3: Remove erroneous need to specify the HOSTSPEC "none:"
v2: Some docs, and a warning message.

Signed-off-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
mg-repro-setup

index 25cbc7820807c01738a37addd8a39758b2addeaa..7a122f4cc78597d9e550a1d006f2847d2e332bff 100755 (executable)
@@ -39,7 +39,8 @@ usage () { cat <<END
    -r!<var>             delete runvar
    -B<blessing>                default is 'play'
    -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)
 END
 
 }
@@ -58,6 +59,7 @@ logfile=tmp/mg-repro-setup.log
 duration=28d
 blessing=play
 skipcapture=true
+autoalloc=false
 
 while true; do
        case "$1" in
@@ -72,6 +74,7 @@ while true; do
        -t?*)           duration=${arg#-t}              ;;
        --rogue)        duration=''                     ;;
        --capture)      skipcapture=false               ;;
+       --autoalloc-nofree) autoalloc=true              ;;
        -l*)            logfile=${arg#-l}               ;;
        -r!*)           adjustsets+=("${arg#-r}")       ;;
        -r*=*)          adjustsets+=("${arg#-r}")       ;;
@@ -81,7 +84,8 @@ while true; do
 done
 
 case $# in
-0|1|2|3)       badusage        ;;
+0|1|2)         badusage                ;;
+3)             $autoalloc || badusage  ;;
 esac
 
 example_flight=$1      ; shift
@@ -189,6 +193,10 @@ if [ "${alloc_idents[*]}" ]; then
                progressf " %s" "$host"
        done
        progressf "\n"
+       if $autoalloc; then
+               echo >&2 \
+ 'warning: --autoalloc-nofree and HOSTSPECs are do not work well together'
+       fi
 fi
 
 progress "setting up flight ..."
@@ -204,7 +212,10 @@ if $skipcapture; then adjrunvar skip_testids "capture-logs*"; fi
 
 progress "executing ..."
 
-OSSTEST_NOALLOCATE=1 \
+if ! $autoalloc; then
+       export OSSTEST_NOALLOCATE=1
+fi
+
 ./mg-execute-flight -B$blessing -f$refflight --progress-fd=2 \
        "${mgexecflags[@]}" $flight