]> git.sur5r.net Git - bacula/bacula/commitdiff
Update more tests
authorKern Sibbald <kern@sibbald.com>
Fri, 30 Jun 2006 09:56:48 +0000 (09:56 +0000)
committerKern Sibbald <kern@sibbald.com>
Fri, 30 Jun 2006 09:56:48 +0000 (09:56 +0000)
git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@3098 91ce42f0-d328-0410-95d8-f526ca767f89

29 files changed:
regress/scripts/functions
regress/tests/backup-bacula-tape
regress/tests/backup-bacula-test
regress/tests/backup-win32-tape
regress/tests/bextract-test
regress/tests/bscan-tape
regress/tests/bscan-test
regress/tests/bsr-opt-test
regress/tests/btape-fill-full-tape
regress/tests/btape-fill-tape
regress/tests/compressed-test
regress/tests/concurrent-jobs-test
regress/tests/differential-test
regress/tests/eot-fail-tape
regress/tests/filed-crypto-test
regress/tests/fixed-block-size-tape
regress/tests/four-concurrent-jobs-tape
regress/tests/four-concurrent-jobs-test
regress/tests/four-jobs-tape
regress/tests/incremental-2disk
regress/tests/incremental-tape
regress/tests/relabel-tape
regress/tests/restore-by-file-tape
regress/tests/small-file-size-tape
regress/tests/truncate-bug-tape
regress/tests/two-pool-tape
regress/tests/two-volume-tape
regress/tests/win32-backup-tape
regress/tests/win32-to-linux-tape

index 3a0228cd3f2e53ddb87b179c3cc199e0547b2a73..8c924a7ba73af947afefd60840abce8fef797394 100644 (file)
@@ -100,3 +100,6 @@ end_test()
       scripts/cleanup
    fi
 }
+
+# Save current directory
+cwd=`pwd`
index 37c42382a508fc2422489faee915d67252af669b..ae7e17d59e9f8072114788017a299ba241c6f80e 100755 (executable)
@@ -6,24 +6,19 @@
 # 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
+set_debug 0
 
-cwd=`pwd`
 scripts/copy-tape-confs
 scripts/cleanup-tape
 
 echo "${cwd}/build" >/tmp/file-list
 
-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 " "
+change_job $JobName
+start_test
+
 
 # Write out bconsole commands
 cat <<END_OF_DATA >tmp/bconcmds
@@ -79,15 +74,10 @@ 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=DDS-4
+stop_bacula
 
-bin/bacula stop 2>&1 >/dev/null
 #
 # Now do a second backup after making a few changes
 #
@@ -117,29 +107,10 @@ 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
+check_for_zombie_jobs storage=DDS-4
+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
index 2c6d8e24cd3081dc4df422f77b59d8be4018d175..aa20cab740cbc4ad20d5ac28cc158e03b5db67af 100755 (executable)
@@ -8,7 +8,6 @@ JobName=backup
 . scripts/functions
 set_debug 0
 
-cwd=`pwd`
 scripts/copy-confs
 scripts/cleanup
 
index 3723b536dd64eaa84f61c123b3148cd84c7db79c..bfecfaa9132e5ad2601078ac574ad2537cc17280 100755 (executable)
@@ -4,23 +4,24 @@
 #   to a tape then restore it, we do that twice to ensure that
 #   we can correctly append to a tape.
 #
-cwd=`pwd`
+TestName="backup-win32-tape"
+JobName=backupwintape
+. scripts/functions
+set_debug 0
+
 scripts/copy-win32-confs
 scripts/cleanup-tape
 
 echo "${cwd}/build" >/tmp/file-list
 
-echo " "
-echo " "
-echo " === Starting Backup Win32 tape test at `date +%R:%S` ==="
-echo " === Starting Backup Win32 tape test 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
+cat <<END_OF_DATA >tmp/bconcmds
 @output /dev/null
 messages
-@tee tmp/log1.out
+@$out tmp/log1.out
 label storage=DDS-4 volume=TestVolume001 slot=0 pool=Default
 run job=NightlySave yes
 @sleep 10
@@ -32,25 +33,17 @@ messages
 @# 
 @# now do a restore
 @#
-@#output tmp/log2.out
+@$outt tmp/log2.out
 @#restore where=${cwd}/tmp/bacula-restores select all storage=DDS-4 done
 @#yes
 @#wait
 @#messages
 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=$?
-if [ $bstat != 0 ] ; then
-   echo " "
-   echo " "
-   echo "  !!!!! Backup Win32 tape test failed!!! !!!!! "
-   echo "  !!!!! Backup Win32 tape test failed!!! !!!!! " >>test.out
-   echo " "
-else
-   echo "  ===== Backup Win32 tape test OK ===== "
-   echo "  ===== Backup Win32 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
index 0289577ce9d4dc69b91c7f2e84454ff16e618d9a..b000039f1cb7ac1be41af9153ac3ce6b398a6be4 100755 (executable)
@@ -9,13 +9,11 @@ JobName="bextract"
 . scripts/functions
 set_debug 0
 
-
-cwd=`pwd`
 scripts/copy-test-confs
 scripts/cleanup
 echo "${cwd}/build" >/tmp/file-list
-change_jobname $JobName 
 
+change_jobname $JobName 
 start_test
 
 cat <<END_OF_DATA >tmp/bconcmds
index 5225103a89ad3ea51dbade59198d2422ba794779..f230d49a7d53370d5db9c06755dce533e4f495b4 100755 (executable)
@@ -5,14 +5,11 @@
 #   do a bscan and restore.
 #   It should require at least 4 different bsrs.
 #
-debug=0
-if test "$debug" -eq 1 ; then
-  out="tee"
-else
-  out="output"
-fi
+TestName="bscan-tape"
+JobName=bscantape
+. scripts/functions
+set_debug 0
 
-cwd=`pwd`
 scripts/copy-tape-confs
 scripts/cleanup-tape
 echo "${cwd}/build" >/tmp/file-list
@@ -20,26 +17,23 @@ 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 $JobName
+start_test
 
 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
 @$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
@@ -65,7 +59,7 @@ cat <<END_OF_DATA >tmp/bconcmds
 @$out /dev/null
 messages
 @$out tmp/log1.out
-run job=NightlySave level=Incremental yes
+run job=$JobName level=Incremental yes
 wait
 messages
 quit
@@ -89,7 +83,7 @@ cat <<END_OF_DATA >tmp/bconcmds
 @$out /dev/null
 messages
 @$out tmp/log1.out
-run job=NightlySave level=Incremental yes
+run job=$JobName level=Incremental yes
 wait
 messages
 quit
@@ -115,7 +109,7 @@ cat <<END_OF_DATA >tmp/bconcmds
 @$out /dev/null
 messages
 @$out tmp/log1.out
