]> git.sur5r.net Git - bacula/bacula/blobdiff - regress/tests/four-jobs-tape
regress: add function to create many dirs
[bacula/bacula] / regress / tests / four-jobs-tape
index 92e2e957651609540debfdd23f22a6bac068379e..86c44b8c31fd7158ae80404b4b80ba390932fb09 100755 (executable)
@@ -4,45 +4,35 @@
 #   then backup four times, each with incremental then finally restore.
 #   It should require at least 4 different bsrs.
 #
-debug=0
-if test "$debug" -eq 1 ; then
-  out="tee"
-else
-  out="output"
-fi
-cwd=`pwd`
-scripts/copy-tape-confs
+TestName="four-jobs-tape"
+JobName=fourjobstape
+. scripts/functions
+
+require_tape_drive
+
 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
 
-cat <<END_OF_DATA >tmp/bconcmds
+cat <<END_OF_DATA >${cwd}/tmp/bconcmds
 @$out /dev/null
-estimate job=NightlySave listing
-estimate job=NightlySave listing
-estimate job=NightlySave listing
+estimate job=$JobName listing
+estimate job=$JobName
+estimate job=$JobName
 messages
-@$out tmp/log1.out
-label storage=DDS-4 volume=TestVolume001 slot=0 pool=Default
-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
-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
 
-scripts/check_for_zombie_jobs storage=DDS-4
+scripts/check_for_zombie_jobs storage=tape
 echo "Backup 1 done"
 # make some files for the incremental to pick up
 touch ${cwd}/build/src/dird/*.c ${cwd}/build/src/dird/*.o
@@ -51,77 +41,61 @@ touch ${cwd}/build/src/lib/*.c ${cwd}/build/src/lib/*.o
 #
 # run a second job
 #
-cat <<END_OF_DATA >tmp/bconcmds
+cat <<END_OF_DATA >${cwd}/tmp/bconcmds
 @$out /dev/null
 messages
-@$out 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
-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
+
+scripts/check_for_zombie_jobs storage=tape
 echo "Backup 2 done"
 touch ${cwd}/build/src/dird/*.c
 touch ${cwd}/build/src/lib/*.c ${cwd}/build/src/lib/*.o
 #
 # run a third job
 #
-cat <<END_OF_DATA >tmp/bconcmds
+cat <<END_OF_DATA >${cwd}/tmp/bconcmds
 @$out /dev/null
 messages
-@$out 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
-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
+
+scripts/check_for_zombie_jobs storage=tape
 echo "Backup 3 done"
 # make some files for the incremental to pick up
 touch ${cwd}/build/src/lib/*.c ${cwd}/build/src/lib/*.o
 #
 # run a fourth job
 #
-cat <<END_OF_DATA >tmp/bconcmds
+cat <<END_OF_DATA >${cwd}/tmp/bconcmds
 @$out /dev/null
 messages
-@$out 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
-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
 
-scripts/check_for_zombie_jobs storage=DDS-4
+scripts/check_for_zombie_jobs storage=tape
 echo "Backup 4 done"
 # 
 # now do several restores to ensure we cleanup between jobs
 #
-cat <<END_OF_DATA >tmp/bconcmds
+cat <<END_OF_DATA >${cwd}/tmp/bconcmds
 @$out /dev/null
 restore where=${cwd}/tmp/bacula-restores select all done
 yes
@@ -129,12 +103,12 @@ wait
 restore where=${cwd}/tmp/bacula-restores select all done
 yes
 wait
-@$out 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
@@ -142,34 +116,16 @@ unmark *
 mark *
 done
 yes
-mount storage=DDS-4
+mount storage=tape
 wait
 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
 
-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