]> git.sur5r.net Git - bacula/bacula/blobdiff - regress/tests/backup-bacula-tape
Update
[bacula/bacula] / regress / tests / backup-bacula-tape
index c0535e3d39d2893759976b405f3f1444958a62c9..4c984d57f86f79478653c8a0430a420c4474f1c2 100755 (executable)
@@ -3,61 +3,59 @@
 # Run a simple backup of the Bacula build directory 
 #   to a tape then restore it, we do that twice to ensure that
 #   we can correctly append to a tape.
+# We also use the purge and the relabel commands as
+#   well as a pile of status storage commands.
 #
-cwd=`pwd`
-debug=1
-if test "$debug" -eq 1 ; then
-  out="tee"
-else
-  out="output"
-fi
+TestName="backup-bacula-tape"
+JobName=backuptape
+. scripts/functions
+
 scripts/copy-tape-confs
 scripts/cleanup-tape
 
-echo "${cwd}/build" >/tmp/file-list
+echo "${cwd}/build" >${cwd}/tmp/file-list
+
+change_jobname NightlySave $JobName
+start_test
 
-echo " "
-echo " "
-echo " === Starting Backup Bacula tape test at `date +%R:%S` ==="
-echo " === Starting Backup Bacula tape test at `date +%R:%S` ===" >>working/log
-echo " "
 
 # Write out bconsole commands
-cat <<END_OF_DATA >tmp/bconcmds
+cat <<END_OF_DATA >${cwd}/tmp/bconcmds
 @output /dev/null
 messages
-@$out tmp/log1.out
+@$out ${cwd}/tmp/log1.out
+@#setdebug level=200 storage=DDS-4
 label storage=DDS-4 volume=TestVolume001 slot=0 pool=Default
 purge volume=TestVolume001
 relabel pool=Default storage=DDS-4 oldVolume=TestVolume001 volume=TestVolume002 slot=0
 purge volume=TestVolume002
 relabel pool=Default storage=DDS-4 oldVolume=TestVolume002 volume=TestVolume001 slot=0
-run job=NightlySave yes
+run job=$JobName yes
 status storage=DDS-4
 status storage=DDS-4
 status storage=DDS-4
 status storage=DDS-4
 status storage=DDS-4
 status storage=DDS-4
-sleep 1
+@sleep 1
 status storage=DDS-4
 status storage=DDS-4
 status storage=DDS-4
 status storage=DDS-4
 status storage=DDS-4
-sleep 1
+@sleep 1
 status storage=DDS-4
 status storage=DDS-4
 status storage=DDS-4
 status storage=DDS-4
 status storage=DDS-4
-sleep 1
+@sleep 1
 status storage=DDS-4
 status storage=DDS-4
 status storage=DDS-4
 status storage=DDS-4
 status storage=DDS-4
-sleep 1
+@sleep 1
 status storage=DDS-4
 status storage=DDS-4
 status storage=DDS-4
@@ -68,70 +66,51 @@ messages
 @# 
 @# now do a restore
 @#
-@$out tmp/log2.out
+@$out ${cwd}/tmp/log2.out
 restore where=${cwd}/tmp/bacula-restores select all storage=DDS-4 done
 yes
 wait
+list volumes
 messages
 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=DDS-4
+stop_bacula
 
-bin/bacula stop 2>&1 >/dev/null
 #
 # Now do a second backup after making a few changes
 #
 touch ${cwd}/build/src/dird/*.c
 echo "test test" > ${cwd}/build/src/dird/xxx
 
-cat <<END_OF_DATA >tmp/bconcmds
+cat <<END_OF_DATA >${cwd}/tmp/bconcmds
 @$out /dev/null
 messages
-@$out tmp/log1.out
-run job=NightlySave yes
+@$out ${cwd}/tmp/log1.out
+list volumes
+run job=$JobName yes
 wait
+list volumes
 messages
 @# 
 @# now do a second restore
 @#
-@$out tmp/log2.out
+@$out ${cwd}/tmp/log2.out
+list volumes
 restore where=${cwd}/tmp/bacula-restores select all storage=DDS-4 done
 yes
 wait
+list volumes
 messages
 @$out
 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
-scripts/check_for_zombie_jobs storage=DDS-4
+run_bacula
+check_for_zombie_jobs storage=DDS-4
+stop_bacula
 
-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
-if [ $? != 0 -o $bstat != 0 -o $rstat != 0 ] ; then
-   echo " "
-   echo " "
-   echo "  !!!!! Backup Bacula tape test failed!!! !!!!! "
-   echo "  !!!!! Backup Bacula tape test failed!!! !!!!! " >>test.out
-   echo " "
-else
-   echo "  ===== Backup Bacula tape test OK ===== "
-   echo "  ===== Backup Bacula tape test OK ===== " >>test.out
-   scripts/cleanup
-fi
+check_two_logs
+check_restore_diff
+end_test