]> git.sur5r.net Git - bacula/bacula/blobdiff - regress/scripts/functions
If BASEPORT is not already set, assign it to 8101
[bacula/bacula] / regress / scripts / functions
index da99da660590ddc8e811dc1b36711dd7a07e0e91..798bc0a786721ae385fd7dca179c4244554b5f56 100644 (file)
@@ -9,8 +9,23 @@ start_test()
    echo " === Starting $TestName at `date +%R:%S` ==="
    echo " === Starting $TestName at `date +%R:%S` ===" >>working/log
    echo " "
+   export zstat
 }
 
+require_root()
+{
+MUID=`/usr/bin/id | awk -F= '{print $2}' | awk -F\( '{print $1}'`
+if [ $MUID != 0 ] ; then
+   echo " "
+   echo "You must be root to run this test."
+   echo "  ===== !!!! $TestName not run at `date +%R:%S` ==="
+   echo "  ===== !!!! $TestName not run at `date +%R:%S` !!!! ===== " >>test.out
+   echo " "
+   exit 1
+fi
+}
+
+
 set_debug()
 {
    debug=$1
@@ -24,6 +39,7 @@ set_debug()
 run_bacula()
 {
    debug_wait
+   zstat=0
    if test "$debug" -eq 1 ; then
      bin/bacula-ctl-sd start
      bin/bacula-ctl-fd start
@@ -70,7 +86,7 @@ stop_bacula()
 
 check_for_zombie_jobs()
 {
-   scripts/check_for_zombie_jobs $1
+   scripts/check_for_zombie_jobs $*
 }
 
 change_jobname()
@@ -93,8 +109,20 @@ check_two_logs()
 {
    grep "^  Termination: *Backup OK" tmp/log1.out 2>&1 >/dev/null
    bstat=$?
+   grep "^  Termination: .*Backup Error" tmp/log1.out 2>&1 >/dev/null
+   if test $? -eq 0; then
+      bstat=2
+   fi
    grep "^  Termination: *Restore OK" tmp/log2.out 2>&1 >/dev/null
    rstat=$?
+   grep "^  Termination: *Restore OK -- warning file count mismatch" tmp/log2.out 2>&1 >/dev/null
+   if test $? -eq 0; then
+      rstat=2
+   fi
+   grep "^  Termination: .*Verify Differences" tmp/log2.out 2>&1 >/dev/null
+   if test $? -eq 0; then
+      rstat=3
+   fi
 }
 
 check_restore_diff()
@@ -111,19 +139,30 @@ check_restore_tmp_build_diff()
 
 end_test()
 {
+   if [ $zstat != 0 ] ; then
+      echo " "
+      echo "  !!!!! $TestName failed!!! `date +%R:%S` !!!!! "
+      echo "  !!!!! $TestName failed!!! `date +%R:%S` !!!!! " >>test.out
+      echo "   Status: zombie=$zstat backup=$bstat restore=$rstat diff=$dstat" >>test.out
+      echo " "
+      exit 1
+   fi
    if [ $dstat != 0 -o $bstat != 0 -o $rstat != 0 ] ; then
       echo " "
       echo " "
-      echo "  !!!!! $TestName failed!!! !!!!! "
-      echo "  !!!!! $TestName failed!!! !!!!! " >>test.out
+      echo "  !!!!! $TestName failed!!! `date +%R:%S` !!!!! "
+      echo "  !!!!! $TestName failed!!! `date +%R:%S` !!!!! " >>test.out
       if [ $bstat != 0 -o $rstat != 0 ] ; then
-         echo "  !!!!! Bad Job termination status     !!!!! "
-         echo "  !!!!! Bad Job termination status     !!!!! " >>test.out
+         echo "  !!!!! Bad termination status       !!!!! "
+         echo "  !!!!! Bad termination status       !!!!! " >>test.out
       else
          echo "  !!!!! Restored files differ          !!!!! "
          echo "  !!!!! Restored files differ          !!!!! " >>test.out
       fi
+      echo "   Status: backup=$bstat restore=$rstat diff=$dstat"
+      echo "   Status: backup=$bstat restore=$rstat diff=$dstat" >>test.out
       echo " "
+      exit 1
    else
       echo "  ===== $TestName OK `date +%R:%S` ===== "
       echo "  ===== $TestName OK `date +%R:%S` ===== " >>test.out
@@ -161,6 +200,5 @@ else
    set_debug 0
 fi
 
-# Source the second drive variables
-touch ${cwd}/config.out
-. ${cwd}/config.out
+# Source the configuration variables
+. ${cwd}/config