-run job=NightlySave level=Incremental yes
+run job=$JobName level=Incremental yes
 wait
 messages
 quit
@@ -157,22 +151,12 @@ messages
 @$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
index 65b85031ef642999642368f8e88e9a72b48b58e6..44bfe9c1b29b34d61288302335480c2d575d09f5 100755 (executable)
@@ -15,8 +15,8 @@ cwd=`pwd`
 scripts/copy-test-confs
 scripts/cleanup
 echo "${cwd}/build" >/tmp/file-list
-change_jobname $JobName
 
+change_jobname $JobName
 start_test
 
 cat <<END_OF_DATA >tmp/bconcmds
index fa61dde540c5b310f790621360a1a41ae19c1ceb..e4ca9a31575df86d3c6cd7326667feda805c45b9 100755 (executable)
@@ -11,10 +11,10 @@ JobName=bsr-opt
 . scripts/functions
 set_debug 0
 
-cwd=`pwd`
 scripts/copy-test-confs
 scripts/cleanup
 echo "${cwd}/build" >/tmp/file-list
+
 change_jobname $JobName
 
 start_test
index c61e5ddc3dac0fe523bfd5aa27769d7116c972d9..f4ba59fb5bf45f4e90458fdf16fd94e9e65f6898 100755 (executable)
@@ -2,15 +2,16 @@
 #
 # Test the fill command in btape
 #
-cwd=`pwd`
+TestName="btape-fill-full-tape"
+JobName=AutoLabel
+. scripts/functions
+set_debug 0
+
 scripts/copy-tape-confs
 scripts/cleanup-tape
 
-echo " "
-echo " "
-echo " === Starting btape fill test at `date +%R:%S` ==="
-echo " === Starting btape fill test at `date +%R:%S` ===" >>working/log
-echo " "
+change_jobname $JobName
+start_test
 
 bin/btape -c bin/bacula-sd.conf DDS-4 <<END_OF_DATA 2>&1 >tmp/log1.out
 fill
index c97fd11f2bbb7ba274581a56aa4634848f681c7c..e658e966e91d4927a24a9fc3583921c5925048ca 100755 (executable)
@@ -2,7 +2,11 @@
 #
 # Test the fill command in btape
 #
-cwd=`pwd`
+TestName="btape-fill-tape"
+JobName=filltape
+. scripts/functions
+set_debug 0
+
 scripts/copy-tape-confs
 scripts/cleanup-tape
 
@@ -11,12 +15,8 @@ echo "${cwd}/build" >/tmp/file-list
 cp ${cwd}/bin/bacula-sd.conf ${cwd}/tmp/1
 sed "s%# MaximumVolumeSize%  MaximumVolumeSize%" ${cwd}/tmp/1 >${cwd}/bin/bacula-sd.conf
 
-echo " "
-echo " "
-echo " === Starting btape fill test at `date +%R:%S` ==="
-echo " === Starting btape fill test at `date +%R:%S` ===" >>working/log
-echo " "
-exit
+start_test
+
 bin/btape -c bin/bacula-sd.conf DDS-4 <<END_OF_DATA 2>&1 >tmp/log1.out
 fill
 s
index c1e4cf161a92ffcd0bd1af51ed6de9588a841559..8f10d91599cc3e7268cfb38a7ef8bfed8e15ddce 100755 (executable)
@@ -3,25 +3,24 @@
 # Run a simple backup of the Bacula build directory using the compressed option
 #   then restore it.
 #
-cwd=`pwd`
+TestName="compressed-test"
+JobName=compressed
+. scripts/functions
+set_debug 0
+
 scripts/copy-test-confs
 scripts/cleanup
 echo "${cwd}/build" >/tmp/file-list
 
-echo " "
-echo " "
-echo " === Starting compressed-test at `date +%R:%S` ==="
-echo " === Starting compressed-test at `date +%R:%S` ===" >>working/log
-echo " "
-
-bin/bacula start 2>&1 >/dev/null
-exit
-bin/bconsole -c bin/bconsole.conf <<END_OF_DATA 2>&1 >/dev/null
-@tee /dev/null
+start_test
+      
+cat <<END_OF_DATA >tmp/bconcmds
+@output
+messages
+@$out tmp/log1.out
 status all
 status all
 messages
-@tee tmp/log1.out
 label storage=File volume=TestVolume001
 run job=CompressedTest storage=File yes
 wait
@@ -29,7 +28,7 @@ messages
 @# 
 @# now do a restore
 @#
-@tee tmp/log2.out
+@$out tmp/log2.out
 restore where=${cwd}/tmp/bacula-restores select storage=File
 unmark *
 mark *
@@ -37,31 +36,15 @@ done
 yes
 wait
 messages
-@tee
+@output
 quit
 END_OF_DATA
-scripts/check_for_zombie_jobs storage=File
-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 "  !!!!! compressed-test Bacula source failed!!! !!!!! "
-   echo "  !!!!! compressed-test failed!!! !!!!! " >>test.out
-   if [ $bstat != 0 -o $rstat != 0 ] ; then
-      echo "  !!!!! Bad Job termination status     !!!!! "
-      echo "  !!!!! Bad Job termination status     !!!!! " >>test.out
-   else
-      echo "  !!!!! Restored files differ          !!!!! "
-      echo "  !!!!! Restored files differ          !!!!! " >>test.out
-   fi
-   echo " "
-else
-   echo "  ===== compressed-test Bacula source OK `date +%R:%S` ===== "
-   echo "  ===== compressed-test OK `date +%R:%S` ===== " >>test.out
-   scripts/cleanup
-fi
+
+run_bacula
+check_for_zombie_jobs storage=File
+stop_bacula
+
+check_two_logs
+check_restore_diff
+end_test
+
index 4d2ffa234c1345d9ad8a6694f232748d7f77d068..5231c09674db6f62fd2a0b3db2145cd2a2792777 100755 (executable)
@@ -2,7 +2,12 @@
 #
 # Run two jobs at the same time
 #
-cwd=`pwd`
+
+TestName="concurrent-jobs-test"
+JobName=concurrent-jobs
+. scripts/functions
+set_debug 0
+
 scripts/copy-test-confs
 scripts/cleanup
 echo "${cwd}/tmp/largefile" >/tmp/file-list
@@ -23,16 +28,12 @@ fi
 
 echo "largefile created"
 
-echo " "
-echo " "
-echo " === Starting concurrent-jobs-test at `date +%R:%S` ==="
-echo " "
-
-bin/bacula start 2>&1 >/dev/null
-bin/bconsole -c bin/bconsole.conf <<END_OF_DATA 2>&1 >/dev/null 2>&1 >/dev/null
+start_test
+     
+cat <<END_OF_DATA >tmp/bconcmds
 @output /dev/null
 messages
-@output tmp/log1.out
+@$out  tmp/log1.out
 label storage=File volume=TestVolume001
 run job=CompressedTest level=Full yes
 run job=CompressedTest level=Full yes
