From 7f350ed9bd70b3cbfdb0d48d091710eb1a6101ac Mon Sep 17 00:00:00 2001 From: Kern Sibbald Date: Sat, 24 Jun 2006 07:48:05 +0000 Subject: [PATCH] Begin simplification and cleanup of tests using shell functions git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@3066 91ce42f0-d328-0410-95d8-f526ca767f89 --- regress/scripts/functions | 102 +++++++++++++++++++++++++++ regress/tests/auto-label-test | 56 ++++----------- regress/tests/backup-bacula-test | 55 +++------------ regress/tests/bextract-test | 54 ++++---------- regress/tests/bscan-test | 71 +++++-------------- regress/tests/bsr-opt-test | 38 ++++------ regress/tests/differential-test | 66 ++++------------- regress/tests/filed-crypto-test | 55 ++++----------- regress/tests/four-jobs-test | 87 +++++------------------ regress/tests/incremental-test | 101 +++++++++++++------------- regress/tests/query-test | 83 ++++++---------------- regress/tests/recycle-test | 65 +++++++---------- regress/tests/restore-by-file-test | 55 ++++----------- regress/tests/restore-disk-seek-test | 56 ++++----------- regress/tests/restore2-by-file-test | 46 +++++------- regress/tests/scratch-pool-test | 52 ++++---------- regress/tests/six-vol-test | 49 +++++-------- regress/tests/span-vol-test | 59 ++++------------ regress/tests/sparse-compressed-test | 52 +++++--------- regress/tests/sparse-test | 53 +++++--------- regress/tests/two-jobs-test | 63 +++++++---------- regress/tests/two-pool-test | 53 ++++---------- regress/tests/two-vol-test | 57 ++++----------- regress/tests/two-volume-test | 51 ++++---------- regress/tests/verify-vol-test | 53 ++++---------- regress/tests/weird-files-test | 62 +++++----------- regress/tests/weird-files2-test | 70 +++++------------- 27 files changed, 548 insertions(+), 1116 deletions(-) create mode 100644 regress/scripts/functions diff --git a/regress/scripts/functions b/regress/scripts/functions new file mode 100644 index 0000000000..3e1c468e17 --- /dev/null +++ b/regress/scripts/functions @@ -0,0 +1,102 @@ +# +# A set of useful functions to be sourced in each test +# + +start_test() +{ + echo " " + echo " " + echo " === Starting $JobName at `date +%R:%S` ===" + echo " === Starting $JobName at `date +%R:%S` ===" >>working/log + echo " " +} + +set_debug() +{ + debug=$1 + if test "$debug" -eq 1 ; then + out="tee" + else + out="output" + fi +} + +run_bacula() +{ + 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_bconsole() +{ + 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 +} + +stop_bacula() +{ + bin/bacula stop 2>&1 >/dev/null +} + +check_for_zombie_jobs() +{ + scripts/check_for_zombie_jobs $1 +} + +change_jobname() +{ + rm -f bin/1 + mv bin/bacula-dir.conf bin/1 + echo "s%NightlySave%$1%g" >/tmp/1 + sed -f /tmp/1 bin/1 >bin/bacula-dir.conf +} + +check_two_logs() +{ + grep "^ Termination: *Backup OK" tmp/log1.out 2>&1 >/dev/null + bstat=$? + grep "^ Termination: *Restore OK" tmp/log2.out 2>&1 >/dev/null + rstat=$? +} + +check_restore_diff() +{ + diff -r build tmp/bacula-restores${cwd}/build 2>&1 >/dev/null + dstat=$? +} + +check_restore_tmp_build_diff() +{ + diff -r tmp/build tmp/bacula-restores${cwd}/tmp/build 2>&1 >/dev/null + dstat=$? +} + +end_test() +{ + if [ $dstat != 0 -o $bstat != 0 -o $rstat != 0 ] ; then + echo " " + echo " " + echo " !!!!! $TestName Bacula source failed!!! !!!!! " + echo " !!!!! $TestName 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 " ===== $TestName Bacula source OK `date +%R:%S` ===== " + echo " ===== $TestName OK `date +%R:%S` ===== " >>test.out + scripts/cleanup + fi +} diff --git a/regress/tests/auto-label-test b/regress/tests/auto-label-test index 3af2a946e5..631ec549d4 100755 --- a/regress/tests/auto-label-test +++ b/regress/tests/auto-label-test @@ -3,12 +3,11 @@ # Test if Bacula can automatically create a Volume label. # -debug=1 -if test "$debug" -eq 1 ; then - out="tee" -else - out="output" -fi +TestName="auto-label-test" +JobName=AutoLabel +. scripts/functions +set_debug 1 + cwd=`pwd` scripts/copy-test-confs scripts/cleanup @@ -17,11 +16,7 @@ echo "${cwd}/build" >/tmp/file-list cp ${cwd}/bin/bacula-dir.conf ${cwd}/tmp/1 sed "s%# Label Format% Label Format%" ${cwd}/tmp/1 >${cwd}/bin/bacula-dir.conf -echo " " -echo " " -echo " === Starting auto-label-test at `date +%R:%S` ===" -echo " === Starting auto-label-test at `date +%R:%S` ===" >>working/log -echo " " +start_test cat <tmp/bconcmds @output /dev/null @@ -61,37 +56,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=File +run_bacula +check_for_zombie_jobs storage=File +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 " !!!!! auto-label-test failed!!! !!!!! " - echo " !!!!! auto-label-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 " ===== auto-label-test OK `date +%R:%S` ===== " - echo " ===== auto-label-test OK `date +%R:%S` ===== " >>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 b924881e68..2c6d8e24cd 100755 --- a/regress/tests/backup-bacula-test +++ b/regress/tests/backup-bacula-test @@ -3,22 +3,16 @@ # Run a simple backup of the Bacula build directory # then restore it. # -debug=0 -if test "$debug" -eq 1 ; then - out="tee" -else - out="output" -fi +TestName="backup-bacula-test" +JobName=backup +. scripts/functions +set_debug 0 cwd=`pwd` scripts/copy-confs scripts/cleanup -echo " " -echo " " -echo " === Starting Backup Bacula Test at `date +%R:%S` ===" -echo " === Starting Backup Bacula Test at `date +%R:%S` ===" >>working/log -echo " " +start_test cat <tmp/bconcmds @output /dev/null @@ -59,37 +53,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 +run_bacula +check_for_zombie_jobs storate=File +stop_bacula -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 -diff -r build tmp/bacula-restores${cwd}/build -if [ $? != 0 -o $bstat != 0 -o $rstat != 0 ] ; then - echo " " - echo " " - echo " !!!!! Backup Bacula Test failed!!! !!!!! " - echo " !!!!! Backup Bacula 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 " ===== Backup Bacula Test OK `date +%R:%S` ===== " - echo " ===== Backup Bacula Test OK `date +%R:%S` ===== " >>test.out - scripts/cleanup -fi +check_two_logs +check_restore_diff +end_test diff --git a/regress/tests/bextract-test b/regress/tests/bextract-test index c07fec39da..0289577ce9 100755 --- a/regress/tests/bextract-test +++ b/regress/tests/bextract-test @@ -4,23 +4,19 @@ # split the archive into two volumes, then build a BSR with # the restore command and use bextract to restore the files. # -debug=0 -if test "$debug" -eq 1 ; then - out="tee" -else - out="output" -fi +TestName="bextract-test" +JobName="bextract" +. scripts/functions +set_debug 0 + cwd=`pwd` scripts/copy-test-confs scripts/cleanup echo "${cwd}/build" >/tmp/file-list +change_jobname $JobName -echo " " -echo " " -echo " === Starting bextract-test at `date +%R:%S` ===" -echo " === Starting bextract-test at `date +%R:%S` ===" >working/log -echo " " +start_test cat <tmp/bconcmds @output /dev/null @@ -29,7 +25,7 @@ messages label storage=File1 volume=TestVolume001 label storage=File1 volume=TestVolume002 update Volume=TestVolume001 MaxVolBytes=3000000 -run job=NightlySave storage=File1 yes +run job=$JobName storage=File1 yes wait messages @# @@ -44,36 +40,14 @@ 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 +check_for_zombie_jobs storage=File1 +stop_bacula -scripts/check_for_zombie_jobs storage=File1 -bin/bacula stop 2>&1 >/dev/null mkdir -p ${cwd}/tmp/bacula-restores bin/bextract -b working/restore.bsr -c bin/bacula-sd.conf ${cwd}/tmp ${cwd}/tmp/bacula-restores 2>&1 >/dev/null +rstat=$? grep "^ Termination: *Backup OK" tmp/log1.out 2>&1 >/dev/null bstat=$? -diff -r build tmp/bacula-restores${cwd}/build 2>&1 >/dev/null -if [ $? != 0 -o $bstat != 0 ] ; then - echo " " - echo " " - echo " !!!!! bextract-test Bacula source failed!!! !!!!! " - echo " !!!!! bextract-test failed!!! !!!!! " >>test.out - if [ $bstat != 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 " ===== bextract-test Bacula source OK `date +%R:%S` ===== " - echo " ===== bextract-test OK `date +%R:%S` ===== " >>test.out - scripts/cleanup -fi +check_restore_diff +end_test diff --git a/regress/tests/bscan-test b/regress/tests/bscan-test index 92c01ae516..65b85031ef 100755 --- a/regress/tests/bscan-test +++ b/regress/tests/bscan-test @@ -6,23 +6,18 @@ # extent tests the purge volume and delete volume commands. # -debug=0 -if test "$debug" -eq 1 ; then - out="tee" -else - out="output" -fi +TestName="bscan-test" +JobName=bscan +. scripts/functions +set_debug 0 cwd=`pwd` scripts/copy-test-confs scripts/cleanup echo "${cwd}/build" >/tmp/file-list +change_jobname $JobName -echo " " -echo " " -echo " === Starting bscan-test at `date +%R:%S` ===" -echo " === Starting bscan-test at `date +%R:%S` ===" >working/log -echo " " +start_test cat <tmp/bconcmds @$out /dev/null @@ -33,7 +28,7 @@ TestVolume001 label storage=File1 TestVolume002 update Volume=TestVolume001 MaxVolBytes=3000000 -run job=NightlySave storage=File1 +run job=$JobName storage=File1 yes wait messages @@ -51,17 +46,10 @@ messages quit END_OF_DATA -# run backup -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=File1 +stop_bacula -scripts/check_for_zombie_jobs storage=File1 -bin/bacula stop 2>&1 >/dev/null echo "volume=TestVolume001|TestVolume002" >tmp/bscan.bsr if test "$debug" -eq 1 ; then @@ -87,37 +75,10 @@ quit END_OF_DATA # now run restore -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=File1 +stop_bacula - -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 " !!!!! bscan-test Bacula source failed!!! !!!!! " - echo " !!!!! bscan-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 " ===== bscan-test Bacula source OK `date +%R:%S` ===== " - echo " ===== bscan-test OK `date +%R:%S` ===== " >>test.out - scripts/cleanup -fi +check_two_logs +check_restore_diff +end_test diff --git a/regress/tests/bsr-opt-test b/regress/tests/bsr-opt-test index c812613610..fa61dde540 100755 --- a/regress/tests/bsr-opt-test +++ b/regress/tests/bsr-opt-test @@ -6,23 +6,18 @@ # the other volume is not used. I.e. bsr optimization # works. # -debug=0 -if test "$debug" -eq 1 ; then - out="tee" -else - out="output" -fi +TestName="bsr-opt-test" +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 -echo " " -echo " " -echo " === Starting bsr-opt-test at `date +%R:%S` ===" -echo " === Starting bsr-opt-test at `date +%R:%S` ===" >working/log -echo " " +start_test cat <tmp/bconcmds @$out /dev/null @@ -31,7 +26,7 @@ messages label storage=File1 volume=TestVolume001 label storage=File1 volume=TestVolume002 update Volume=TestVolume001 MaxVolBytes=3000000 -run job=NightlySave storage=File1 yes +run job=$JobName storage=File1 yes wait messages @# @@ -51,16 +46,9 @@ 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=File1 -bin/bacula stop 2>&1 >/dev/null +run_bacula +check_for_zombie_jobs storage=File1 +stop_bacula # # This test is not really reliable. What we want to do is # to select files on only one Volume, then insure here @@ -68,10 +56,8 @@ bin/bacula stop 2>&1 >/dev/null # grep TestVolume002 working/restore.bsr 2>&1 >/dev/null bsrstat=$? -grep "^ Termination: *Backup OK" tmp/log1.out 2>&1 >/dev/null -bstat=$? -grep "^ Termination: *Restore OK" tmp/log2.out 2>&1 >/dev/null -rstat=$? +check_two_logs + diff -r build/src/cats tmp/bacula-restores${cwd}/build/src/cats 2>&1 >/dev/null if [ $? != 0 -o $bsrstat != 0 -o $bstat != 0 -o $rstat != 0 ] ; then echo " " diff --git a/regress/tests/differential-test b/regress/tests/differential-test index e758454558..a77ddb2fd1 100755 --- a/regress/tests/differential-test +++ b/regress/tests/differential-test @@ -3,12 +3,10 @@ # Run a simple backup of the Bacula build directory then create some # new files, do a differential and restore those two files. # -debug=0 -if test "$debug" -eq 1 ; then - out="tee" -else - out="output" -fi +TestName="differential-test" +JobName=differential +. scripts/functions +set_debug 0 cwd=`pwd` scripts/copy-test-confs @@ -21,11 +19,7 @@ echo "${cwd}/tmp/build/ficheriro1.txt" >restore-list echo "${cwd}/tmp/build/ficheriro2.txt" >>restore-list cd ${cwd} -echo " " -echo " " -echo " === Starting differential-test at `date +%R:%S` ===" -echo " === Starting differential-test at `date +%R:%S` ===" >>working/log -echo " " +start_test cat <tmp/bconcmds @$out /dev/null @@ -39,13 +33,7 @@ messages quit END_OF_DATA -if test "$debug" -eq 1 ; then - bin/bacula start - cat tmp/bconcmds | bin/bconsole -c bin/bconsole.conf -else - bin/bacula start 2>&1 >/dev/null - cat tmp/bconcmds | bin/bconsole -c bin/bconsole.conf 2>&1 >/dev/null -fi +run_bacula scripts/check_for_zombie_jobs storage=File echo "ficheriro1.txt" >${cwd}/tmp/build/ficheriro1.txt @@ -63,11 +51,7 @@ messages @$out 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 scripts/check_for_zombie_jobs storage=File echo "ficheriro2.txt" >${cwd}/tmp/build/ficheriro2.txt @@ -91,38 +75,14 @@ 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 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=$? +stop_bacula + +check_two_logs # # Delete .c files because we will only restore 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 " !!!!! differential-test Bacula source failed!!! !!!!! " - echo " !!!!! differential-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 " ===== differential-test Bacula source OK `date +%R:%S` ===== " - echo " ===== differential-test OK `date +%R:%S` ===== " >>test.out - scripts/cleanup -fi +check_restore_tmp_build_diff +end_test diff --git a/regress/tests/filed-crypto-test b/regress/tests/filed-crypto-test index 7f816eeb2a..935d18dcaa 100755 --- a/regress/tests/filed-crypto-test +++ b/regress/tests/filed-crypto-test @@ -3,23 +3,18 @@ # Run a simple backup (with encryption) of the Bacula build directory # then verify the signatures. # -debug=0 -if test "$debug" -eq 1 ; then - out="tee" -else - out="output" -fi +TestName="filed-crypto-test" +JobName=Crypto +. scripts/functions +set_debug 0 cwd=`pwd` scripts/copy-crypto-confs scripts/cleanup echo "${cwd}/build" >/tmp/file-list +change_jobname $JobName -echo " " -echo " " -echo " === Starting Filed Encryption Test at `date +%R:%S` ===" -echo " === Starting Filed Encryption Test at `date +%R:%S` ===" >>working/log -echo " " +start_test cat <tmp/bconcmds @$out /dev/null @@ -45,35 +40,11 @@ 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 sleep 2 -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 -if [ $? != 0 -o $bstat != 0 ] ; then - echo " " - echo " " - echo " !!!!! Filed Encryption Verification failed!!! !!!!! " - echo " !!!!! Filed Encryption Verification failed!!! !!!!! " >>test.out - if [ $bstat != 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 " ===== Filed Encryption Verification Test OK `date +%R:%S` ===== " - echo " ===== Filed Encryption Verification Test OK `date +%R:%S` ===== " >>test.out - scripts/cleanup -fi +check_for_zombie_jobs storage=File +stop_bacula + +check_two_logs +check_restore_diff +end_test diff --git a/regress/tests/four-jobs-test b/regress/tests/four-jobs-test index 0dcfd1b880..05da4ccb4d 100755 --- a/regress/tests/four-jobs-test +++ b/regress/tests/four-jobs-test @@ -4,23 +4,17 @@ # 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="four-jobs-test" +JobName=SpanVol +. scripts/functions +set_debug 0 cwd=`pwd` scripts/copy-test-confs scripts/cleanup echo "${cwd}/build" >/tmp/file-list -echo " " -echo " " -echo " === Starting four-jobs-test at `date +%R:%S` ===" -echo " === Starting four-jobs-test at `date +%R:%S` ===" >>working/log -echo " " +start_test cat <tmp/bconcmds @output /dev/null @@ -36,15 +30,8 @@ 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=File +run_bacula +check_for_zombie_jobs storage=File echo "Backup 1 done" # make some files for the incremental to pick up touch ${cwd}/build/src/dird/*.c ${cwd}/build/src/dird/*.o @@ -64,13 +51,9 @@ 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=File -scripts/check_for_zombie_jobs storage=File echo "Backup 2 done" touch ${cwd}/build/src/dird/*.c touch ${cwd}/build/src/lib/*.c ${cwd}/build/src/lib/*.o @@ -88,13 +71,9 @@ 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=File -scripts/check_for_zombie_jobs storage=File echo "Backup 3 done" # make some files for the incremental to pick up touch ${cwd}/build/src/lib/*.c ${cwd}/build/src/lib/*.o @@ -112,13 +91,9 @@ 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=File -scripts/check_for_zombie_jobs storage=File echo "Backup 4 done" # # now do several restores to ensure we cleanup between jobs @@ -143,34 +118,10 @@ 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=File +bacula_stop -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 " !!!!! four-jobs-test Bacula source failed!!! !!!!! " - echo " !!!!! four-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 " ===== four-jobs-test Bacula source OK `date +%R:%S` ===== " - echo " ===== four-jobs-test OK `date +%R:%S` ===== " >>test.out - scripts/cleanup -fi +check_two_logs +check_restore_diff +end_test diff --git a/regress/tests/incremental-test b/regress/tests/incremental-test index 6449eef6c5..a9287dce5e 100755 --- a/regress/tests/incremental-test +++ b/regress/tests/incremental-test @@ -3,6 +3,11 @@ # Run a simple backup of the Bacula build directory then create some # new files, do an Incremental and restore those two files. # +TestName="incremental-test" +JobName=Incremental +. scripts/functions +set_debug 0 + cwd=`pwd` scripts/copy-test-confs scripts/cleanup @@ -14,17 +19,12 @@ echo "${cwd}/tmp/build/ficheriro1.txt" >restore-list echo "${cwd}/tmp/build/ficheriro2.txt" >>restore-list cd ${cwd} -echo " " -echo " " -echo " === Starting incremental-test at `date +%R:%S` ===" -echo " === Starting incremental-test at `date +%R:%S` ===" >>working/log -echo " " +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=File volume=TestVolume001 label storage=File volume=TestVolume002 run job=CompressedTest yes @@ -32,17 +32,20 @@ wait messages quit END_OF_DATA -scripts/check_for_zombie_jobs storage=File + +run_bacula +check_for_zombie_jobs storage=File # # Now create two new files to be restored later # sleep 1 echo "ficheriro1.txt" >${cwd}/tmp/build/ficheriro1.txt cp -f ${cwd}/tmp/build/dird.c ${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 +@$out tmp/log1.out @# Force Incremental on the second Volume update volume=TestVolume001 VolStatus=Used run level=Differential job=CompressedTest yes @@ -50,76 +53,95 @@ wait messages quit END_OF_DATA + +run_bconsole + sleep 1 touch ${cwd}/tmp/build/ficheriro1.txt touch ${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 +@$out tmp/log1.out run level=Incremental job=CompressedTest yes wait messages quit END_OF_DATA + +run_bconsole + sleep 1 cd ${cwd}/tmp/build cp -f ficheriro2.txt 1 sed "s%a%b%g" 1 >ficheriro2.txt rm -f 1 cd ${cwd} -bin/bconsole -c bin/bconsole.conf <&1 >/dev/null +cat <tmp/bconcmds @output /dev/null messages -@output tmp/log1.out +@$out tmp/log1.out run level=Differential job=CompressedTest yes wait messages quit END_OF_DATA + +run_bconsole + sleep 1 touch ${cwd}/tmp/build/ficheriro1.txt touch ${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 +@$out tmp/log1.out run level=Incremental job=CompressedTest yes wait messages quit END_OF_DATA + +run_bconsole + sleep 1 touch ${cwd}/tmp/build/ficheriro1.txt touch ${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 +@$out tmp/log1.out run level=Incremental job=CompressedTest yes wait messages quit END_OF_DATA + +run_bconsole + sleep 1 touch ${cwd}/tmp/build/ficheriro1.txt touch ${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 +@$out tmp/log1.out run level=Incremental job=CompressedTest yes wait messages quit END_OF_DATA + +run_bconsole sleep 1 touch ${cwd}/tmp/build/ficheriro1.txt touch ${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 +@$out tmp/log1.out run level=Incremental job=CompressedTest yes wait messages @@ -134,32 +156,15 @@ 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=$? + +run_bconsole +check_for_zombie_jobs storage=File +stop_bacula + +check_two_logs # # 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-test Bacula source failed!!! !!!!! " - echo " !!!!! incremental-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 " ===== incremental-test Bacula source OK `date +%R:%S` ===== " - echo " ===== incremental-test OK `date +%R:%S` ===== " >>test.out - scripts/cleanup -fi +check_restore_tmp_build_diff +end_test diff --git a/regress/tests/query-test b/regress/tests/query-test index 5db429f56b..3e27498622 100755 --- a/regress/tests/query-test +++ b/regress/tests/query-test @@ -4,12 +4,10 @@ # new files, do a Differental then a bunch of query commands # and finally restore the two files. # -debug=0 -if test "$debug" -eq 1 ; then - out="tee" -else - out="output" -fi +TestName="query-test" +JobName=query +. scripts/functions +set_debug 0 cwd=`pwd` scripts/copy-test-confs @@ -22,13 +20,8 @@ echo "${cwd}/tmp/build/ficheriro1.txt" >restore-list echo "${cwd}/tmp/build/ficheriro2.txt" >>restore-list cd ${cwd} -echo " " -echo " " -echo " === Starting query-test at `date +%R:%S` ===" -echo " === Starting query-test at `date +%R:%S` ===" >>working/log -echo " " +start_test -bin/bacula start 2>&1 >/dev/null cat <tmp/bconcmds @output /dev/null messages @@ -40,16 +33,13 @@ wait messages quit END_OF_DATA -if test "$debug" -eq 1 ; then - bin/bacula start - cat tmp/bconcmds | bin/bconsole -c bin/bconsole.conf -else - bin/bacula start 2>&1 >/dev/null - cat tmp/bconcmds | bin/bconsole -c bin/bconsole.conf 2>&1 >/dev/null -fi -scripts/check_for_zombie_jobs storage=File + +run_bacula +check_for_zombie_jobs storage=File + echo "ficheriro1.txt" >${cwd}/tmp/build/ficheriro1.txt echo "ficheriro2.txt" >${cwd}/tmp/build/ficheriro2.txt + cat <tmp/bconcmds @output /dev/null messages @@ -61,14 +51,10 @@ wait messages @output 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=File + +run_bacula +check_for_zombie_jobs storage=File + echo "ficheriro2.txt" >${cwd}/tmp/build/ficheriro2.txt cat <tmp/bconcmds @output /dev/null @@ -118,39 +104,16 @@ messages @output 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=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=$? + +run_bacula +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 " !!!!! query-test Bacula source failed!!! !!!!! " - echo " !!!!! query-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 " ===== query-test Bacula source OK `date +%R:%S` ===== " - echo " ===== query-test OK `date +%R:%S` ===== " >>test.out - scripts/cleanup -fi + +check_two_logs +check_restore_tmp_build_diff +end_test diff --git a/regress/tests/recycle-test b/regress/tests/recycle-test index 57a499714a..a34126beac 100755 --- a/regress/tests/recycle-test +++ b/regress/tests/recycle-test @@ -5,22 +5,23 @@ # volumes to be recycled, and cycling through the volumes # twice. Tests maxvoljobs and volretention. # +TestName="recycle-test" +JobName=Recycle +. scripts/functions +set_debug 0 + cwd=`pwd` scripts/copy-test-confs scripts/cleanup echo "${cwd}/build" >/tmp/file-list +change_jobname $JobName -echo " " -echo " " -echo " === Starting recycle-test at `date +%R:%S` ===" -echo " === Starting recycle-test at `date +%R:%S` ===" >working/log -echo " " +start_test -#bin/bacula start 2>&1 >/dev/null -bin/bacula start -bin/bconsole -c bin/bconsole.conf <&1 >/dev/null +cat <tmp/bconcmds @output /dev/null messages +@$out tmp/log1.out label storage=File1 volume=TestVolume001 label storage=File1 volume=TestVolume002 label storage=File1 volume=TestVolume003 @@ -31,36 +32,35 @@ update Volume=TestVolume002 maxvoljobs=1 update Volume=TestVolume003 volretention=10s update Volume=TestVolume003 maxvoljobs=1 list volumes -run job=NightlySave storage=File1 level=full yes +run job=$JobName storage=File1 level=full yes wait messages list volumes -run job=NightlySave storage=File1 level=full yes +run job=$JobName storage=File1 level=full yes wait messages list volumes -run job=NightlySave storage=File1 level=full yes +run job=$JobName storage=File1 level=full yes wait messages list volumes @sleep 10 -run job=NightlySave storage=File1 level=full yes +run job=$JobName storage=File1 level=full yes wait messages list volumes -run job=NightlySave storage=File1 level=full yes +run job=$JobName storage=File1 level=full yes wait messages -@output tmp/log1.out list volumes -run job=NightlySave storage=File1 level=full yes +run job=$JobName storage=File1 level=full yes wait messages list volumes @# @# now do a restore @# -@output tmp/log2.out +@$out tmp/log2.out restore where=${cwd}/tmp/bacula-restores select storage=File1 unmark * mark * @@ -71,28 +71,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 " !!!!! recycle-test Bacula source failed!!! !!!!! " - echo " !!!!! recycle-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 " ===== recycle-test Bacula source OK `date +%R:%S` ===== " - echo " ===== recycle-test OK `date +%R:%S` ===== " >>test.out - scripts/cleanup -fi + +run_bacula +check_for_zombie_jobs storage=File1 +stop_bacula + +check_two_logs +check_restore_diff +end_test diff --git a/regress/tests/restore-by-file-test b/regress/tests/restore-by-file-test index c1d81194b5..8801eb9a63 100755 --- a/regress/tests/restore-by-file-test +++ b/regress/tests/restore-by-file-test @@ -4,12 +4,11 @@ # then restore it. # -debug=0 -if test "$debug" -eq 1 ; then - out="tee" -else - out="output" -fi +TestName="restore-by-file-test" +JobName=SpanVol +. scripts/functions +set_debug 0 + cwd=`pwd` scripts/copy-test-confs scripts/cleanup @@ -23,11 +22,7 @@ sed s%\^%${cwd}/tmp/build/% 1 >restore-list rm -f 1 cd ${cwd} -echo " " -echo " " -echo " === Starting restore-by-file-test at `date +%R:%S` ===" -echo " === Starting restore-by-file-test at `date +%R:%S` ===" >>working/log -echo " " +start_test cat <tmp/bconcmds @output /dev/null @@ -52,36 +47,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 +run_bacula +check_for_zombie_jobs storage=File +stop_bacula -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 tmp/build tmp/bacula-restores${cwd}/tmp/build 2>&1 >/dev/null -if [ $? != 0 -o $bstat != 0 -o $rstat != 0 ] ; then - echo " " - echo " " - echo " !!!!! restore-by-file-test Bacula source failed!!! !!!!! " - echo " !!!!! restore-by-file-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 " ===== restore-by-file-test Bacula source OK `date +%R:%S` ===== " - echo " ===== restore-by-file-test OK `date +%R:%S` ===== " >>test.out - scripts/cleanup -fi +check_two_logs +check_restore_tmp_build_diff +end_test diff --git a/regress/tests/restore-disk-seek-test b/regress/tests/restore-disk-seek-test index 4b2c028c69..31ec4ebeae 100755 --- a/regress/tests/restore-disk-seek-test +++ b/regress/tests/restore-disk-seek-test @@ -6,12 +6,10 @@ # match. Even though disk seeking is not yet enabled, this is a good test, # and once it is enabled, this will test it. # -debug=0 -if test "$debug" -eq 1 ; then - out="tee" -else - out="output" -fi +TestName="restore-disk-seek-test" +JobName=restore-disk-seek +. scripts/functions +set_debug 0 cwd=`pwd` scripts/copy-test-confs @@ -37,11 +35,7 @@ cp -fp ${cwd}/build/src/dird/* ${cwd}/tmp/build 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-disk-seek-test at `date +%R:%S` ===" -echo " === Starting restore-disk-seek-test at `date +%R:%S` ===" >>working/log -echo " " +start_test cat <tmp/bconcmds @$out /dev/null @@ -69,41 +63,15 @@ 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 +check_for_zombie_jobs storage=File +stop_bacula -scripts/check_for_zombie_jobs storage=File -bin/bacula stop 2>&1 >/dev/null # Now setup a control directory of only what we *should* restore rm -rf ${cwd}/tmp/build mkdir ${cwd}/tmp/build cp -p ${cwd}/build/src/dird/*.c ${cwd}/tmp/build -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 tmp/build tmp/bacula-restores${cwd}/tmp/build 2>&1 >/dev/null -if [ $? != 0 -o $bstat != 0 -o $rstat != 0 ] ; then - echo " " - echo " " - echo " !!!!! restore-disk-seek-test Bacula source failed!!! !!!!! " - echo " !!!!! restore-disk-seek-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 " ===== restore-disk-seek-test Bacula source OK `date +%R:%S` ===== " - echo " ===== restore-disk-seek-test OK `date +%R:%S` ===== " >>test.out - scripts/cleanup - rm -rf ${cwd}/tmp/build -fi + +check_two_logs +check_restore_tmp_build_diff +end_test diff --git a/regress/tests/restore2-by-file-test b/regress/tests/restore2-by-file-test index 357ecc2531..5239eb009b 100755 --- a/regress/tests/restore2-by-file-test +++ b/regress/tests/restore2-by-file-test @@ -3,23 +3,23 @@ # Run a simple backup of the Bacula build directory using the compressed option # then restore a few selected files. # +TestName="restore2-by-file-test" +JobName=restore2byfile +. scripts/functions +set_debug 0 + cwd=`pwd` scripts/copy-test-confs scripts/cleanup echo "${cwd}/build" >/tmp/file-list sed s%\^%${cwd}% ${cwd}/scripts/flist >${cwd}/tmp/restore2-list -echo " " -echo " " -echo " === Starting restore2-by-file-test at `date +%R:%S` ===" -echo " === Starting restore2-by-file-test at `date +%R:%S` ===" >>working/log -echo " " +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=File volume=TestVolume001 run job=CompressedTest yes wait @@ -27,7 +27,7 @@ messages @# @# now do a restore @# -@output tmp/log2.out +@$out tmp/log2.out restore where=${cwd}/tmp/bacula-restores storage=File file=<${cwd}/tmp/restore2-list yes wait @@ -35,12 +35,12 @@ 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=$? + +run_bacula +check_for_zombie_jobs storage=File +stop_bacula + +check_two_logs dstat=0 for i in `cat ${cwd}/tmp/restore2-list`; do diff $i ${cwd}/tmp/bacula-restores$i @@ -48,18 +48,4 @@ for i in `cat ${cwd}/tmp/restore2-list`; do dstat=1 fi done -if [ $dstat != 0 -o $bstat != 0 -o $rstat != 0 ] ; then - echo " " - echo " " - echo " !!!!! restore2-by-file-test Bacula source failed!!! !!!!! " - echo " !!!!! restore2-by-file-test failed!!! !!!!! " >>test.out - echo " " - echo "Backup term status = $bstat" - echo "Restore term status = $rstat" - echo "Diff status = $dstat" - echo " " -else - echo " ===== restore2-by-file-test Bacula source OK `date +%R:%S` ===== " - echo " ===== restore2-by-file-test OK `date +%R:%S` ===== " >>test.out - scripts/cleanup -fi +end_test diff --git a/regress/tests/scratch-pool-test b/regress/tests/scratch-pool-test index a8b6affd44..2f3d6ec0ed 100755 --- a/regress/tests/scratch-pool-test +++ b/regress/tests/scratch-pool-test @@ -11,17 +11,16 @@ # # Note we use the viritual disk autochanger # -debug=0 +TestName="scratch-pool-test" +JobName=scratch-pool +. scripts/functions +set_debug 0 + . config.out if test x${AUTOCHANGER} = x/dev/null ; then echo "two-volume-test skipped. No autochanger." exit fi -if test "$debug" -eq 1 ; then - out="tee" -else - out="output" -fi cwd=`pwd` scripts/cleanup scripts/copy-2disk-confs @@ -33,12 +32,10 @@ outf="tmp/sed_tmp" 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 +change_jobname $JobName + +start_test -echo " " -echo " " -echo " === Starting Scratch Pool Test at `date +%R:%S` ===" -echo " === Starting Scratch Pool Test at `date +%R:%S` ===" >>working/log -echo " " # Write out bconsole commands cat <tmp/bconcmds @$out /dev/null @@ -51,7 +48,7 @@ update Volume=TestVolume001 inchanger=no pool=Scratch drive=0 @#setdebug level=200 storage=DDS-4 llist volume=TestVolume001 llist volume=TestVolume002 -run job=NightlySave yes +run job=$JobName yes wait messages list volumes @@ -68,29 +65,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 " !!!!! Scratch Pool Test Bacula source failed!!! !!!!! " - echo " !!!!! Scratch Pool Test failed!!! !!!!! " >>test.out - echo " " -else - echo " ===== Scratch Pool Test Bacula source OK `date +%R:%S` ===== " - echo " ===== Scratch Pool Test OK `date +%R:%S` ===== " >>test.out - scripts/cleanup -fi +check_two_logs +check_restore_diff +end_test diff --git a/regress/tests/six-vol-test b/regress/tests/six-vol-test index 0c709f095e..10fb23ea96 100755 --- a/regress/tests/six-vol-test +++ b/regress/tests/six-vol-test @@ -3,6 +3,10 @@ # Create a 60MB file with random bytes. Back it up to 6 Volumes # each constrained to 10MB using the automatic labeling feature. # +TestName="six-vol-test" +JobName=SixVol +. scripts/functions +set_debug 0 if test ! -c /dev/urandom ; then echo "No random device. Test skipped.\n" @@ -17,24 +21,19 @@ echo "Creating a 56MB file with random data ..." dd if=/dev/urandom of=${cwd}/tmp/largefile bs=1024 count=55000 echo "largefile created" -echo " " -echo " " -echo " === Starting six-vol-test at `date +%R:%S` ===" -echo " === Starting six-vol-test at `date +%R:%S` ===" >>working/log -echo " " +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 run job=MultiVol storage=File yes wait messages @# @# now do a restore @# -@output tmp/log2.out +@$out tmp/log2.out restore where=${cwd}/tmp/bacula-restores select storage=File unmark * mark * @@ -45,28 +44,12 @@ 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=$? + +run_bacula +check_for_zombie_jobs storage=File +stop_bacula + +check_two_logs 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 " !!!!! six-vol-test Bacula source failed!!! !!!!! " - echo " !!!!! six-vol-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 " ===== six-vol-test Bacula source OK `date +%R:%S` ===== " - echo " ===== six-vol-test OK `date +%R:%S` ===== " >>test.out - scripts/cleanup -fi +dstat=$? +end_test diff --git a/regress/tests/span-vol-test b/regress/tests/span-vol-test index da8a730d5b..21f0026b7c 100755 --- a/regress/tests/span-vol-test +++ b/regress/tests/span-vol-test @@ -5,26 +5,21 @@ # totally full. I.e. make sure that bsr selects all tapes # including those fully spanned. # -debug=0 -if test "$debug" -eq 1 ; then - out="tee" -else - out="output" -fi +TestName="span-vol-test" +JobName=SpanVol +. scripts/functions +set_debug 0 cwd=`pwd` scripts/copy-test-confs scripts/cleanup echo "${cwd}/build" >/tmp/file-list +change_jobname $JobName -echo " " -echo " " -echo " === Starting span-vol-test at `date +%R:%S` ===" -echo " === Starting span-vol-test at `date +%R:%S` ===" >working/log -echo " " +start_test cat <tmp/bconcmds -@$out /dev/null +@output /dev/null messages @$out tmp/log1.out label storage=File1 volume=TestVolume004 @@ -34,7 +29,7 @@ label storage=File1 volume=TestVolume001 update Volume=TestVolume004 MaxVolBytes=3000000 update Volume=TestVolume003 MaxVolBytes=3000000 update Volume=TestVolume002 MaxVolBytes=3000000 -run job=NightlySave storage=File1 yes +run job=$JobName storage=File1 yes wait list volumes messages @@ -53,36 +48,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 +run_bacula +check_for_zombie_jobs storage=File1 +stop_bacula -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 " !!!!! span-vol-test Bacula source failed!!! !!!!! " - echo " !!!!! span-vol-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 " ===== span-vol-test Bacula source OK `date +%R:%S` ===== " - echo " ===== span-vol-test OK `date +%R:%S` ===== " >>test.out - scripts/cleanup -fi +check_two_logs +check_restore_diff +end_test diff --git a/regress/tests/sparse-compressed-test b/regress/tests/sparse-compressed-test index a4d40e1924..ebdd5ce4b9 100755 --- a/regress/tests/sparse-compressed-test +++ b/regress/tests/sparse-compressed-test @@ -3,23 +3,22 @@ # Run a simple backup of the Bacula build directory using the Sparse option # then restore it. # +TestName="sparse-compressed-test" +JobName=Sparse-conpressed +. scripts/functions +set_debug 0 + cwd=`pwd` scripts/copy-test-confs scripts/cleanup echo "${cwd}/build" >/tmp/file-list -bin/bacula stop 2>&1 >/dev/null -echo " " -echo " " -echo " === Starting sparse-compressed-test at `date +%R:%S` ===" -echo " === Starting sparse-compressed-test at `date +%R:%S` ===" >>working/log -echo " " +start_test -bin/bacula start 2>&1 >/dev/null -bin/bconsole -c bin/bconsole.conf <&1 >/dev/null +cat >tmp/bconcmds <&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 " !!!!! sparse-compressed-test Bacula source failed!!! !!!!! " - echo " !!!!! sparse-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 " ===== sparse-compressed-test Bacula source OK `date +%R:%S` ===== " - echo " ===== sparse-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/sparse-test b/regress/tests/sparse-test index 5122fdd805..70f6e3d5a3 100755 --- a/regress/tests/sparse-test +++ b/regress/tests/sparse-test @@ -3,30 +3,30 @@ # Run a simple backup of the Bacula build directory using the Sparse option # then restore it. # +TestName="sparse-test" +JobName=SparseTest +. scripts/functions +set_debug 0 + cwd=`pwd` scripts/copy-test-confs scripts/cleanup echo "${cwd}/build" >/tmp/file-list -echo " " -echo " " -echo " === Starting sparse-test at `date +%R:%S` ===" -echo " === Starting sparse-test at `date +%R:%S` ===" >>working/log -echo " " +start_test -bin/bacula start 2>&1 >/dev/null -bin/bconsole -c bin/bconsole.conf <&1 >/dev/null +cat >tmp/bconcmds <&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 " !!!!! sparse-test Bacula source failed!!! !!!!! " - echo " !!!!! sparse-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 " ===== sparse-test Bacula source OK `date +%R:%S` ===== " - echo " ===== sparse-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/two-jobs-test b/regress/tests/two-jobs-test index af4c38d7c5..2010d81ed9 100755 --- a/regress/tests/two-jobs-test +++ b/regress/tests/two-jobs-test @@ -3,44 +3,48 @@ # Run a simple backup of the Bacula build directory using the compressed option # then backup a second time and finally restore it # +TestName="two-jobs-test" +JobName=Two-Jobs +. scripts/functions +set_debug 0 + cwd=`pwd` scripts/copy-test-confs scripts/cleanup echo "${cwd}/build" >/tmp/file-list +change_jobname $JobName -echo " " -echo " " -echo " === Starting two-jobs-test at `date +%R:%S` ===" -echo " === Starting two-jobs-test at `date +%R:%S` ===" >>working/log -echo " " +start_test -bin/bacula start 2>&1 >/dev/null -bin/bconsole -c bin/bconsole.conf <&1 >/dev/null +cat >tmp/bconcmds <&1 >/dev/null +cat >tmp/bconcmds <&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-jobs-test Bacula source failed!!! !!!!! " - echo " !!!!! two-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 " ===== two-jobs-test Bacula source OK `date +%R:%S` ===== " - echo " ===== two-jobs-test OK `date +%R:%S` ===== " >>test.out - scripts/cleanup -fi + +run_bconsole +check_for_zombie_jobs storage=File +stop_bacula + +check_two_logs +check_restore_diff +end_test diff --git a/regress/tests/two-pool-test b/regress/tests/two-pool-test index 3b3fb5eb53..bec846f236 100755 --- a/regress/tests/two-pool-test +++ b/regress/tests/two-pool-test @@ -9,17 +9,16 @@ # # Note, we use the virtual disk autochanger. # +TestName="two-pool-test" +JobName=Two-pool +. scripts/functions +set_debug 0 + . config.out if test x${AUTOCHANGER} = x/dev/null ; then echo "two-pool-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-2disk-confs @@ -29,11 +28,8 @@ scripts/prepare-two-disks # Reduced to 1 for portable echo "${cwd}/build" >/tmp/file-list -echo " " -echo " " -echo " === Starting Two Pool Test at `date +%R:%S` ===" -echo " === Starting Two Pool Test at `date +%R:%S` ===" >>working/log -echo " " +start_test + # Write out bconsole commands to a file cat <tmp/bconcmds @output /dev/null @@ -74,33 +70,10 @@ 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 -# 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 Test Bacula source failed!!! !!!!! " - echo " !!!!! Two Pool Test failed!!! !!!!! " >>test.out - echo " " -else - echo " ===== Two Pool Test Bacula source OK `date +%R:%S` ===== " - echo " ===== Two Pool Test OK `date +%R:%S` ===== " >>test.out - scripts/cleanup -fi +check_two_logs +check_restore_diff +end_test diff --git a/regress/tests/two-vol-test b/regress/tests/two-vol-test index 967cc95936..2c6e0930f6 100755 --- a/regress/tests/two-vol-test +++ b/regress/tests/two-vol-test @@ -3,23 +3,18 @@ # Run a simple backup of the Bacula build directory but # split the archive into two volumes # -debug=0 -if test "$debug" -eq 1 ; then - out="tee" -else - out="output" -fi +TestName="two-vol-test" +JobName=TwoVol +. scripts/functions +set_debug 0 cwd=`pwd` scripts/copy-test-confs scripts/cleanup echo "${cwd}/build" >/tmp/file-list +change_jobname $JobName -echo " " -echo " " -echo " === Starting two-vol-test at `date +%R:%S` ===" -echo " === Starting two-vol-test at `date +%R:%S` ===" >working/log -echo " " +start_test cat <tmp/bconcmds @$out /dev/null @@ -28,7 +23,7 @@ messages label storage=File1 volume=TestVolume002 label storage=File1 volume=TestVolume001 update Volume=TestVolume002 MaxVolBytes=3000000 -run job=NightlySave storage=File1 yes +run job=$JobName storage=File1 yes wait messages @# @@ -43,36 +38,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 +run_bacula +check_for_zombie_jobs storage=File1 +stop_bacula -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 " !!!!! two-vol-test Bacula source failed!!! !!!!! " - echo " !!!!! two-vol-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 " ===== two-vol-test Bacula source OK `date +%R:%S` ===== " - echo " ===== two-vol-test OK `date +%R:%S` ===== " >>test.out - scripts/cleanup -fi +check_two_logs +check_restore_diff +end_test diff --git a/regress/tests/two-volume-test b/regress/tests/two-volume-test index 8d08325790..4a2eac748d 100755 --- a/regress/tests/two-volume-test +++ b/regress/tests/two-volume-test @@ -7,17 +7,15 @@ # # Note we use the viritual disk autochanger # +TestName="two-volume-test" +JobName=TwoVolume +. scripts/functions +set_debug 0 . config.out if test x${AUTOCHANGER} = x/dev/null ; then echo "two-volume-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-2disk-confs @@ -30,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 Test at `date +%R:%S` ===" -echo " === Starting Two Volume Test at `date +%R:%S` ===" >>working/log -echo " " +change_jobname $JobName + +start_test # Write out bconsole commands cat <tmp/bconcmds @$out /dev/null @@ -44,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 @# @@ -59,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 Test Bacula source failed!!! !!!!! " - echo " !!!!! Two Volume Test failed!!! !!!!! " >>test.out - echo " " -else - echo " ===== Two Volume Test Bacula source OK `date +%R:%S` ===== " - echo " ===== Two Volume Test OK `date +%R:%S` ===== " >>test.out - scripts/cleanup -fi +check_two_logs +check_restore_diff +end_test diff --git a/regress/tests/verify-vol-test b/regress/tests/verify-vol-test index c7b0cb247a..23047f2d07 100755 --- a/regress/tests/verify-vol-test +++ b/regress/tests/verify-vol-test @@ -3,23 +3,18 @@ # Run a simple backup of the Bacula build directory # then verify the catalog. # -debug=0 -if test "$debug" -eq 1 ; then - out="tee" -else - out="output" -fi +TestName="verify-vol-test" +JobName=VerifyVol +. scripts/functions +set_debug 0 cwd=`pwd` scripts/copy-test-confs scripts/cleanup echo "${cwd}/build" >/tmp/file-list +change_jobname $JobName -echo " " -echo " " -echo " === Starting verify Volume Test at `date +%R:%S` ===" -echo " === Starting verify Volume Test at `date +%R:%S` ===" >>working/log -echo " " +start_test cat <tmp/bconcmds @$out /dev/null @@ -27,7 +22,7 @@ messages @$out tmp/log1.out setdebug level=1 storage=File sd label storage=File volume=TestVolume001 -run job=NightlySave yes +run job=$JobName yes wait messages @# @@ -42,35 +37,15 @@ 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 sleep 2 -scripts/check_for_zombie_jobs storage=File -bin/bacula stop 2>&1 >/dev/null +check_for_zombie_jobs storage=File +stop_bacula + grep "^ Termination: *Backup OK" tmp/log1.out 2>&1 >/dev/null bstat=$? grep "^ Termination: *Verify OK" ${cwd}/tmp/original 2>&1 >/dev/null -if [ $? != 0 -o $bstat != 0 ] ; then - echo " " - echo " " - echo " !!!!! Verify Volume failed!!! !!!!! " - echo " !!!!! Verify Volume failed!!! !!!!! " >>test.out - if [ $bstat != 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 " ===== Verify Volume Test OK `date +%R:%S` ===== " - echo " ===== Verify Volume Test OK `date +%R:%S` ===== " >>test.out - scripts/cleanup -fi +rstat=$? +dstat=0 +end_test diff --git a/regress/tests/weird-files-test b/regress/tests/weird-files-test index e508e7fb52..4174ec4371 100755 --- a/regress/tests/weird-files-test +++ b/regress/tests/weird-files-test @@ -3,20 +3,21 @@ # Run a simple backup of the Bacula build directory # then restore it. # -debug=0 -if test "$debug" -eq 1 ; then - out="tee" -else - out="output" -fi +TestName="weird-files-test" +JobName=wierd-files +. scripts/functions +set_debug 0 + if test ! -d weird-files ; then echo " " echo "Weird files not configured. Test not run." exit 0 fi + cwd=`pwd` scripts/copy-test-confs scripts/cleanup +change_jobname $JobName # # Note, we save the weird-files directory twice on purpose # because this causes problems with hard linked files @@ -26,11 +27,7 @@ scripts/cleanup echo "${cwd}/weird-files" >/tmp/file-list echo "${cwd}/weird-files" >>/tmp/file-list -echo " " -echo " " -echo " === Starting weird filenames test at `date +%R:%S` ===" -echo " === Starting weird filenames test at `date +%R:%S` ===" >>working/log -echo " " +start_test cat <tmp/bconcmds @$out /dev/null @@ -38,7 +35,7 @@ messages @$out tmp/log1.out label storage=File TestVolume001 -run job=NightlySave +run job=$JobName yes wait messages @@ -56,40 +53,17 @@ 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=File -bin/bacula stop 2>&1 >/dev/null + +run_bacula +check_for_zombie_jobs storage=File +stop_bacula + ${cwd}/bin/testls weird-files | sort >${cwd}/tmp/original cd tmp/bacula-restores${cwd} ${cwd}/bin/testls weird-files | sort >${cwd}/tmp/restored cd ${cwd} -grep "^ Termination: *Backup OK" tmp/log1.out 2>&1 >/dev/null -bstat=$? -grep "^ Termination: *Restore OK" tmp/log2.out 2>&1 >/dev/null -rstat=$? + +check_two_logs diff ${cwd}/tmp/original ${cwd}/tmp/restored 2>&1 >/dev/null -if [ $? != 0 -o $bstat != 0 -o $rstat != 0 ] ; then - echo " " - echo " " - echo " !!!!! Weird files test failed!!! !!!!! " - echo " !!!!! Weird files 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 " ===== Weird files test OK `date +%R:%S` ===== " - echo " ===== Weird files test OK `date +%R:%S` ===== " >>test.out - cd ${cwd} - scripts/cleanup -fi +dstat=$? +end_test diff --git a/regress/tests/weird-files2-test b/regress/tests/weird-files2-test index b99a4c540b..02b18f6bca 100755 --- a/regress/tests/weird-files2-test +++ b/regress/tests/weird-files2-test @@ -3,12 +3,10 @@ # Run a simple backup of the Bacula build directory # then restore it. # -debug=0 -if test "$debug" -eq 1 ; then - out="tee" -else - out="output" -fi +TestName="weird-files2-test" +JobName=weird-files2 +. scripts/functions +set_debug 0 if test ! -d weird-files ; then echo " " @@ -21,12 +19,9 @@ scripts/cleanup rm -rf weird-files2 cp -Rp weird-files weird-files2 echo "${cwd}/weird-files2" >/tmp/file-list +change_jobname $JobName -echo " " -echo " " -echo " === Starting weird-files2 test at `date +%R:%S` ===" -echo " === Starting weird-file2 test at `date +%R:%S` ===" >>working/log -echo " " +start_test bin/testls weird-files2 >${cwd}/tmp/original @@ -35,20 +30,15 @@ cat <tmp/bconcmds messages @$out tmp/log1.out label storage=File volume=TestVolume001 -run job=NightlySave yes +run job=$JobName 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 -scripts/check_for_zombie_jobs storage=File + +run_bacula +check_for_zombie_jobs storage=File # # Now mess up the a hard link, and a soft link # @@ -77,36 +67,14 @@ 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 -scripts/check_for_zombie_jobs storage=File -bin/bacula stop 2>&1 >/dev/null +run_bconsole +check_for_zombie_jobs storage=File +stop_bacula + bin/testls weird-files2 >${cwd}/tmp/restored -grep "^ Termination: *Backup OK" tmp/log1.out 2>&1 >/dev/null -bstat=$? -grep "^ Termination: *Restore OK" tmp/log2.out 2>&1 >/dev/null -rstat=$? + +check_two_logs diff ${cwd}/tmp/original ${cwd}/tmp/restored 2>&1 >/dev/null -if [ $? != 0 -o $bstat != 0 -o $rstat != 0 ] ; then - echo " " - echo " " - echo " !!!!! Weird files2 test failed!!! !!!!! " - echo " !!!!! Weird files2 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 " ===== Weird files2 test OK `date +%R:%S` ===== " - echo " ===== Weird files2 test OK `date +%R:%S` ===== " >>test.out - cd ${cwd} - scripts/cleanup - rm -rf weird-files2 -fi +dstat=$? + +end_test -- 2.39.5