From 5b4f40e5baaa8cbba795741f60488e464fddea1e Mon Sep 17 00:00:00 2001 From: Kern Sibbald Date: Fri, 30 Jun 2006 09:56:48 +0000 Subject: [PATCH] Update more tests git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@3098 91ce42f0-d328-0410-95d8-f526ca767f89 --- regress/scripts/functions | 3 + regress/tests/backup-bacula-tape | 61 +++++------------ regress/tests/backup-bacula-test | 1 - regress/tests/backup-win32-tape | 43 +++++------- regress/tests/bextract-test | 4 +- regress/tests/bscan-tape | 62 +++++++---------- regress/tests/bscan-test | 2 +- regress/tests/bsr-opt-test | 2 +- regress/tests/btape-fill-full-tape | 13 ++-- regress/tests/btape-fill-tape | 14 ++-- regress/tests/compressed-test | 61 ++++++----------- regress/tests/concurrent-jobs-test | 53 +++++---------- regress/tests/differential-test | 1 - regress/tests/eot-fail-tape | 50 ++++++-------- regress/tests/filed-crypto-test | 3 +- regress/tests/fixed-block-size-tape | 52 +++++---------- regress/tests/four-concurrent-jobs-tape | 60 +++++------------ regress/tests/four-concurrent-jobs-test | 63 ++++++----------- regress/tests/four-jobs-tape | 64 ++++++------------ regress/tests/incremental-2disk | 64 +++++++----------- regress/tests/incremental-tape | 57 +++++++--------- regress/tests/relabel-tape | 64 +++++------------- regress/tests/restore-by-file-tape | 89 ++++++++++--------------- regress/tests/small-file-size-tape | 48 ++++++------- regress/tests/truncate-bug-tape | 80 +++++++++++----------- regress/tests/two-pool-tape | 56 +++++----------- regress/tests/two-volume-tape | 55 +++++---------- regress/tests/win32-backup-tape | 51 ++++---------- regress/tests/win32-to-linux-tape | 49 ++++---------- 29 files changed, 435 insertions(+), 790 deletions(-) diff --git a/regress/scripts/functions b/regress/scripts/functions index 3a0228cd3f..8c924a7ba7 100644 --- a/regress/scripts/functions +++ b/regress/scripts/functions @@ -100,3 +100,6 @@ end_test() scripts/cleanup fi } + +# Save current directory +cwd=`pwd` diff --git a/regress/tests/backup-bacula-tape b/regress/tests/backup-bacula-tape index 37c42382a5..ae7e17d59e 100755 --- a/regress/tests/backup-bacula-tape +++ b/regress/tests/backup-bacula-tape @@ -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 <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 diff --git a/regress/tests/backup-bacula-test b/regress/tests/backup-bacula-test index 2c6d8e24cd..aa20cab740 100755 --- a/regress/tests/backup-bacula-test +++ b/regress/tests/backup-bacula-test @@ -8,7 +8,6 @@ JobName=backup . scripts/functions set_debug 0 -cwd=`pwd` scripts/copy-confs scripts/cleanup diff --git a/regress/tests/backup-win32-tape b/regress/tests/backup-win32-tape index 3723b536dd..bfecfaa913 100755 --- a/regress/tests/backup-win32-tape +++ b/regress/tests/backup-win32-tape @@ -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 <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 diff --git a/regress/tests/bextract-test b/regress/tests/bextract-test index 0289577ce9..b000039f1c 100755 --- a/regress/tests/bextract-test +++ b/regress/tests/bextract-test @@ -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 <tmp/bconcmds diff --git a/regress/tests/bscan-tape b/regress/tests/bscan-tape index 5225103a89..f230d49a7d 100755 --- a/regress/tests/bscan-tape +++ b/regress/tests/bscan-tape @@ -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 <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 <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 <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 <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 diff --git a/regress/tests/bscan-test b/regress/tests/bscan-test index 65b85031ef..44bfe9c1b2 100755 --- a/regress/tests/bscan-test +++ b/regress/tests/bscan-test @@ -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 <tmp/bconcmds diff --git a/regress/tests/bsr-opt-test b/regress/tests/bsr-opt-test index fa61dde540..e4ca9a3157 100755 --- a/regress/tests/bsr-opt-test +++ b/regress/tests/bsr-opt-test @@ -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 diff --git a/regress/tests/btape-fill-full-tape b/regress/tests/btape-fill-full-tape index c61e5ddc3d..f4ba59fb5b 100755 --- a/regress/tests/btape-fill-full-tape +++ b/regress/tests/btape-fill-full-tape @@ -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 <&1 >tmp/log1.out fill diff --git a/regress/tests/btape-fill-tape b/regress/tests/btape-fill-tape index c97fd11f2b..e658e966e9 100755 --- a/regress/tests/btape-fill-tape +++ b/regress/tests/btape-fill-tape @@ -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 <&1 >tmp/log1.out fill s diff --git a/regress/tests/compressed-test b/regress/tests/compressed-test index c1e4cf161a..8f10d91599 100755 --- a/regress/tests/compressed-test +++ b/regress/tests/compressed-test @@ -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 <&1 >/dev/null -@tee /dev/null +start_test + +cat <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 + diff --git a/regress/tests/concurrent-jobs-test b/regress/tests/concurrent-jobs-test index 4d2ffa234c..5231c09674 100755 --- a/regress/tests/concurrent-jobs-test +++ b/regress/tests/concurrent-jobs-test @@ -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 <&1 >/dev/null 2>&1 >/dev/null +start_test + +cat <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 diff --git a/regress/tests/differential-test b/regress/tests/differential-test index a77ddb2fd1..80c9d69248 100755 --- a/regress/tests/differential-test +++ b/regress/tests/differential-test @@ -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 diff --git a/regress/tests/eot-fail-tape b/regress/tests/eot-fail-tape index 049b745c92..55281032ce 100755 --- a/regress/tests/eot-fail-tape +++ b/regress/tests/eot-fail-tape @@ -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 <&1 >/dev/null -@tee /dev/null +cat <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 + diff --git a/regress/tests/filed-crypto-test b/regress/tests/filed-crypto-test index 935d18dcaa..ec78307f75 100755 --- a/regress/tests/filed-crypto-test +++ b/regress/tests/filed-crypto-test @@ -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 <tmp/bconcmds diff --git a/regress/tests/fixed-block-size-tape b/regress/tests/fixed-block-size-tape index 69982162c2..4d07bccdf1 100755 --- a/regress/tests/fixed-block-size-tape +++ b/regress/tests/fixed-block-size-tape @@ -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 <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 diff --git a/regress/tests/four-concurrent-jobs-tape b/regress/tests/four-concurrent-jobs-tape index 8dcf0d8cbe..d841bedaa1 100755 --- a/regress/tests/four-concurrent-jobs-tape +++ b/regress/tests/four-concurrent-jobs-tape @@ -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 <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 diff --git a/regress/tests/four-concurrent-jobs-test b/regress/tests/four-concurrent-jobs-test index f1174b4b17..95e88a16b2 100755 --- a/regress/tests/four-concurrent-jobs-test +++ b/regress/tests/four-concurrent-jobs-test @@ -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 <&1 >/dev/null +cat <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 diff --git a/regress/tests/four-jobs-tape b/regress/tests/four-jobs-tape index 92e2e95765..449f74275a 100755 --- a/regress/tests/four-jobs-tape +++ b/regress/tests/four-jobs-tape @@ -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 <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 <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 <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 <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 diff --git a/regress/tests/incremental-2disk b/regress/tests/incremental-2disk index d3907eb524..9294c33686 100755 --- a/regress/tests/incremental-2disk +++ b/regress/tests/incremental-2disk @@ -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 <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 <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 diff --git a/regress/tests/incremental-tape b/regress/tests/incremental-tape index 4b827d7eb7..263d9da6fe 100755 --- a/regress/tests/incremental-tape +++ b/regress/tests/incremental-tape @@ -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 <&1 >/dev/null +cat <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 <&1 >/dev/null + +cat <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 diff --git a/regress/tests/relabel-tape b/regress/tests/relabel-tape index b90c16e9e2..97a81f428f 100755 --- a/regress/tests/relabel-tape +++ b/regress/tests/relabel-tape @@ -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 <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 diff --git a/regress/tests/restore-by-file-tape b/regress/tests/restore-by-file-tape index 647c204e89..2813fe2367 100755 --- a/regress/tests/restore-by-file-tape +++ b/regress/tests/restore-by-file-tape @@ -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 <&1 >/dev/null +cat <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 <&1 >/dev/null + +end_test + +cat <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 diff --git a/regress/tests/small-file-size-tape b/regress/tests/small-file-size-tape index 4f8b0115d5..7e93525197 100755 --- a/regress/tests/small-file-size-tape +++ b/regress/tests/small-file-size-tape @@ -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 <&1 >/dev/null +cat <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 diff --git a/regress/tests/truncate-bug-tape b/regress/tests/truncate-bug-tape index 040540d2ad..82b1cf54a8 100755 --- a/regress/tests/truncate-bug-tape +++ b/regress/tests/truncate-bug-tape @@ -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 <&1 >/dev/null +cat <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 <&1 >/dev/null + +cat <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 <&1 >/dev/null + +cat <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 + diff --git a/regress/tests/two-pool-tape b/regress/tests/two-pool-tape index a9dabe4439..f46e4c83a7 100755 --- a/regress/tests/two-pool-tape +++ b/regress/tests/two-pool-tape @@ -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 <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 diff --git a/regress/tests/two-volume-tape b/regress/tests/two-volume-tape index 5dc69f6713..8d896e36df 100755 --- a/regress/tests/two-volume-tape +++ b/regress/tests/two-volume-tape @@ -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 <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 diff --git a/regress/tests/win32-backup-tape b/regress/tests/win32-backup-tape index f51252e8b0..3322da8d49 100755 --- a/regress/tests/win32-backup-tape +++ b/regress/tests/win32-backup-tape @@ -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 <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 diff --git a/regress/tests/win32-to-linux-tape b/regress/tests/win32-to-linux-tape index 7cced61b81..66e4814e0a 100755 --- a/regress/tests/win32-to-linux-tape +++ b/regress/tests/win32-to-linux-tape @@ -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 <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 -- 2.39.5