@@ -43,7 +44,7 @@ messages
 @# 
 @# now do a restore
 @#
-@output tmp/log2.out
+@$out   tmp/log2.out
 restore where=${cwd}/tmp/bacula-restores select storage=File
 unmark *
 mark *
@@ -54,29 +55,11 @@ messages
 @output
 quit
 END_OF_DATA
-scripts/check_for_zombie_jobs storage=File
 
-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 tmp/largefile  tmp/bacula-restores${cwd}/tmp/largefile 2>&1 >/dev/null
-if [ $? != 0 -o $bstat != 0 -o $rstat != 0 ] ; then
-   echo " "
-   echo " "
-   echo "  !!!!! concurrent-jobs-test Bacula source failed!!! !!!!! "
-   echo "  !!!!! concurrent-jobs-test failed!!! !!!!! " >>test.out
-   if [ $bstat != 0 -o $rstat != 0 ] ; then
-      echo "  !!!!! Bad Job termination status     !!!!! "
-      echo "  !!!!! Bad Job termination status     !!!!! " >>test.out
-   else
-      echo "  !!!!! Restored files differ          !!!!! "
-      echo "  !!!!! Restored files differ          !!!!! " >>test.out
-   fi
-   echo " "
-else
-   echo "  ===== concurrent-jobs-test Bacula source OK `date +%R:%S` ===== "
-   echo "  ===== concurrent-jobs-test OK `date +%R:%S` ===== " >>test.out
-   scripts/cleanup
-fi
+run_bacula
+check_for_zombie_jobs storage=File
+stop_bacula
+
+check_two_logs
+check_restore_diff
+end_test
index a77ddb2fd10fd68be30324bd2410ac49ef476f65..80c9d692485ff8a4028a1bd6b57df5d682740232 100755 (executable)
@@ -8,7 +8,6 @@ JobName=differential
 . scripts/functions
 set_debug 0
 
-cwd=`pwd`
 scripts/copy-test-confs
 scripts/cleanup
 echo "${cwd}/tmp/build" >/tmp/file-list
index 049b745c92300c586f5cafe1893a4d93f54e4f13..55281032ce7012fa572963bab70e048f0af02a99 100755 (executable)
@@ -3,7 +3,11 @@
 # Run a simple backup of the Bacula build directory 
 #  to two tapes where the maximum tape file size is set to 1M
 #
-cwd=`pwd`
+TestName="eot-fail-tape"
+JobName=eotfailtape
+. scripts/functions
+set_debug 0
+
 scripts/copy-tape-confs
 scripts/cleanup-tape
  
@@ -14,26 +18,22 @@ echo "s%# Maximum File Size%  Maximum File Size%g" >${out}
 cp -f ${cwd}/bin/bacula-sd.conf ${cwd}/tmp/1
 sed -f ${out} ${cwd}/tmp/1 >${cwd}/bin/bacula-sd.conf
 
-echo " "
-echo " "
-echo " === Starting eot-fail-tape test at `date +%R:%S` ==="
-echo " === Starting eot-fail-tape test at `date +%R:%S` ===" >>working/log
-echo " "
+change_jobname $JobName
+start_test
 
-bin/bacula start -d100
-bin/bconsole -c bin/bconsole.conf <<END_OF_DATA 2>&1 >/dev/null
-@tee /dev/null
+cat <<END_OF_DATA >tmp/bconcmds
+@output /dev/null
 messages
-@tee tmp/log1.out
+@$out tmp/log1.out
 label storage=DDS-4 volume=TestVolume001 slot=0 pool=Default
 update Volume=TestVolume001 MaxVolBytes=3000000
-run job=NightlySave yes
+run job=$JobName yes
 wait
 messages
 @# 
 @# now do a restore
 @#
-@tee tmp/log2.out
+@$out tmp/log2.out
 restore where=${cwd}/tmp/bacula-restores select all storage=DDS-4 done
 yes
 wait
@@ -41,22 +41,12 @@ messages
 @tee
 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 "  !!!!! eot-fail-tape test Bacula source failed!!! !!!!! "
-   echo "  !!!!! eot-fail-tape test failed!!! !!!!! " >>test.out
-   echo " "
-else
-   echo "  ===== eot-fail-tape test Bacula source OK ===== "
-   echo "  ===== eot-fail-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
+
index 935d18dcaa868a4cd8b76696ae9f0134d66c61f8..ec78307f752bfc1574aa0196e5e263a3bc17df05 100755 (executable)
@@ -8,12 +8,11 @@ JobName=Crypto
 . scripts/functions
 set_debug 0
 
-cwd=`pwd`
 scripts/copy-crypto-confs
 scripts/cleanup
 echo "${cwd}/build" >/tmp/file-list
-change_jobname $JobName
 
+change_jobname $JobName
 start_test
 
 cat <<END_OF_DATA >tmp/bconcmds
index 69982162c2edada318516142704eccd69bbe755a..4d07bccdf13f0586d232a834c0907b0dc4986dcb 100755 (executable)
@@ -4,13 +4,11 @@
 #   to a tape where we set the minimum and maximum block
 #   sizes.
 #
-debug=0
-if test "$debug" -eq 1 ; then
-  out="tee"
-else
-  out="output"
-fi
-cwd=`pwd`
+TestName="fixed-block-size-tape"
+JobName=fixedblocksize
+. scripts/functions
+set_debug 0
+
 scripts/copy-tape-confs
 scripts/cleanup-tape
 echo "${cwd}/build" >/tmp/file-list
@@ -28,11 +26,9 @@ if [ $? != 0 ] ; then
 fi
 rm -f ${cwd}/tmp/1 ${cwd}/tmp/2
 
-echo " "
-echo " "
-echo " === Starting Fixed Block Size test at `date +%R:%S` ==="
-echo " === Starting Fixed Block Size test at `date +%R:%S` ===" >>working/log
-echo " "
+change_jobname $JobName
+start_test
+
 
 cat <<END_OF_DATA >tmp/bconcmds
 @$out /dev/null
@@ -56,29 +52,11 @@ 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
 
-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 "  !!!!! Fixed Block Size test Bacula source failed!!! !!!!! "
-   echo "  !!!!! Fixed Block Size test failed!!! !!!!! " >>test.out
-   echo " "
-else
-   echo "  ===== Fixed Block Size test Bacula source OK ===== "
-   echo "  ===== Fixed Block Size 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
index 8dcf0d8cbe398370709dcc67b9c9485d67d564dc..d841bedaa1abfbe573a4f7a7f517b9a5901cfa40 100755 (executable)
@@ -2,34 +2,28 @@
 #
 # Run two jobs at the same time
 #
-debug=0
-if test "$debug" -eq 1 ; then
-  out="tee"
-else
-  out="output"
-fi
+TestName="auto-label-test"
+JobName=AutoLabel
+. scripts/functions
+set_debug 0
 
