]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
Fix handling of restart option in run.sh
authorMichal Nowak <mnowak@isc.org>
Tue, 11 May 2021 16:06:59 +0000 (18:06 +0200)
committerMichal Nowak <mnowak@isc.org>
Fri, 16 Jul 2021 15:37:58 +0000 (17:37 +0200)
The support for stat.pl's --restart option was incomplete in run.sh.
This change makes sure it's handled properly and that named.run file is
not being removed by clean.sh when the --restart option is used.

(cherry picked from commit a39697635b6963a8acfa1854d757fd6ca28e2a5c)

bin/tests/system/run.sh
bin/tests/system/start.pl

index c0799cc0dc78867eed1b6d5831a68f4093975b47..8fd75602fab5b9b1b84a42a3980d05e867021aa7 100755 (executable)
@@ -36,7 +36,8 @@ else
     clean=true
 fi
 
-while getopts "knp:r-:" flag; do
+restart=false
+while getopts "knp:r-:t" flag; do
     case "$flag" in
     -) case "${OPTARG}" in
                keep) stopservers=false ;;
@@ -46,6 +47,7 @@ while getopts "knp:r-:" flag; do
     k) stopservers=false ;;
     n) clean=false ;;
     p) baseport=$OPTARG ;;
+    t) restart=true ;;
     esac
 done
 shift `expr $OPTIND - 1`
@@ -118,8 +120,6 @@ export CONTROLPORT
 export LOWPORT
 export HIGHPORT
 
-restart=false
-
 start_servers() {
     echoinfo "I:$systest:starting servers"
     if $restart; then
@@ -186,14 +186,16 @@ else
     exit 0
 fi
 
-# Clean up files left from any potential previous runs
-if test -f $systest/clean.sh
-then
-    if ! ( cd "${systest}" && $SHELL clean.sh "$@" ); then
-        echowarn "I:$systest:clean.sh script failed"
-        echofail "R:$systest:FAIL"
-        echoend  "E:$systest:$(date_with_args)"
-        exit 1
+# Clean up files left from any potential previous runs except when
+# started with the --restart option.
+if ! $restart; then
+    if test -f "$systest/clean.sh"; then
+        if ! ( cd "${systest}" && $SHELL clean.sh "$@" ); then
+            echowarn "I:$systest:clean.sh script failed"
+            echofail "R:$systest:FAIL"
+            echoend  "E:$systest:$(date_with_args)"
+            exit 1
+        fi
     fi
 fi
 
@@ -310,7 +312,7 @@ elif [ "$status" -ne 0 ]; then
     echofail "R:$systest:FAIL"
 else
     echopass "R:$systest:PASS"
-    if $clean; then
+    if $clean && ! $restart; then
        ( cd $systest && $SHELL clean.sh "$@" )
        if test -d ../../../.git; then
            git status -su --ignored "${systest}/" 2>/dev/null | \
index b2e72dd666e25fd86a95ad633374f3fcaeaa2c67..8ad0dbe90b32971987669690482e68c13f67a4b4 100755 (executable)
@@ -343,7 +343,7 @@ sub construct_ans_command {
        if ($restart) {
                $command .= " >>ans.run 2>&1 &";
        } else {
-                       $command .= " >ans.run 2>&1 &";
+               $command .= " >ans.run 2>&1 &";
        }
 
        # get the shell to report the pid of the server ($!)