]> git.sur5r.net Git - bacula/bacula/commitdiff
Begin simplification and cleanup of tests using shell functions
authorKern Sibbald <kern@sibbald.com>
Sat, 24 Jun 2006 07:48:05 +0000 (07:48 +0000)
committerKern Sibbald <kern@sibbald.com>
Sat, 24 Jun 2006 07:48:05 +0000 (07:48 +0000)
git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@3066 91ce42f0-d328-0410-95d8-f526ca767f89

27 files changed:
regress/scripts/functions [new file with mode: 0644]
regress/tests/auto-label-test
regress/tests/backup-bacula-test
regress/tests/bextract-test
regress/tests/bscan-test
regress/tests/bsr-opt-test
regress/tests/differential-test
regress/tests/filed-crypto-test
regress/tests/four-jobs-test
regress/tests/incremental-test
regress/tests/query-test
regress/tests/recycle-test
regress/tests/restore-by-file-test
regress/tests/restore-disk-seek-test
regress/tests/restore2-by-file-test
regress/tests/scratch-pool-test
regress/tests/six-vol-test
regress/tests/span-vol-test
regress/tests/sparse-compressed-test
regress/tests/sparse-test
regress/tests/two-jobs-test
regress/tests/two-pool-test
regress/tests/two-vol-test
regress/tests/two-volume-test
regress/tests/verify-vol-test
regress/tests/weird-files-test
regress/tests/weird-files2-test

diff --git a/regress/scripts/functions b/regress/scripts/functions
new file mode 100644 (file)
index 0000000..3e1c468
--- /dev/null
@@ -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
+}
index 3af2a946e5518596eaf408137469d407067f2efe..631ec549d4a86c0f4ced66ff178b028688e9525d 100755 (executable)
@@ -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 <<END_OF_DATA >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
index b924881e6833753d7b884a0bab6d750d0b336023..2c6d8e24cd3081dc4df422f77b59d8be4018d175 100755 (executable)
@@ -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 <<END_OF_DATA >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
index c07fec39da17d727b623e173d153864e8a0cd49c..0289577ce9d4dc69b91c7f2e84454ff16e618d9a 100755 (executable)
@@ -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 <<END_OF_DATA >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
index 92c01ae5168a5a3bbf63810766e915e1119393e0..65b85031ef642999642368f8e88e9a72b48b58e6 100755 (executable)
@@ -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 <<END_OF_DATA >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
index c8126136104ff233a7d8e08cb6bfd9977a159db1..fa61dde540c5b310f790621360a1a41ae19c1ceb 100755 (executable)
@@ -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 <<END_OF_DATA >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 " "
index e75845455867acb7336c4521fbd33d4c1b252360..a77ddb2fd10fd68be30324bd2410ac49ef476f65 100755 (executable)
@@ -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 <<END_OF_DATA >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
index 7f816eeb2a671df5ace3344c9ef92264a8da8d8e..935d18dcaa868a4cd8b76696ae9f0134d66c61f8 100755 (executable)
@@ -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 <<END_OF_DATA >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
index 0dcfd1b8807f42404df948213bb0b79bf8b15d2c..05da4ccb4d3a14777efc622c04ac68b3d3bded30 100755 (executable)
@@ -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 <<END_OF_DATA >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
index 6449eef6c5d32cc3b7cab1d7e1ec5f20708ad656..a9287dce5eed600b206ceb6780060dc00f2ce263 100755 (executable)
@@ -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 <<END_OF_DATA 2>&1 >/dev/null
+cat <<END_OF_DATA >tmp/bconcmds
 @output /dev/null
 messages
-@output tmp/log1.out
+@$out tmp/log1.out
 label storage=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 <<END_OF_DATA 2>&1 >/dev/null
+
+cat <<END_OF_DATA >tmp/bconcmds
 @output /dev/null
 messages