-cwd=`pwd`
 scripts/copy-tape-confs
 scripts/cleanup-tape
 
 echo "${cwd}/build" >/tmp/file-list
 
-echo " "
-echo " "
-echo " === Starting four-concurrent-jobs-tape at `date +%R:%S` ==="
-echo " === Starting four-concurrent-jobs-tape at `date +%R:%S` ===" >>working/log
-echo " "
+change_jobname $JobName
+start_test
 
 cat <<END_OF_DATA >tmp/bconcmds
 @output /dev/null
 messages
 @$out tmp/log1.out
 label storage=DDS-4 volume=TestVolume001 slot=0 pool=Default
-run job=NightlySave level=Full Storage=DDS-4 yes
-run job=NightlySave level=Full Storage=DDS-4 yes
-run job=NightlySave level=Full Storage=DDS-4 yes
-run job=NightlySave level=Full Storage=DDS-4 yes
+run job=$JobName level=Full Storage=DDS-4 yes
+run job=$JobName level=Full Storage=DDS-4 yes
+run job=$JobName level=Full Storage=DDS-4 yes
+run job=$JobName level=Full Storage=DDS-4 yes
 @sleep 2
 status dir
 @sleep 5
@@ -52,31 +46,11 @@ 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
-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-concurrent-jobs-tape Bacula source failed!!! !!!!! "
-   echo "  !!!!! four-concurrent-jobs-tape failed!!! !!!!! " >>test.out
-   echo " "
-   exit 1
-else
-   echo "  ===== four-concurrent-jobs-tape Bacula source OK ===== "
-   echo "  ===== four-concurrent-jobs-tape OK ===== " >>test.out
-   scripts/cleanup
-   exit 0
-fi
+run_bacula
+check_for_zombie_jobs storage=DDS-4
+stop_bacula
+
+check_two_logs
+check_restore_diff
+end_test
index f1174b4b17753b085af508e96364bebc9c38b88b..95e88a16b2daa735342627ff49c614c40617fd0c 100755 (executable)
@@ -2,22 +2,23 @@
 #
 # Run two jobs at the same time
 #
-cwd=`pwd`
+TestName="four-concurrent-jobs-test"
+JobName=Four-concurrent-jobs
+. scripts/functions
+set_debug 0
+
 scripts/copy-test-confs
 scripts/cleanup
 echo "${cwd}/build" >/tmp/file-list
 
-echo " "
-echo " "
-echo " === Starting four-concurrent-jobs-test at `date +%R:%S` ==="
-echo " === Starting four-concurrent-jobs-test 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
+cat <<END_OF_DATA >tmp/bconcmds
 @output /dev/null
 messages
-@output tmp/log1.out
+@$out   tmp/log1.out
 label storage=File1
 TestVolume001
 label storage=File1
@@ -25,16 +26,16 @@ TestVolume002
 update Volume=TestVolume001 MaxVolBytes=100000000
 @#50000000
 @#12
-run job=NightlySave level=Full Storage=File1
+run job=$JobName level=Full Storage=File1
 yes
 reload
-run job=NightlySave level=Full Storage=File1
+run job=$JobName level=Full Storage=File1
 yes
 reload
-run job=NightlySave level=Full Storage=File1
+run job=$JobName level=Full Storage=File1
 yes
 reload
-run job=NightlySave level=Full Storage=File1
+run job=$JobName level=Full Storage=File1
 yes
 reload
 reload
@@ -53,7 +54,7 @@ messages
 @# 
 @# now do a restore
 @#
-@output tmp/log2.out
+@$out   tmp/log2.out
 restore where=${cwd}/tmp/bacula-restores select storage=File1
 unmark *
 mark *
@@ -66,31 +67,11 @@ messages
 @output
 quit
 END_OF_DATA
-scripts/check_for_zombie_jobs storage=File1
 
-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-concurrent-jobs-test Bacula source failed!!! !!!!! "
-   echo "  !!!!! four-concurrent-jobs-test failed!!! !!!!! " >>test.out
-   if [ $bstat != 0 -o $rstat != 0 ] ; then
-      echo "  !!!!! Bad Job termination status     !!!!! "
-      echo "  !!!!! Bad Job termination status     !!!!! " >>test.out
-   else
-      echo "  !!!!! Restored files differ          !!!!! "
-      echo "  !!!!! Restored files differ          !!!!! " >>test.out
-   fi
-   echo " "
-   exit 1
-else
-   echo "  ===== four-concurrent-jobs-test Bacula source OK `date +%R:%S` ===== "
-   echo "  ===== four-concurrent-jobs-test OK `date +%R:%S` ===== " >>test.out
-   scripts/cleanup
-   exit 0
-fi
+run_bacula
+check_for_zombie_jobs storage=File1
+stop_bacula
+
+check_two_logs
+check_restore_diff
+end_test
index 92e2e957651609540debfdd23f22a6bac068379e..449f74275a4b1fb9e58047563b35a56e10aa1b02 100755 (executable)
@@ -4,32 +4,27 @@
 #   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`
+TestName="four-jobs-tape"
+JobName=fourjobstape
+. scripts/functions
+set_debug 0
+
 scripts/copy-tape-confs
 scripts/cleanup-tape
 echo "${cwd}/build" >/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
 @$out /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
 @$out tmp/log1.out
 label storage=DDS-4 volume=TestVolume001 slot=0 pool=Default
-run job=NightlySave yes
+run job=$JobName yes
 wait
 messages
 quit
@@ -55,7 +50,7 @@ cat <<END_OF_DATA >tmp/bconcmds
 @$out /dev/null
 messages
 @$out tmp/log1.out
-run job=NightlySave level=Incremental yes
+run job=$JobName level=Incremental yes
 wait
 messages
 quit
@@ -79,7 +74,7 @@ cat <<END_OF_DATA >tmp/bconcmds
 @$out /dev/null
 messages
 @$out tmp/log1.out
-run job=NightlySave level=Incremental yes
+run job=$JobName level=Incremental yes
 wait
 messages
 quit
@@ -103,7 +98,7 @@ cat <<END_OF_DATA >tmp/bconcmds
 @$out /dev/null
 messages
 @$out tmp/log1.out
-run job=NightlySave level=Incremental yes
+run job=$JobName level=Incremental yes
 wait
 messages
 quit
@@ -148,28 +143,11 @@ 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=DDS-4
+stop_bacula
+
+check_two_logs
+check_restore_diff
+end_test
index d3907eb52494fba15d3dbb3c575d5b7a81f51162..9294c3368633f77946fb839b6978cdc7cdc0fa67 100755 (executable)
@@ -5,20 +5,18 @@
 #
 # This script uses the virtual disk autochanger
 #
