]> git.sur5r.net Git - bacula/bacula/blobdiff - regress/tests/backup-bacula-tape
regress: add comment to win32-fd-test
[bacula/bacula] / regress / tests / backup-bacula-tape
index bb9272d416acc52f3b270fb5692c7f107ec4d3a7..f24979535bc60d5e478d0f066344b2d0116749e1 100755 (executable)
 # 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.
 #
-debug=0 
-if test "$debug" -eq 1 ; then
-  out="tee"
-else
-  out="output"
-fi
+TestName="backup-bacula-tape"
+JobName=backuptape
+. scripts/functions
+
+require_tape_drive
 
-cwd=`pwd`
 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
-@output /dev/null
+cat <<END_OF_DATA >${cwd}/tmp/bconcmds
+@$out /dev/null
 messages
-@$out tmp/log1.out
-label storage=DDS-4 volume=TestVolume001 slot=0 pool=Default
+@$out ${cwd}/tmp/log1.out
+@#setdebug level=200 storage=tape
+label storage=tape volume=TestVolume001 slot=0 pool=Default
 purge volume=TestVolume001
-relabel pool=Default storage=DDS-4 oldVolume=TestVolume001 volume=TestVolume002 slot=0
+relabel pool=Default storage=tape 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
-status storage=DDS-4
-status storage=DDS-4
-status storage=DDS-4
-status storage=DDS-4
-status storage=DDS-4
-status storage=DDS-4
+relabel pool=Default storage=tape oldVolume=TestVolume002 volume=TestVolume001 slot=0
+run job=$JobName yes
+status storage=tape
+status storage=tape
+status storage=tape
+status storage=tape
+status storage=tape
+status storage=tape
 @sleep 1
-status storage=DDS-4
-status storage=DDS-4
-status storage=DDS-4
-status storage=DDS-4
-status storage=DDS-4
+status storage=tape
+status storage=tape
+status storage=tape
+status storage=tape
+status storage=tape
 @sleep 1
-status storage=DDS-4
-status storage=DDS-4
-status storage=DDS-4
-status storage=DDS-4
-status storage=DDS-4
+status storage=tape
+status storage=tape
+status storage=tape
+status storage=tape
+status storage=tape
 @sleep 1
-status storage=DDS-4
-status storage=DDS-4
-status storage=DDS-4
-status storage=DDS-4
-status storage=DDS-4
+status storage=tape
+status storage=tape
+status storage=tape
+status storage=tape
+status storage=tape
 @sleep 1
-status storage=DDS-4
-status storage=DDS-4
-status storage=DDS-4
-status storage=DDS-4
-status storage=DDS-4
+status storage=tape
+status storage=tape
+status storage=tape
+status storage=tape
+status storage=tape
 wait
 messages
 @# 
 @# now do a restore
 @#
-@$out tmp/log2.out
-restore where=${cwd}/tmp/bacula-restores select all storage=DDS-4 done
+@$out ${cwd}/tmp/log2.out
+restore where=${cwd}/tmp/bacula-restores select all storage=tape 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=tape
+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
+@$out ${cwd}/tmp/log1.out
 list volumes
-run job=NightlySave yes
+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
+restore where=${cwd}/tmp/bacula-restores select all storage=tape 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=tape
+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