]> git.sur5r.net Git - bacula/bacula/blobdiff - regress/tests/four-jobs-tape
Big backport from Enterprise
[bacula/bacula] / regress / tests / four-jobs-tape
index f78cd840a9b9f7d24f325a99be29f7eaea03154b..e1747c513b8ccaeddc3467dc8e82cba6d28f085d 100755 (executable)
@@ -1,37 +1,43 @@
 #!/bin/sh
+#
+# Copyright (C) 2000-2015 Kern Sibbald
+# License: BSD 2-Clause; see file LICENSE-FOSS
+#
+
 #
 # Run a simple backup of the Bacula build directory using the compressed option
 #   then backup four times, each with incremental then finally restore.
 #   It should require at least 4 different bsrs.
 #
-cwd=`pwd`
+TestName="four-jobs-tape"
+JobName=fourjobstape
+. scripts/functions
+
+require_tape_drive
 
-scripts/copy-tape-confs
 scripts/cleanup-tape
-echo "${cwd}/build" >/tmp/file-list
+scripts/copy-tape-confs
+echo "${cwd}/build" >${cwd}/tmp/file-list
 
-echo " "
-echo " "
-echo " === Starting four-jobs-tape at `date +%R:%S` ==="
-echo " === Starting four-jobs-tape at `date +%R:%S` ===" >>working/log
-echo " "
+change_jobname $JobName
+start_test
 
-bin/bacula start 2>&1 >/dev/null
-bin/bconsole -c bin/bconsole.conf <<END_OF_DATA 2>&1 >/dev/null
-@output /dev/null
-estimate job=NightlySave listing
-estimate job=NightlySave listing
-estimate job=NightlySave listing
+cat <<END_OF_DATA >${cwd}/tmp/bconcmds
+@$out /dev/null
+estimate job=$JobName listing
+estimate job=$JobName
+estimate job=$JobName
 messages
-@output tmp/log1.out
-label storage=DDS-4 volume=TestVolume001 slot=0
-run job=NightlySave yes
+@$out ${cwd}/tmp/log1.out
+label storage=tape volume=TestVolume001 slot=0 pool=Default
+run job=$JobName yes
 wait
 messages
 quit
 END_OF_DATA
-scripts/check_for_zombie_jobs storage=DDS-4
-echo "Backup 1 done"
+run_bacula
+
+scripts/check_for_zombie_jobs storage=tape
 # make some files for the incremental to pick up
 touch ${cwd}/build/src/dird/*.c ${cwd}/build/src/dird/*.o
 touch ${cwd}/build/src/lib/*.c ${cwd}/build/src/lib/*.o
@@ -39,66 +45,71 @@ touch ${cwd}/build/src/lib/*.c ${cwd}/build/src/lib/*.o
 #
 # run a second job
 #
-bin/bconsole -c bin/bconsole.conf <<END_OF_DATA 2>&1 >/dev/null
-@output /dev/null
+cat <<END_OF_DATA >${cwd}/tmp/bconcmds
+@$out /dev/null
 messages
-@output tmp/log1.out
-run job=NightlySave level=Incremental yes
+@$out ${cwd}/tmp/log1.out
+run job=$JobName level=Incremental yes
 wait
 messages
 quit
 END_OF_DATA
-scripts/check_for_zombie_jobs storage=DDS-4
-echo "Backup 2 done"
+
+run_bacula
+
+scripts/check_for_zombie_jobs storage=tape
 touch ${cwd}/build/src/dird/*.c
 touch ${cwd}/build/src/lib/*.c ${cwd}/build/src/lib/*.o
 #
 # run a third job
 #
-bin/bconsole -c bin/bconsole.conf <<END_OF_DATA 2>&1 >/dev/null
-@output /dev/null
+cat <<END_OF_DATA >${cwd}/tmp/bconcmds
+@$out /dev/null
 messages
-@output tmp/log1.out
-run job=NightlySave level=Incremental yes
+@$out ${cwd}/tmp/log1.out
+run job=$JobName level=Incremental yes
 wait
 messages
 quit
 END_OF_DATA
-scripts/check_for_zombie_jobs storage=DDS-4
-echo "Backup 3 done"
+
+run_bacula
+
+scripts/check_for_zombie_jobs storage=tape
 # make some files for the incremental to pick up
 touch ${cwd}/build/src/lib/*.c ${cwd}/build/src/lib/*.o
 #
 # run a fourth job
 #
-bin/bconsole -c bin/bconsole.conf <<END_OF_DATA 2>&1 >/dev/null
-@output /dev/null
+cat <<END_OF_DATA >${cwd}/tmp/bconcmds
+@$out /dev/null
 messages
-@output tmp/log1.out
-run job=NightlySave level=Incremental yes
+@$out ${cwd}/tmp/log1.out
+run job=$JobName level=Incremental yes
 wait
 messages
 quit
 END_OF_DATA
-scripts/check_for_zombie_jobs storage=DDS-4
-echo "Backup 4 done"
+run_bacula
+
+scripts/check_for_zombie_jobs storage=tape
 # 
 # now do several restores to ensure we cleanup between jobs
 #
-bin/bconsole -c bin/bconsole.conf <<END_OF_DATA 2>&1 >/dev/null
-@output /dev/null
+cat <<END_OF_DATA >${cwd}/tmp/bconcmds
+@$out /dev/null
 restore where=${cwd}/tmp/bacula-restores select all done
 yes
 wait
 restore where=${cwd}/tmp/bacula-restores select all done
 yes
 wait
-@output tmp/log2.out
+@$out ${cwd}/tmp/log2.out
 @#
 @# now unmount the tape and start two restores
 @#  at the same time
 @#
-unmount storage=DDS-4
+unmount storage=tape
 restore where=${cwd}/tmp/bacula-restores select all done
 yes
 restore where=${cwd}/tmp/bacula-restores select
@@ -106,26 +117,16 @@ unmark *
 mark *
 done
 yes
-mount storage=DDS-4
+mount storage=tape
 wait
 messages
-@output
 quit
 END_OF_DATA
-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 "  !!!!! four-jobs-tape Bacula source failed!!! !!!!! "
-   echo "  !!!!! four-jobs-tape failed!!! !!!!! " >>test.out
-   echo " "
-else
-   echo "  ===== four-jobs-tape Bacula source OK ===== "
-   echo "  ===== four-jobs-tape OK ===== " >>test.out
-   scripts/cleanup
-fi
+
+run_bacula
+check_for_zombie_jobs storage=tape
+stop_bacula
+
+check_two_logs
+check_restore_diff
+end_test