+TestName="incremental-2disk-test"
+JobName=Inc2disk
+. scripts/functions
+set_debug 0
+
 . config.out
 if test x${AUTOCHANGER} = x/dev/null ; then
    echo "incremental-2disk test skipped. No autochanger."
    exit
 fi
 
-debug=0
-if test "$debug" -eq 1 ; then
-  out="tee"
-else
-  out="output"
-fi
-cwd=`pwd`
-bin/bacula stop  2>&1 >/dev/null
+stop_bacula
 cd bin
 ./drop_bacula_tables >/dev/null 2>&1
 ./make_bacula_tables >/dev/null 2>&1
@@ -38,11 +36,8 @@ echo "${cwd}/tmp/build/ficheriro1.txt" >restore-list
 echo "${cwd}/tmp/build/ficheriro2.txt" >>restore-list
 cd ${cwd}
 
-echo " "
-echo " "
-echo " === Starting incremental-2disk test ==="
-echo " === Starting incremental-2disk test ===" >>working/log
-echo " "
+change_jobname $JobName
+start_test
 
 # Write out bconsole commands
 cat <<END_OF_DATA >tmp/bconcmds
@@ -51,28 +46,25 @@ messages
 @$out tmp/log1.out
 label storage=DDS-4 volume=TestVolume001 slot=1 Pool=Default drive=0
 label storage=DDS-4 volume=TestVolume002 slot=2 Pool=Default drive=0
-run job=NightlySave yes
+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
+
 echo "ficheriro1.txt" >${cwd}/tmp/build/ficheriro1.txt
 echo "ficheriro2.txt" >${cwd}/tmp/build/ficheriro2.txt
-bin/bconsole -c bin/bconsole.conf <<END_OF_DATA
+
+
+cat <<END_OF_DATA >tmp/bconcmds
 @$out /dev/null
 messages
 @$out tmp/log1.out
 @# Force Incremental on the second Volume
 update volume=TestVolume001 VolStatus=Used
-run level=Incremental job=NightlySave yes
+run level=Incremental job=$JobName yes
 wait
 messages
 @# 
@@ -89,24 +81,16 @@ messages
 @$out
 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=$?
