]> 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 14:37:57 +0000 (16: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.

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

index 5caaced6b1fa625ed37105ae8011da6e8f25b9fe..839bb34bf14673000bc89900d9db1135c4becb14 100644 (file)
@@ -43,8 +43,9 @@ else
 fi
 
 do_run=false
+restart=false
 log_flags="-r"
-while getopts "sknp:r-:" OPT; do
+while getopts "sknp:r-:t" OPT; do
     log_flags="$log_flags -$OPT$OPTARG"
     if [ "$OPT" = "-" ] && [ -n "$OPTARG" ]; then
         OPT="${OPTARG%%=*}"
@@ -59,6 +60,7 @@ while getopts "sknp:r-:" OPT; do
         p | port) baseport=$OPTARG ;;
         r | run) do_run=true ;;
         s | skip) exit 77 ;;
+        t | restart) restart=true ;;
         -) break ;;
         *) echo "invalid option" >&2; exit 1 ;;
     esac
@@ -113,8 +115,6 @@ fi
 # Determine which ports to use for this system test.
 eval "$(cd "${srcdir}" && ./get_ports.sh -p "$baseport" -t "$systest")"
 
-restart=false
-
 start_servers() {
     echoinfo "I:$systest:starting servers"
     if $restart; then
@@ -173,14 +173,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
 
@@ -313,7 +315,7 @@ if [ $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 [ "${srcdir}" = "${builddir}" ]; then
             print_outstanding_files
index 307fd25d5ffc456b2088f5456cd3b4f1494b4d42..ea82e615006a7a27f09c15662863dae9b2ae8657 100755 (executable)
@@ -344,7 +344,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 ($!)