--- /dev/null
+#
+# 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
+}
# 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
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
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
# 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
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
# 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
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
@#
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
# 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
label storage=File1
TestVolume002
update Volume=TestVolume001 MaxVolBytes=3000000
-run job=NightlySave storage=File1
+run job=$JobName storage=File1
yes
wait
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
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
# 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
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
@#
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
#
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 " "
# 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
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
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
@$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
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
# 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
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
# 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
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
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
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
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
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
# 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
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
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
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
@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
# 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
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
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
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
@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
# 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
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 *
@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
# 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
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
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
# 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
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
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
# 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
@#
@# 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
@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
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
#
# 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
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
@#setdebug level=200 storage=DDS-4
llist volume=TestVolume001
llist volume=TestVolume002
-run job=NightlySave yes
+run job=$JobName yes
wait
messages
list volumes
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
# 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"
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 *
@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
# 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
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
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
# 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
@#
@# 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
@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
# 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 *
@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
# 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
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 *
@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
#
# 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
# 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
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
# 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
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
@#
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
#
# 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
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
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
@#
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
# 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
@$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
@#
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
# 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
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
@$out tmp/log1.out
label storage=File
TestVolume001
-run job=NightlySave
+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
-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
# 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 " "
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
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
#
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