+
+run_bconsole
+
+check_for_zombie_jobs storage=File
+stop_bacula
 #
 # Delete .c files because we will only restored the txt files
 #
 rm -f tmp/build/*.c
-diff -r tmp/build tmp/bacula-restores${cwd}/tmp/build 2>&1 >/dev/null
-if [ $? != 0 -o $bstat != 0 -o $rstat != 0 ] ; then
-   echo " "
-   echo " "
-   echo "  !!!!! incremental-2disk test Bacula source failed!!! !!!!! "
-   echo "  !!!!! incremental-2disk test failed!!! !!!!! " >>test.out
-   echo " "
-else
-   echo "  ===== incremental-2disk test Bacula source OK ===== "
-   echo "  ===== incremental-2disk test OK ===== " >>test.out
-   scripts/cleanup
-fi
+
+check_two_logs
+check_restore_tmp_build_diff
+end_test
index 4b827d7eb70f9a147f63ab4c81f84e39e0f7fb01..263d9da6fe8a616a87237bcd957d4574f904cd0a 100755 (executable)
@@ -3,7 +3,10 @@
 # Run a simple backup of the Bacula build directory then create some           
 #   new files, do an Incremental and restore those two files.
 #
-cwd=`pwd`
+TestName="incremental-tape"
+JobName=IncTape
+. scripts/functions
+set_debug 0
 
 scripts/copy-tape-confs
 scripts/cleanup-tape
@@ -17,37 +20,36 @@ echo "${cwd}/tmp/build/ficheriro1.txt" >restore-list
 echo "${cwd}/tmp/build/ficheriro2.txt" >>restore-list
 cd ${cwd}
 
-echo " "
-echo " "
-echo " === Starting incremental-tape test at `date +%R:%S` ==="
-echo " === Starting incremental-tape test 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
+cat <<END_OF_DATA >tmp/bconcmds
 @output /dev/null
 messages
-@output tmp/log1.out
+@$out   tmp/log1.out
 label storage=DDS-4 volume=TestVolume001 slot=0 pool=Default
-run job=NightlySave yes
+run job=$JobName yes
 wait
 messages
 quit
 END_OF_DATA
+
 scripts/check_for_zombie_jobs storage=DDS-4
+
 echo "ficheriro1.txt" >${cwd}/tmp/build/ficheriro1.txt
 echo "ficheriro2.txt" >${cwd}/tmp/build/ficheriro2.txt
-bin/bconsole -c bin/bconsole.conf <<END_OF_DATA 2>&1 >/dev/null
+
+cat <<END_OF_DATA >tmp/bconcmds
 @output /dev/null
 messages
-@output tmp/log1.out
-run level=Incremental job=NightlySave yes
+@$out   tmp/log1.out
+run level=Incremental job=$JobName yes
 wait
 messages
 @# 
 @# now do a restore
 @#
-@output tmp/log2.out
+@$out   tmp/log2.out
 restore where=${cwd}/tmp/bacula-restores storage=DDS-4
 7
 <${cwd}/tmp/restore-list
@@ -58,25 +60,16 @@ messages
 @output
 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=$?
+
+run_bacula
+check_for_zombie_jobs storage=DDS-4
+stop_bacula
+
 #
 # Delete .c files because we will only restored the txt files
 #
 rm -f tmp/build/*.c
-diff -r tmp/build tmp/bacula-restores${cwd}/tmp/build 2>&1 >/dev/null
-if [ $? != 0 -o $bstat != 0 -o $rstat != 0 ] ; then
-   echo " "
-   echo " "
-   echo "  !!!!! incremental-tape test Bacula source failed!!! !!!!! "
-   echo "  !!!!! incremental-tape test failed!!! !!!!! " >>test.out
-   echo " "
-else
-   echo "  ===== incremental-tape test Bacula source OK ===== "
-   echo "  ===== incremental-tape test OK ===== " >>test.out
-   scripts/cleanup
-fi
+
+check_two_logs
+check_restore_tmp_build_diff
+end_test
index b90c16e9e2616864c2a79b27baf91c6f002ef086..97a81f428ff54f129cbdbbb33e07a2e9c83aecec 100755 (executable)
@@ -4,30 +4,24 @@
 #   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
+TestName="relabel-tape"
+JobName=Relabeltape
+. scripts/functions
+set_debug 0
 
-cwd=`pwd`
 scripts/copy-tape-confs
 scripts/cleanup-tape
 echo "${cwd}/build" >/tmp/file-list
 
-echo " "
-echo " "
-echo " === Starting relabel-tape at `date +%R:%S` ==="
-echo " === Starting relabel-tape at `date +%R:%S` ===" >>working/log
-echo " "
+change_jobname $JobName
+start_test
 
 cat <<END_OF_DATA >tmp/bconcmds
 @output /dev/null
 messages
 @$out tmp/log1.out
 label storage=DDS-4 volume=TestVolume001 slot=0 pool=Default
-run job=NightlySave level=Full yes
+run job=$JobName level=Full yes
 wait
 messages
 add pool=Default
@@ -47,20 +41,16 @@ list volumes
 mount
 messages
 wait
-run job=NightlySave level=Full yes
+run job=$JobName level=Full yes
 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
+run_bacula
+check_for_zombie_jobs storage=DDS-4
+
 
 echo "Backup done"
 # 
@@ -94,29 +84,11 @@ messages
 quit
 END_OF_DATA
 
-if test "$debug" -eq 1 ; then
-  cat tmp/bconcmds | bin/bconsole -c bin/bconsole.conf
-else
-  cat tmp/bconcmds | bin/bconsole -c bin/bconsole.conf  2>&1 >/dev/null
-fi
+run_bconsole
+
+check_for_zombie_jobs storage=DDS-4
+stop_bacula
 
-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
-dstat=$?
-if [ $dstat != 0 -o $bstat != 0 -o $rstat != 0 ] ; then
-   echo " "
-   echo " "
-   echo "  !!!!! relabel-tape Bacula source failed!!! !!!!! "
-   echo "  !!!!! relabel-tape failed!!! !!!!! " >>test.out
-   echo "diff=$dstat backup=$bstat restore=$rstat"
-   echo " "
-else
-   echo "  ===== relabel-tape Bacula source OK ===== "
-   echo "  ===== relabel-tape OK ===== " >>test.out
-   scripts/cleanup
-fi
+check_two_logs
+check_restore_diff
+end_test
index 647c204e893dc7854a652cf7a2f2e707c11ee7e1..2813fe2367c293d0896bb227779377f7b002a105 100755 (executable)
@@ -6,7 +6,11 @@
 #   file size to 1M, it runs very slow. There are about 64 files that
 #   are created during each of the two backups.
 #
-cwd=`pwd`
+TestName="restore-by-file-tape"
+JobName=restorebyfile
+. scripts/functions
+set_debug 0
+
 scripts/copy-tape-confs
 scripts/cleanup-tape
 echo "${cwd}/build" >/tmp/file-list
@@ -15,25 +19,21 @@ sed s%\^%${cwd}% ${cwd}/scripts/flist >${cwd}/tmp/restore2-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 restore-by-file-tape test at `date +%R:%S` ==="
-echo " === Starting restore-by-file-tape test 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
+cat <<END_OF_DATA >tmp/bconcmds
 @output /dev/null
 messages
-@output tmp/log1.out
+@$out   tmp/log1.out
 label storage=DDS-4 volume=TestVolume001 slot=0 pool=Default
-run job=NightlySave level=Full yes
+run job=$JobName level=Full yes
 wait
 messages
 @# 
 @# now do a restore
 @#
-@output tmp/log2.out
+@$out   tmp/log2.out
 restore where=${cwd}/tmp/bacula-restores storage=DDS-4 file=<${cwd}/tmp/restore2-list
 yes
 wait
@@ -41,50 +41,38 @@ messages
 @output
 quit
 END_OF_DATA
+
+run_bacula
+check_for_zombie_jobs storage=DDS-4
+stop_bacula
+
+check_two_logs
+
 dstat=0
-scripts/check_for_zombie_jobs storage=DDS-4
 #
 # We need to stop and start Bacula to
 #  test appending to a previously written tape
 #
-bin/bacula stop  2>&1 >/dev/null
-bin/bacula start 2>&1 >/dev/null
 for i in `cat ${cwd}/tmp/restore2-list`; do
    diff $i ${cwd}/tmp/bacula-restores$i
    if [ $? != 0 ] ; then
       dstat=1
    fi
 done
-grep "^  Termination: *Backup OK" tmp/log1.out 2>&1 >/dev/null
-bstat=$?
-grep "^  Termination: *Restore OK" tmp/log2.out 2>&1 >/dev/null
-rstat=$?
-if [ $dstat != 0 -o $bstat != 0 -o $rstat != 0 ] ; then
-   echo " "
-   echo " "
-   echo "  !!!!! restore-by-file-tape test Bacula source failed!!! !!!!! "
-   echo "  !!!!! restore-by-file-tape test failed!!! !!!!! " >>test.out
-   echo " "
-   bin/bacula stop 2>&1 >/dev/null
-   exit 1
-else
-   echo "  First of two restores OK "
-fi
-rm -rf ${cwd}/tmp/bacula-restores
-#
-# Now do a second backup and restore
-#
-bin/bconsole -c bin/bconsole.conf <<END_OF_DATA 2>&1 >/dev/null
+
+end_test
+
+cat <<END_OF_DATA >tmp/bconcmds
 @output /dev/null
 messages
-@output tmp/log1.out
-run job=NightlySave level=Full yes
+@$out   tmp/log1.out
+run job=$JobName  level=Full yes
 wait
 messages
 @#
 @# now do a restore
 @#
-@output tmp/log2.out
+@$out   tmp/log2.out
 restore where=${cwd}/tmp/bacula-restores
 7
 <${cwd}/tmp/restore2-list
@@ -95,6 +83,17 @@ messages
 @output
 quit
 END_OF_DATA
+
+#
+# Bacula was stopped, but we must restart it to
+#  test appending to a previously written tape
+#
+run_bacula
+check_for_zombie_jobs storage=DDS-4
+stop_bacula
+
+check_two_logs
+
 scripts/check_for_zombie_jobs storage=DDS-4
 bin/bacula stop 2>&1 >/dev/null
 for i in `cat ${cwd}/tmp/restore2-list`; do
@@ -103,18 +102,4 @@ for i in `cat ${cwd}/tmp/restore2-list`; do
       dstat=1
    fi
 done
-grep "^  Termination: *Backup OK" tmp/log1.out 2>&1 >/dev/null
-bstat=$?
-grep "^  Termination: *Restore OK" tmp/log2.out 2>&1 >/dev/null
-rstat=$?
-if [ $dstat != 0 -o $bstat != 0 -o $rstat != 0 ] ; then
-   echo " "
-   echo " "
-   echo "  !!!!! restore-by-file-tape test Bacula source failed!!! !!!!! "
-   echo "  !!!!! restore-by-file-tape test failed!!! !!!!! " >>test.out
-   echo " "
-else
-   echo "  ===== restore-by-file-tape test Bacula source OK ===== "
-   echo "  ===== restore-by-file-tape test OK ===== " >>test.out
-#  scripts/cleanup
-fi
+end_test
index 4f8b0115d518bf25ae071a5828ec9c7f4dee0cf4..7e93525197620b8a96ec6177f3d36133a6fc8bc9 100755 (executable)
@@ -3,7 +3,11 @@
 # Run a simple backup of the Bacula build directory 
 #   to a tape where the maximum tape file size is set to 1M
 #
-cwd=`pwd`
+TestName="small-file-size-tape"
+JobName=smallfilesize
+. scripts/functions
+set_debug 0
+
 scripts/copy-tape-confs
 scripts/cleanup-tape
 
@@ -11,26 +15,22 @@ 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 Small File Size test at `date +%R:%S` ==="
-echo " === Starting Small File Size test 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
+cat <<END_OF_DATA >tmp/bconcmds
 @output /dev/null
 messages
-@output tmp/log1.out
+@$out t tmp/log1.out
 label storage=DDS-4 volume=TestVolume001 slot=0 pool=Default
 setdebug level=2 storage=DDS-4
-run job=NightlySave yes
+run job=$JobName yes
 wait
 messages
 @# 
 @# now do a restore
 @#
-@output tmp/log2.out
+@$out   tmp/log2.out
 restore where=${cwd}/tmp/bacula-restores select storage=DDS-4
 unmark *
 mark *
@@ -41,21 +41,11 @@ messages
 @output
 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 "  !!!!! Small File Size test Bacula source failed!!! !!!!! "
-   echo "  !!!!! Small File Size test failed!!! !!!!! " >>test.out
-   echo " "
-else
-   echo "  ===== Small File Size test Bacula source OK ===== "
-   echo "  ===== Small File Size 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
index 040540d2ade12f432e722ebe2a7e72cf57ec7a76..82b1cf54a80a6431720150bbbd835194eba56277 100755 (executable)
@@ -2,46 +2,48 @@
 #
 # Test for a tape truncation bug.
 #
-cwd=`pwd`
+TestName="truncate-bug-tape" 
+JobName=truncatebug
+. scripts/functions
+set_debug 0
 
 scripts/copy-tape-confs
 scripts/cleanup-tape
 echo "${cwd}/build" >/tmp/file-list
 
-echo " "
-echo " "
-echo " === Starting truncate-bug-tape test at `date +%R:%S` ==="
-echo " === Starting truncate-bug-tape test 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
+cat <<END_OF_DATA >tmp/bconcmds
 @output /dev/null
 messages
-@output tmp/log1.out
+@$out   tmp/log1.out
 label storage=DDS-4 volume=TestVolume001 slot=0 pool=Default
 @# do a bunch of saves so we have 12 files on the tape
 run job=NightlySave yes
-run level=Full job=NightlySave yes
-run level=Full job=NightlySave yes
-run level=Full job=NightlySave yes
-run level=Full job=NightlySave yes
-run level=Full job=NightlySave yes
-run level=Full job=NightlySave yes
-run level=Full job=NightlySave yes
-run level=Full job=NightlySave yes
-run level=Full job=NightlySave yes
-run level=Full job=NightlySave yes
-run level=Full job=NightlySave yes
+run level=Full job=$JobName yes
+run level=Full job=$JobName yes
+run level=Full job=$JobName yes
+run level=Full job=$JobName yes
+run level=Full job=$JobName yes
+run level=Full job=$JobName yes
+run level=Full job=$JobName yes
+run level=Full job=$JobName yes
+run level=Full job=$JobName yes
+run level=Full job=$JobName yes
+run level=Full job=$JobName yes
 wait
 messages
 quit
 END_OF_DATA
+
+run_bacula
 scripts/check_for_zombie_jobs storage=DDS-4
-bin/bconsole -c bin/bconsole.conf <<END_OF_DATA 2>&1 >/dev/null
+
+cat <<END_OF_DATA >tmp/bconcmds
 @output /dev/null
 messages
-@output tmp/log1.out
+@$out tmp/log1.out
 @# 
 @# now do a restore
 @#
@@ -59,29 +61,27 @@ messages
 @output
 quit
 END_OF_DATA
+
+run_bconsole
 scripts/check_for_zombie_jobs storage=DDS-4
-bin/bconsole -c bin/bconsole.conf <<END_OF_DATA 2>&1 >/dev/null
+
+cat <<END_OF_DATA >tmp/bconcmds
 @output /dev/null
 messages
-@output tmp/log2.out
-run level=Full job=NightlySave yes
+@$out tmp/log2.out
+run level=Full job=$JobName yes
 wait
 messages
 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: *Backup OK" tmp/log2.out 2>&1 >/dev/null
-rstat=$?
-if [ $bstat != 0 -o $rstat != 0 ] ; then
-   echo " "
-   echo " "
-   echo "  !!!!! truncate-bug-tape test Bacula source failed!!! !!!!! "
-   echo "  !!!!! truncate-bug-tape test failed!!! !!!!! " >>test.out
-   echo " "
-else
-   echo "  ===== truncate-bug-tape test Bacula source OK ===== "
-   echo "  ===== truncate-bug-tape test OK ===== " >>test.out
-   scripts/cleanup
-fi
+
+run_bconsole
+check_for_zombie_jobs storage=DDS-4
+stop_bacula
+
+check_two_logs
+# no diff made
+dstat=0
+end_test
+
index a9dabe443961218f82a916ccbe519d2e32bca2ea..f46e4c83a722fa0f6ed153cfae6c3a4d3d0f8faa 100755 (executable)
@@ -7,18 +7,17 @@
 #  is in /tmp/file-list, which is by default the Bacula
 #  source code (i.e. the build directory).
 #
+TestName="two-pool-tape"
+JobName=twopooltape
+. scripts/functions
+set_debug 0
+
 . config.out
 if test x${AUTOCHANGER} = x/dev/null ; then
    echo "two-pool-tape test skipped. No autochanger."
    exit
 fi
-debug=0
-if test "$debug" -eq 1 ; then
-  out="tee"
-else
-  out="output"
-fi
-cwd=`pwd`
+
 scripts/cleanup
 scripts/copy-2tape-confs
 scripts/prepare-two-tapes
@@ -30,11 +29,8 @@ echo "${cwd}/build" >>/tmp/file-list
 echo "${cwd}/build" >>/tmp/file-list
 echo "${cwd}/build" >>/tmp/file-list
 
-echo " "
-echo " "
-echo " === Starting Two Pool Tape test at `date +%R:%S` ==="
-echo " === Starting Two Pool Tape test at `date +%R:%S` ===" >>working/log
-echo " "
+start_test
+
 # Write out bconsole commands to a file
 cat <<END_OF_DATA >tmp/bconcmds
 @output /dev/null
@@ -75,33 +71,11 @@ messages
 quit
 END_OF_DATA
 
-# start Bacula and run bconsole commands
-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
-# Make sure no jobs are still running (debug check)
-scripts/check_for_zombie_jobs storage=DDS-4
+run_bacula
+check_for_zombie_jobs storage=DDS-4
+stop_bacula
+
+check_two_logs
+check_restore_diff
+end_test
 
-# stop Bacula
-bin/bacula stop 2>&1 >/dev/null
-# Check if backup done correctly
-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 "  !!!!! Two Pool Tape test Bacula source failed!!! !!!!! "
-   echo "  !!!!! Two Pool Tape test failed!!! !!!!! " >>test.out
-   echo " "
-else
-   echo "  ===== Two Pool Tape test Bacula source OK ===== "
-   echo "  ===== Two Pool Tape test OK ===== " >>test.out
-#  scripts/cleanup
-fi
index 5dc69f6713a0d56d4cd34c5c58b63f4a21314992..8d896e36df16e068b319420cfc1d7a4fc9911806 100755 (executable)
@@ -5,18 +5,18 @@
 #  Note, this test simulates the tape filling and writing to
 #   the next tape.
 #
+TestName="two-volume-tape"
+JobName=twovoltape
+. scripts/functions
+set_debug 0
+
+
 . config.out
 if test x${AUTOCHANGER} = x/dev/null ; then
    echo "two-volume-tape test skipped. No autochanger."
    exit
 fi
-debug=0
-if test "$debug" -eq 1 ; then
-  out="tee"
-else
-  out="output"
-fi
-cwd=`pwd`
+
 scripts/cleanup
 scripts/copy-2tape-confs
 scripts/prepare-two-tapes
@@ -28,11 +28,9 @@ echo "s%# Maximum File Size%  Maximum File Size%g" >${outf}
 cp ${cwd}/bin/bacula-sd.conf ${cwd}/tmp/1
 sed -f ${outf} ${cwd}/tmp/1 >${cwd}/bin/bacula-sd.conf
 
-echo " "
-echo " "
-echo " === Starting Two Volume Tape test at `date +%R:%S` ==="
-echo " === Starting Two Volume Tape test at `date +%R:%S` ===" >>working/log
-echo " "
+change_jobname $JobName
+start_test
+
 # Write out bconsole commands
 cat <<END_OF_DATA >tmp/bconcmds
 @$out /dev/null
@@ -42,7 +40,7 @@ label storage=DDS-4 volume=TestVolume001 slot=1 pool=Default drive=0
 label storage=DDS-4 volume=TestVolume002 slot=2 pool=Default drive=0
 update Volume=TestVolume001 MaxVolBytes=3000000 pool=Default drive=0
 @#setdebug level=1000 client 
-run job=NightlySave yes
+run job=$JobName yes
 wait
 messages
 @# 
@@ -57,29 +55,10 @@ 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
+check_for_zombie_jobs storage=DDS-4
+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 "  !!!!! Two Volume Tape test Bacula source failed!!! !!!!! "
-   echo "  !!!!! Two Volume Tape test failed!!! !!!!! " >>test.out
-   echo " "
-else
-   echo "  ===== Two Volume Tape test Bacula source OK ===== "
-   echo "  ===== Two Volume Tape test OK ===== " >>test.out
-#  scripts/cleanup
-fi
+check_two_logs
+check_restore_diff
+end_test
index f51252e8b056e50ffd45d4c3a0b2d5add547866e..3322da8d49977e1466636ec365b41fb29e7b480f 100755 (executable)
@@ -4,31 +4,25 @@
 #   to a tape then restore it, we do that twice to ensure that
 #   we can correctly append to a tape.
 #
-debug=1
-if test "$debug" -eq 1 ; then
-  out="tee"
-else
-  out="output"
-fi
+TestName="win32-backup-tape"
+JobName=win32tape
+. scripts/functions
+set_debug 0
 
-cwd=`pwd`
 scripts/copy-win32-confs
 scripts/cleanup-tape
 
 echo "${cwd}/build" >/tmp/file-list
 
-echo " "
-echo " "
-echo " === Starting Win32 Backup tape test at `date +%R:%S` ==="
-echo " === Starting Win32 Backup tape test at `date +%R:%S` ===" >>working/log
-echo " "
+change_jobname $JobName
+start_test
 
 cat <<END_OF_DATA >tmp/bconcmds
 @output /dev/null
 messages
 @$out tmp/log1.out
 label storage=DDS-4 volume=TestVolume001 slot=0 pool=Default drive=0
-run job=NightlySave yes
+run job=$JobName yes
 @sleep 10
 status storage=DDS-4
 @sleep 30
@@ -44,29 +38,12 @@ yes
 wait
 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
 
-scripts/check_for_zombie_jobs storage=DDS-4
+run_bacula
+check_for_zombie_jobs storage=DDS-4
+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=$?
-if [ $bstat != 0 -o $rstat != 0 ] ; then
-   echo " "
-   echo " "
-   echo "  !!!!! Win32 Backup tape test failed!!! !!!!! "
-   echo "  !!!!! Win32 Backup tape test failed!!! !!!!! " >>test.out
-   echo " "
-else
-   echo "  ===== Win32 Backup tape test OK ===== "
-   echo "  ===== Win32 Backup tape test OK ===== " >>test.out
-   scripts/cleanup
-fi
+check_two_logs
+# no diff for now
+dstat=0 
+end_test
index 7cced61b81dadcbf8e88d96aca244c0421e1e313..66e4814e0abd21c709609c92d691cd2fe79de501 100755 (executable)
@@ -4,24 +4,18 @@
 #   to a tape then restore it, we do that twice to ensure that
 #   we can correctly append to a tape.
 #
-debug=1
-if test "$debug" -eq 1 ; then
-  out="tee"
-else
-  out="output"
-fi
+TestName="win32-to-linux-tape"
+JobName=AutoLabel
+. scripts/functions
+set_debug 0
 
-cwd=`pwd`
 scripts/copy-win32-confs
 scripts/cleanup-tape
 
 echo "${cwd}/build" >/tmp/file-list
 
-echo " "
-echo " "
-echo " === Starting Win32 Backup tape test at `date +%R:%S` ==="
-echo " === Starting Win32 Backup tape test at `date +%R:%S` ===" >>working/log
-echo " "
+change_job $JobName
+start_test
 
 cat <<END_OF_DATA >tmp/bconcmds
 @output /dev/null
@@ -44,29 +38,12 @@ yes
 wait
 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
 
-scripts/check_for_zombie_jobs storage=DDS-4
+run_bacula
+check_for_zombie_jobs storage=DDS-4
+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=$?
-if [ $bstat != 0 -o $rstat != 0 ] ; then
-   echo " "
-   echo " "
-   echo "  !!!!! Win32 Backup tape test failed!!! !!!!! "
-   echo "  !!!!! Win32 Backup tape test failed!!! !!!!! " >>test.out
-   echo " "
-else
-   echo "  ===== Win32 Backup tape test OK ===== "
-   echo "  ===== Win32 Backup tape test OK ===== " >>test.out
-#  scripts/cleanup
-fi
+check_two_logs
+# No diff for the moment
+dstat=0
+end_test