]> git.sur5r.net Git - bacula/bacula/blobdiff - regress/tests/bscan-tape
Add some debug info
[bacula/bacula] / regress / tests / bscan-tape
index 07c4aea41946a76fc8b97e5d34bab6a6dc72d992..56ef6e273b268af534fc4b645c4e7343fa94d70b 100755 (executable)
@@ -5,40 +5,43 @@
 #   do a bscan and restore.
 #   It should require at least 4 different bsrs.
 #
-cwd=`pwd`
-scripts/copy-tape-confs
-scripts/cleanup-tape
+TestName="bscan-tape"
+JobName=bscantape
+. scripts/functions
+set_debug 0
+
+copy_tape_confs
+
 echo "${cwd}/build" >/tmp/file-list
 
 cp ${cwd}/bin/bacula-sd.conf ${cwd}/tmp/1
 sed "s%# Maximum File Size%  Maximum File Size%" ${cwd}/tmp/1 >${cwd}/bin/bacula-sd.conf
 
-echo " "
-echo " "
-echo " === Starting bscan-tape at `date +%R:%S` ==="
-echo " === Starting bscan-tape at `date +%R:%S` ===" >>working/log
-echo " "
+change_jobname NightlySave $JobName
+start_test
 
-bin/bacula start 2>&1 >/dev/null
-bin/bconsole -c bin/bconsole.conf <<END_OF_DATA 2>&1 >/dev/null
+cat <<END_OF_DATA >tmp/bconcmds
 @output /dev/null
-estimate job=NightlySave listing
-estimate job=NightlySave listing
-estimate job=NightlySave listing
+estimate job=$JobName listing
+estimate job=$JobName listing
+estimate job=$JobName listing
 messages
-@output tmp/log1.out
+@$out tmp/log1.out
 setdebug level=2 storage=DDS-4
 label storage=DDS-4 volume=TestVolume001 slot=0 pool=Default
-run job=NightlySave yes
+run job=$JobName yes
 wait
-run job=NightlySave level=Full yes
+run job=$JobName level=Full yes
 wait
-run job=NightlySave level=Full yes
+run job=$JobName level=Full yes
 wait
 messages
 quit
 END_OF_DATA
-scripts/check_for_zombie_jobs storage=DDS-4
+
+run_bacula
+check_for_zombie_jobs storage=DDS-4
+
 echo "Backup 1 done"
 # make some files for the incremental to pick up
 touch ${cwd}/build/src/dird/*.c ${cwd}/build/src/dird/*.o
@@ -47,32 +50,38 @@ 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 >tmp/bconcmds
+@$out /dev/null
 messages
-@output tmp/log1.out
-run job=NightlySave level=Incremental yes
+@$out tmp/log1.out
+run job=$JobName level=Incremental yes
 wait
 messages
 quit
 END_OF_DATA
+
+run_bacula
 scripts/check_for_zombie_jobs storage=DDS-4
+
 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
 #
-bin/bconsole -c bin/bconsole.conf <<END_OF_DATA 2>&1 >/dev/null 2>&1 >/dev/null
-@output /dev/null
+cat <<END_OF_DATA >tmp/bconcmds
+@$out /dev/null
 messages
-@output tmp/log1.out
-run job=NightlySave level=Incremental yes
+@$out tmp/log1.out
+run job=$JobName level=Incremental yes
 wait
 messages
 quit
 END_OF_DATA
+
+run_bacula
 scripts/check_for_zombie_jobs storage=DDS-4
+
 echo "Backup 3 done"
 # make some files for the incremental to pick up
 touch ${cwd}/build/src/lib/*.c ${cwd}/build/src/lib/*.o
@@ -80,16 +89,21 @@ 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 2>&1 >/dev/null
-@output /dev/null
+cat <<END_OF_DATA >tmp/bconcmds
+@$out /dev/null
 messages
-@output tmp/log1.out
-run job=NightlySave level=Incremental yes
+@$out tmp/log1.out
+run job=$JobName level=Incremental yes
 wait
 messages
 quit
 END_OF_DATA
+
+run_bacula
+
 scripts/check_for_zombie_jobs storage=DDS-4
+stop_bacula
+
 echo "Backup 4 done"
 #
 # now drop and recreate the database
@@ -100,14 +114,13 @@ cd bin
 ./grant_bacula_privileges 2>&1 >/dev/null
 cd ..
 
-bin/bacula stop 2>&1 >/dev/null
 echo "volume=TestVolume001" >tmp/bscan.bsr
-bin/bscan -w working -m -s -v -b tmp/bscan.bsr -c bin/bacula-sd.conf DDS-4 2>&1 >/dev/null
-bin/bacula start 2>&1 >/dev/null
-bin/bconsole -c bin/bconsole.conf <<END_OF_DATA 2>&1 >/dev/null
-@output /dev/null
+bin/bscan -w working -u regress -n regress -m -s -v -b tmp/bscan.bsr -c bin/bacula-sd.conf DDS-4 2>&1 >/dev/null
+
+cat <<END_OF_DATA >tmp/bconcmds
+@$out /dev/null
 messages
-@output tmp/log2.out
+@$out tmp/log2.out
 @# 
 @# now do a restore
 @#
@@ -115,25 +128,15 @@ restore where=${cwd}/tmp/bacula-restores select all storage=DDS-4 done
 yes
 wait
 messages
-@output
+@$out
 quit
 END_OF_DATA
-scripts/check_for_zombie_jobs storage=DDS-4
+
+run_bacula
+check_for_zombie_jobs storage=DDS-4
+stop_bacula
 rm -f  ${cwd}/build/src/lib/dummy
-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 "  !!!!! bscan-tape Bacula source failed!!! !!!!! "
-   echo "  !!!!! bscan-tape failed!!! !!!!! " >>test.out
-   echo " "
-else
-   echo "  ===== bscan-tape Bacula source OK ===== "
-   echo "  ===== bscan-tape OK ===== " >>test.out
-#  scripts/cleanup
-fi
+
+check_two_logs
+check_restore_diff
+end_test