]> git.sur5r.net Git - bacula/bacula/blobdiff - regress/tests/backup-bacula-test
ebl add runscript regression script (not yet works well)
[bacula/bacula] / regress / tests / backup-bacula-test
index b924881e6833753d7b884a0bab6d750d0b336023..7f50f4674c686330d574ce41bd794e2cbae32342 100755 (executable)
@@ -3,22 +3,16 @@
 # Run a simple backup of the Bacula build directory
 #   then restore it.
 #
-debug=0
-if test "$debug" -eq 1 ; then
-  out="tee"
-else
-  out="output"
-fi
+TestName="backup-bacula-test"
+JobName=backup
+. scripts/functions
+set_debug 0
 
-cwd=`pwd`
-scripts/copy-confs
 scripts/cleanup
+scripts/copy-confs
 
-echo " "
-echo " "
-echo " === Starting Backup Bacula Test at `date +%R:%S` ==="
-echo " === Starting Backup Bacula Test at `date +%R:%S` ===" >>working/log
-echo " "
+change_jobname Client1 $JobName
+start_test
 
 cat <<END_OF_DATA >tmp/bconcmds
 @output /dev/null
@@ -26,7 +20,7 @@ messages
 @$out tmp/log1.out
 label volume=TestVolume001
 @#setdebug level=100 storage=File
-run job=Client1 yes
+run job=$JobName yes
 status storage=File
 status storage=File
 status storage=File
@@ -59,37 +53,10 @@ messages
 quit
 END_OF_DATA
 
-if test "$debug" -eq 1 ; then
-  bin/bacula start
-  cat tmp/bconcmds | bin/bconsole -c bin/bconsole.conf
-else
-  bin/bacula start 2>&1 >/dev/null
-  cat tmp/bconcmds | bin/bconsole -c bin/bconsole.conf  2>&1 >/dev/null
-fi
+run_bacula
+check_for_zombie_jobs storage=File
+stop_bacula
 
-scripts/check_for_zombie_jobs storage=File
-bin/bacula stop 2>&1 >/dev/null
-grep "^  Termination: *Backup OK" tmp/log1.out 2>&1 >/dev/null
-bstat=$?
-grep "^  Termination: *Restore OK" tmp/log2.out 2>&1 >/dev/null
-rstat=$?
-# diff -r build tmp/bacula-restores${cwd}/build 2>&1 >/dev/null
-diff -r build tmp/bacula-restores${cwd}/build
-if [ $? != 0 -o $bstat != 0 -o $rstat != 0 ] ; then
-   echo " "
-   echo " "
-   echo "  !!!!! Backup Bacula Test failed!!! !!!!! "
-   echo "  !!!!! Backup Bacula Test failed!!! !!!!! " >>test.out
-   if [ $bstat != 0 -o $rstat != 0 ] ; then
-      echo "  !!!!! Bad Job termination status     !!!!! "
-      echo "  !!!!! Bad Job termination status     !!!!! " >>test.out
-   else
-      echo "  !!!!! Restored files differ          !!!!! "
-      echo "  !!!!! Restored files differ          !!!!! " >>test.out
-   fi
-   echo " "
-else
-   echo "  ===== Backup Bacula Test OK `date +%R:%S` ===== "
-   echo "  ===== Backup Bacula Test OK `date +%R:%S` ===== " >>test.out
-   scripts/cleanup
-fi
+check_two_logs
+check_restore_diff
+end_test