]> git.sur5r.net Git - bacula/bacula/blobdiff - regress/tests/backup-bacula-tape
Update
[bacula/bacula] / regress / tests / backup-bacula-tape
index a8343e0a3c43cf150af3fcc0d38836d0e53bc361..4c984d57f86f79478653c8a0430a420c4474f1c2 100755 (executable)
@@ -3,55 +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`
+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 " "
 
-bin/bacula start 2>&1 >/dev/null
-bin/bconsole -c bin/bconsole.conf <<END_OF_DATA
+# Write out bconsole commands
+cat <<END_OF_DATA >${cwd}/tmp/bconcmds
 @output /dev/null
 messages
-@output tmp/log1.out
-label storage=DDS-4 volume=TestVolume001 slot=0
+@$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
@@ -62,53 +66,51 @@ messages
 @# 
 @# now do a restore
 @#
-@output 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
-bin/bacula stop 2>&1 >/dev/null
+
+run_bacula
+check_for_zombie_jobs storage=DDS-4
+stop_bacula
+
 #
 # Now do a second backup after making a few changes
 #
 touch ${cwd}/build/src/dird/*.c
 echo "test test" > ${cwd}/build/src/dird/xxx
-bin/bacula start 2>&1 >/dev/null
-bin/bconsole -c bin/bconsole.conf <<END_OF_DATA
-@output /dev/null
+
+cat <<END_OF_DATA >${cwd}/tmp/bconcmds
+@$out /dev/null
 messages
-@output 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
 @#
-@output 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
-@output
+@$out
 quit
 END_OF_DATA
-scripts/check_for_zombie_jobs storage=DDS-4
 
-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
+run_bacula
+check_for_zombie_jobs storage=DDS-4
+stop_bacula
+
+check_two_logs
+check_restore_diff
+end_test