-@output tmp/log1.out
+@$out tmp/log1.out
 @# 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 <<END_OF_DATA 2>&1 >/dev/null
+
+cat <<END_OF_DATA >tmp/bconcmds
 @output /dev/null
 messages
-@output tmp/log1.out
+@$out tmp/log1.out
 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 <<END_OF_DATA 2>&1 >/dev/null
+cat <<END_OF_DATA >tmp/bconcmds
 @output /dev/null
 messages
-@output tmp/log1.out
+@$out tmp/log1.out
 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 <<END_OF_DATA 2>&1 >/dev/null
+cat <<END_OF_DATA >tmp/bconcmds
 @output /dev/null
 messages
-@output tmp/log1.out
+@$out tmp/log1.out
 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 <<END_OF_DATA 2>&1 >/dev/null
+cat <<END_OF_DATA >tmp/bconcmds
 @output /dev/null
 messages
-@output tmp/log1.out
+@$out tmp/log1.out
 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 <<END_OF_DATA 2>&1 >/dev/null
+cat <<END_OF_DATA >tmp/bconcmds
 @output /dev/null
 messages
-@output tmp/log1.out
+@$out tmp/log1.out
 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 <<END_OF_DATA 2>&1 >/dev/null
+
+cat <<END_OF_DATA >tmp/bconcmds
 @output /dev/null
 messages
-@output tmp/log1.out
+@$out tmp/log1.out
 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
index 5db429f56b383718053c7c1d465df82d1daeaf1d..3e274986222e5ac5b003acb38d53d92e5ab46db1 100755 (executable)
@@ -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 <<END_OF_DATA >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 <<END_OF_DATA >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 <<END_OF_DATA >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
index 57a499714a31eb44c370c872907b3062b3c34679..a34126beac34876bdaae688e2b5c93731d260b8c 100755 (executable)
@@ -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 <<END_OF_DATA 2>&1 >/dev/null
+cat <<END_OF_DATA >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
index c1d81194b514aa626909082a6eca98de05f3b6a3..8801eb9a63be19bcea22f6b1009a965adcf24043 100755 (executable)
@@ -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 <<END_OF_DATA >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
index 4b2c028c69ad133d0273a3b58f836aea918793e3..31ec4ebeaed3092817ff3a9b79e695aa6623a593 100755 (executable)
@@ -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 <<END_OF_DATA >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
index 357ecc2531d0b5dedbbc5751ef32ed970250fa38..5239eb009b1cf8b4aa3e7a29915bca10c0ffa3cb 100755 (executable)
@@ -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 <<END_OF_DATA 2>&1 >/dev/null
+cat <<END_OF_DATA >tmp/bconcmds
 @output /dev/null
 messages
-@output tmp/log1.out
+@$out tmp/log1.out
 label storage=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
index a8b6affd442d1fcaec64bdbf7ee307c07844a989..2f3d6ec0edbc49ef9e502a9cf90fd9d4c9b008e8 100755 (executable)
 #
 #  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 <<END_OF_DATA >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
index 0c709f095ebc3fb157b5624a9c38acc48710ea84..10fb23ea969b1d06336d1a375d1a74c6d75c2cc6 100755 (executable)
@@ -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 <<END_OF_DATA 2>&1 >/dev/null
+cat <<END_OF_DATA >tmp/bconcmds
 @output /dev/null
 messages
-@output tmp/log1.out
+@$out tmp/log1.out
 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
index da8a730d5bf8ed546e6880107cea300bbf2158a5..21f0026b7cf9985b6179dac9de3726dd316c5f35 100755 (executable)
@@ -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 <<END_OF_DATA >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
index a4d40e1924b8c1d0497ab1163a984e6c5b167143..ebdd5ce4b9b9c165c5af2783215385f30ae63ddd 100755 (executable)
@@ -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 <<END_OF_DATA 2>&1 >/dev/null
+cat >tmp/bconcmds <<END_OF_DATA
 @output /dev/null
 messages
-@output tmp/log1.out
+@$out tmp/log1.out
 label storage=File volume=TestVolume001
 run job=SparseCompressedTest yes
 wait
@@ -27,7 +26,7 @@ messages
 @# 
 @# now do a restore
 @#
-@output tmp/log2.out   
+@$out tmp/log2.out   
 restore where=${cwd}/tmp/bacula-restores select all storage=File done
 yes
 wait
@@ -35,28 +34,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 -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
index 5122fdd80501089049b7e47dff16a1652f65ba84..70f6e3d5a37f46f68cdc2d0e01938f0f34d44344 100755 (executable)
@@ -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 <<END_OF_DATA 2>&1 >/dev/null
+cat >tmp/bconcmds <<END_OF_DATA
 @output /dev/null
 messages
-@output tmp/log1.out
+@$out tmp/log1.out
 label storage=File volume=TestVolume001
-run job=SparseTest 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=File
 unmark *
 mark *
@@ -37,28 +37,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 -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
index af4c38d7c5a81270a16d36791b07652029c82816..2010d81ed92e65f70fc8430d5cc63af53739f5fd 100755 (executable)
@@ -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 <<END_OF_DATA 2>&1 >/dev/null
+cat >tmp/bconcmds <<END_OF_DATA
 setdebug level=15  storage=File
 @output /dev/null
 messages
-@output /dev/null
+@output/dev/null
 estimate job=CompressedTest listing
 estimate job=CompressedTest listing
 estimate job=CompressedTest listing
 messages
-@output tmp/log1.out
+@$out tmp/log1.out
 label storage=File volume=TestVolume001
 run job=CompressedTest yes
 wait
 messages
 quit
 END_OF_DATA
-scripts/check_for_zombie_jobs storage=File 
+
+run_bacula
+check_for_zombie_jobs storage=File 
+
 echo "Backup 1 done"
 touch ${cwd}/build/src/dird/*.c
 #
 # run a second job
 #
-bin/bconsole -c bin/bconsole.conf <<END_OF_DATA 2>&1 >/dev/null
+cat >tmp/bconcmds <<END_OF_DATA
 @output /dev/null
 messages
-@output tmp/log1.out
+@$out tmp/log1.out
 run job=CompressedTest
 yes
 wait
@@ -55,7 +59,7 @@ wait
 restore where=${cwd}/tmp/bacula-restores select all storage=File done
 yes
 wait
-@output tmp/log2.out
+@$out tmp/log2.out
 restore where=${cwd}/tmp/bacula-restores select storage=File
 unmark *
 mark *
@@ -66,28 +70,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 -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
index 3b3fb5eb532e314542b85a13378f5dd5028a4f0b..bec846f2363bbcf814ba7d1636ba3f0a091eb22b 100755 (executable)
@@ -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 <<END_OF_DATA >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
index 967cc95936dd640b171d7b7f2d1e4c061f994c60..2c6e0930f601b97cc50064857d6f9d90afe12164 100755 (executable)
@@ -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 <<END_OF_DATA >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
index 8d083257908efd4f515dff129fa102b5a8c39b3d..4a2eac748d798475970e234e168fbe36584d51a3 100755 (executable)
@@ -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 <<END_OF_DATA >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
index c7b0cb247a423be4faba7718cbead76d0ab2de24..23047f2d07f02353baa0d6337f1ba5c3c4e0d78e 100755 (executable)
@@ -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 <<END_OF_DATA >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
index e508e7fb52b75b47838cbe9985aa3e38dfb24802..4174ec43718d173b1d09772d2c8ae0e220376175 100755 (executable)
@@ -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 <<END_OF_DATA >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
index b99a4c540b41e4ae0ff536c65eaed12f07213e57..02b18f6bcad63d41272f47ab6aa3d09d3da12198 100755 (executable)
@@ -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 <<END_OF_DATA >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