scripts/cleanup
fi
}
+
+# Save current directory
+cwd=`pwd`
# We also use the purge and the relabel commands as
# well as a pile of status storage commands.
#
-debug=0
-if test "$debug" -eq 1 ; then
- out="tee"
-else
- out="output"
-fi
+TestName="backup-bacula-tape"
+JobName=backuptape
+. scripts/functions
+set_debug 0
-cwd=`pwd`
scripts/copy-tape-confs
scripts/cleanup-tape
echo "${cwd}/build" >/tmp/file-list
-echo " "
-echo " "
-echo " === Starting Backup Bacula tape test at `date +%R:%S` ==="
-echo " === Starting Backup Bacula tape test at `date +%R:%S` ===" >>working/log
-echo " "
+change_job $JobName
+start_test
+
# Write out bconsole commands
cat <<END_OF_DATA >tmp/bconcmds
messages
END_OF_DATA
-if test "$debug" -eq 1 ; then
- bin/bacula start
- cat tmp/bconcmds | bin/bconsole -c bin/bconsole.conf
-else
- bin/bacula start 2>&1 >/dev/null
- cat tmp/bconcmds | bin/bconsole -c bin/bconsole.conf 2>&1 >/dev/null
-fi
+run_bacula
+check_for_zombie_jobs storage=DDS-4
+stop_bacula
-bin/bacula stop 2>&1 >/dev/null
#
# Now do a second backup after making a few changes
#
quit
END_OF_DATA
-if test "$debug" -eq 1 ; then
- bin/bacula start
- cat tmp/bconcmds | bin/bconsole -c bin/bconsole.conf
-else
- bin/bacula start 2>&1 >/dev/null
- cat tmp/bconcmds | bin/bconsole -c bin/bconsole.conf 2>&1 >/dev/null
-fi
-scripts/check_for_zombie_jobs storage=DDS-4
+run_bacula
+check_for_zombie_jobs storage=DDS-4
+stop_bacula
-bin/bacula stop 2>&1 >/dev/null
-grep "^ Termination: *Backup OK" tmp/log1.out 2>&1 >/dev/null
-bstat=$?
-grep "^ Termination: *Restore OK" tmp/log2.out 2>&1 >/dev/null
-rstat=$?
-diff -r build tmp/bacula-restores${cwd}/build 2>&1 >/dev/null
-if [ $? != 0 -o $bstat != 0 -o $rstat != 0 ] ; then
- echo " "
- echo " "
- echo " !!!!! Backup Bacula tape test failed!!! !!!!! "
- echo " !!!!! Backup Bacula tape test failed!!! !!!!! " >>test.out
- echo " "
-else
- echo " ===== Backup Bacula tape test OK ===== "
- echo " ===== Backup Bacula tape test OK ===== " >>test.out
- scripts/cleanup
-fi
+check_two_logs
+check_restore_diff
+end_test
. scripts/functions
set_debug 0
-cwd=`pwd`
scripts/copy-confs
scripts/cleanup
# to a tape then restore it, we do that twice to ensure that
# we can correctly append to a tape.
#
-cwd=`pwd`
+TestName="backup-win32-tape"
+JobName=backupwintape
+. scripts/functions
+set_debug 0
+
scripts/copy-win32-confs
scripts/cleanup-tape
echo "${cwd}/build" >/tmp/file-list
-echo " "
-echo " "
-echo " === Starting Backup Win32 tape test at `date +%R:%S` ==="
-echo " === Starting Backup Win32 tape test at `date +%R:%S` ===" >>working/log
-echo " "
+change_jobname $JobName
+start_test
+
-bin/bacula start 2>&1 >/dev/null
-bin/bconsole -c bin/bconsole.conf <<END_OF_DATA
+cat <<END_OF_DATA >tmp/bconcmds
@output /dev/null
messages
-@tee tmp/log1.out
+@$out tmp/log1.out
label storage=DDS-4 volume=TestVolume001 slot=0 pool=Default
run job=NightlySave yes
@sleep 10
@#
@# now do a restore
@#
-@#output tmp/log2.out
+@$outt tmp/log2.out
@#restore where=${cwd}/tmp/bacula-restores select all storage=DDS-4 done
@#yes
@#wait
@#messages
END_OF_DATA
-scripts/check_for_zombie_jobs storage=DDS-4
-bin/bacula stop 2>&1 >/dev/null
-grep "^ Termination: *Backup OK" tmp/log1.out 2>&1 >/dev/null
-bstat=$?
-if [ $bstat != 0 ] ; then
- echo " "
- echo " "
- echo " !!!!! Backup Win32 tape test failed!!! !!!!! "
- echo " !!!!! Backup Win32 tape test failed!!! !!!!! " >>test.out
- echo " "
-else
- echo " ===== Backup Win32 tape test OK ===== "
- echo " ===== Backup Win32 tape test OK ===== " >>test.out
- scripts/cleanup
-fi
+run_bacula
+check_for_zombie_jobs storage=DDS-4
+stop_bacula
+
+check_two_logs
+check_restore_diff
+end_test
. scripts/functions
set_debug 0
-
-cwd=`pwd`
scripts/copy-test-confs
scripts/cleanup
echo "${cwd}/build" >/tmp/file-list
-change_jobname $JobName
+change_jobname $JobName
start_test
cat <<END_OF_DATA >tmp/bconcmds
# do a bscan and restore.
# It should require at least 4 different bsrs.
#
-debug=0
-if test "$debug" -eq 1 ; then
- out="tee"
-else
- out="output"
-fi
+TestName="bscan-tape"
+JobName=bscantape
+. scripts/functions
+set_debug 0
-cwd=`pwd`
scripts/copy-tape-confs
scripts/cleanup-tape
echo "${cwd}/build" >/tmp/file-list
cp ${cwd}/bin/bacula-sd.conf ${cwd}/tmp/1
sed "s%# Maximum File Size% Maximum File Size%" ${cwd}/tmp/1 >${cwd}/bin/bacula-sd.conf
-echo " "
-echo " "
-echo " === Starting bscan-tape at `date +%R:%S` ==="
-echo " === Starting bscan-tape at `date +%R:%S` ===" >>working/log
-echo " "
+change_jobname $JobName
+start_test
cat <<END_OF_DATA >tmp/bconcmds
@output /dev/null
-estimate job=NightlySave listing
-estimate job=NightlySave listing
-estimate job=NightlySave listing
+estimate job=$JobName listing
+estimate job=$JobName listing
+estimate job=$JobName listing
messages
@$out tmp/log1.out
setdebug level=2 storage=DDS-4
label storage=DDS-4 volume=TestVolume001 slot=0 pool=Default
-run job=NightlySave yes
+run job=$JobName yes
wait
-run job=NightlySave level=Full yes
+run job=$JobName level=Full yes
wait
-run job=NightlySave level=Full yes
+run job=$JobName level=Full yes
wait
messages
quit
@$out /dev/null
messages
@$out tmp/log1.out
-run job=NightlySave level=Incremental yes
+run job=$JobName level=Incremental yes
wait
messages
quit
@$out /dev/null
messages
@$out tmp/log1.out
-run job=NightlySave level=Incremental yes
+run job=$JobName level=Incremental yes
wait
messages
quit
@$out /dev/null
messages
@$out tmp/log1.out
-run job=NightlySave level=Incremental yes
+run job=$JobName level=Incremental yes
wait
messages
quit
@$out
quit
END_OF_DATA
-scripts/check_for_zombie_jobs storage=DDS-4
+
+run_bacula
+check_for_zombie_jobs storage=DDS-4
+stop_bacula
rm -f ${cwd}/build/src/lib/dummy
-bin/bacula stop 2>&1 >/dev/null
-grep "^ Termination: *Backup OK" tmp/log1.out 2>&1 >/dev/null
-bstat=$?
-grep "^ Termination: *Restore OK" tmp/log2.out 2>&1 >/dev/null
-rstat=$?
-diff -r build tmp/bacula-restores${cwd}/build 2>&1 >/dev/null
-if [ $? != 0 -o $bstat != 0 -o $rstat != 0 ] ; then
- echo " "
- echo " "
- echo " !!!!! bscan-tape Bacula source failed!!! !!!!! "
- echo " !!!!! bscan-tape failed!!! !!!!! " >>test.out
- echo " "
-else
- echo " ===== bscan-tape Bacula source OK ===== "
- echo " ===== bscan-tape OK ===== " >>test.out
-# scripts/cleanup
-fi
+
+check_two_logs
+check_restore_diff
+end_test
scripts/copy-test-confs
scripts/cleanup
echo "${cwd}/build" >/tmp/file-list
-change_jobname $JobName
+change_jobname $JobName
start_test
cat <<END_OF_DATA >tmp/bconcmds
. scripts/functions
set_debug 0
-cwd=`pwd`
scripts/copy-test-confs
scripts/cleanup
echo "${cwd}/build" >/tmp/file-list
+
change_jobname $JobName
start_test
#
# Test the fill command in btape
#
-cwd=`pwd`
+TestName="btape-fill-full-tape"
+JobName=AutoLabel
+. scripts/functions
+set_debug 0
+
scripts/copy-tape-confs
scripts/cleanup-tape
-echo " "
-echo " "
-echo " === Starting btape fill test at `date +%R:%S` ==="
-echo " === Starting btape fill test at `date +%R:%S` ===" >>working/log
-echo " "
+change_jobname $JobName
+start_test
bin/btape -c bin/bacula-sd.conf DDS-4 <<END_OF_DATA 2>&1 >tmp/log1.out
fill
#
# Test the fill command in btape
#
-cwd=`pwd`
+TestName="btape-fill-tape"
+JobName=filltape
+. scripts/functions
+set_debug 0
+
scripts/copy-tape-confs
scripts/cleanup-tape
cp ${cwd}/bin/bacula-sd.conf ${cwd}/tmp/1
sed "s%# MaximumVolumeSize% MaximumVolumeSize%" ${cwd}/tmp/1 >${cwd}/bin/bacula-sd.conf
-echo " "
-echo " "
-echo " === Starting btape fill test at `date +%R:%S` ==="
-echo " === Starting btape fill test at `date +%R:%S` ===" >>working/log
-echo " "
-exit
+start_test
+
bin/btape -c bin/bacula-sd.conf DDS-4 <<END_OF_DATA 2>&1 >tmp/log1.out
fill
s
# Run a simple backup of the Bacula build directory using the compressed option
# then restore it.
#
-cwd=`pwd`
+TestName="compressed-test"
+JobName=compressed
+. scripts/functions
+set_debug 0
+
scripts/copy-test-confs
scripts/cleanup
echo "${cwd}/build" >/tmp/file-list
-echo " "
-echo " "
-echo " === Starting compressed-test at `date +%R:%S` ==="
-echo " === Starting compressed-test at `date +%R:%S` ===" >>working/log
-echo " "
-
-bin/bacula start 2>&1 >/dev/null
-exit
-bin/bconsole -c bin/bconsole.conf <<END_OF_DATA 2>&1 >/dev/null
-@tee /dev/null
+start_test
+
+cat <<END_OF_DATA >tmp/bconcmds
+@output
+messages
+@$out tmp/log1.out
status all
status all
messages
-@tee tmp/log1.out
label storage=File volume=TestVolume001
run job=CompressedTest storage=File yes
wait
@#
@# now do a restore
@#
-@tee tmp/log2.out
+@$out tmp/log2.out
restore where=${cwd}/tmp/bacula-restores select storage=File
unmark *
mark *
yes
wait
messages
-@tee
+@output
quit
END_OF_DATA
-scripts/check_for_zombie_jobs storage=File
-bin/bacula stop 2>&1 >/dev/null
-grep "^ Termination: *Backup OK" tmp/log1.out 2>&1 >/dev/null
-bstat=$?
-grep "^ Termination: *Restore OK" tmp/log2.out 2>&1 >/dev/null
-rstat=$?
-diff -r build tmp/bacula-restores${cwd}/build 2>&1 >/dev/null
-if [ $? != 0 -o $bstat != 0 -o $rstat != 0 ] ; then
- echo " "
- echo " "
- echo " !!!!! compressed-test Bacula source failed!!! !!!!! "
- echo " !!!!! compressed-test failed!!! !!!!! " >>test.out
- if [ $bstat != 0 -o $rstat != 0 ] ; then
- echo " !!!!! Bad Job termination status !!!!! "
- echo " !!!!! Bad Job termination status !!!!! " >>test.out
- else
- echo " !!!!! Restored files differ !!!!! "
- echo " !!!!! Restored files differ !!!!! " >>test.out
- fi
- echo " "
-else
- echo " ===== compressed-test Bacula source OK `date +%R:%S` ===== "
- echo " ===== compressed-test OK `date +%R:%S` ===== " >>test.out
- scripts/cleanup
-fi
+
+run_bacula
+check_for_zombie_jobs storage=File
+stop_bacula
+
+check_two_logs
+check_restore_diff
+end_test
+
#
# Run two jobs at the same time
#
-cwd=`pwd`
+
+TestName="concurrent-jobs-test"
+JobName=concurrent-jobs
+. scripts/functions
+set_debug 0
+
scripts/copy-test-confs
scripts/cleanup
echo "${cwd}/tmp/largefile" >/tmp/file-list
echo "largefile created"
-echo " "
-echo " "
-echo " === Starting concurrent-jobs-test at `date +%R:%S` ==="
-echo " "
-
-bin/bacula start 2>&1 >/dev/null
-bin/bconsole -c bin/bconsole.conf <<END_OF_DATA 2>&1 >/dev/null 2>&1 >/dev/null
+start_test
+
+cat <<END_OF_DATA >tmp/bconcmds
@output /dev/null
messages
-@output tmp/log1.out
+@$out tmp/log1.out
label storage=File volume=TestVolume001
run job=CompressedTest level=Full yes
run job=CompressedTest level=Full yes
@#
@# 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 tmp/largefile tmp/bacula-restores${cwd}/tmp/largefile 2>&1 >/dev/null
-if [ $? != 0 -o $bstat != 0 -o $rstat != 0 ] ; then
- echo " "
- echo " "
- echo " !!!!! concurrent-jobs-test Bacula source failed!!! !!!!! "
- echo " !!!!! concurrent-jobs-test failed!!! !!!!! " >>test.out
- if [ $bstat != 0 -o $rstat != 0 ] ; then
- echo " !!!!! Bad Job termination status !!!!! "
- echo " !!!!! Bad Job termination status !!!!! " >>test.out
- else
- echo " !!!!! Restored files differ !!!!! "
- echo " !!!!! Restored files differ !!!!! " >>test.out
- fi
- echo " "
-else
- echo " ===== concurrent-jobs-test Bacula source OK `date +%R:%S` ===== "
- echo " ===== concurrent-jobs-test OK `date +%R:%S` ===== " >>test.out
- scripts/cleanup
-fi
+run_bacula
+check_for_zombie_jobs storage=File
+stop_bacula
+
+check_two_logs
+check_restore_diff
+end_test
. scripts/functions
set_debug 0
-cwd=`pwd`
scripts/copy-test-confs
scripts/cleanup
echo "${cwd}/tmp/build" >/tmp/file-list
# Run a simple backup of the Bacula build directory
# to two tapes where the maximum tape file size is set to 1M
#
-cwd=`pwd`
+TestName="eot-fail-tape"
+JobName=eotfailtape
+. scripts/functions
+set_debug 0
+
scripts/copy-tape-confs
scripts/cleanup-tape
cp -f ${cwd}/bin/bacula-sd.conf ${cwd}/tmp/1
sed -f ${out} ${cwd}/tmp/1 >${cwd}/bin/bacula-sd.conf
-echo " "
-echo " "
-echo " === Starting eot-fail-tape test at `date +%R:%S` ==="
-echo " === Starting eot-fail-tape test at `date +%R:%S` ===" >>working/log
-echo " "
+change_jobname $JobName
+start_test
-bin/bacula start -d100
-bin/bconsole -c bin/bconsole.conf <<END_OF_DATA 2>&1 >/dev/null
-@tee /dev/null
+cat <<END_OF_DATA >tmp/bconcmds
+@output /dev/null
messages
-@tee tmp/log1.out
+@$out tmp/log1.out
label storage=DDS-4 volume=TestVolume001 slot=0 pool=Default
update Volume=TestVolume001 MaxVolBytes=3000000
-run job=NightlySave yes
+run job=$JobName yes
wait
messages
@#
@# now do a restore
@#
-@tee tmp/log2.out
+@$out tmp/log2.out
restore where=${cwd}/tmp/bacula-restores select all storage=DDS-4 done
yes
wait
@tee
quit
END_OF_DATA
-scripts/check_for_zombie_jobs storage=DDS-4
-bin/bacula stop 2>&1 >/dev/null
-grep "^ Termination: *Backup OK" tmp/log1.out 2>&1 >/dev/null
-bstat=$?
-grep "^ Termination: *Restore OK" tmp/log2.out 2>&1 >/dev/null
-rstat=$?
-diff -r build tmp/bacula-restores${cwd}/build 2>&1 >/dev/null
-if [ $? != 0 -o $bstat != 0 -o $rstat != 0 ] ; then
- echo " "
- echo " "
- echo " !!!!! eot-fail-tape test Bacula source failed!!! !!!!! "
- echo " !!!!! eot-fail-tape test failed!!! !!!!! " >>test.out
- echo " "
-else
- echo " ===== eot-fail-tape test Bacula source OK ===== "
- echo " ===== eot-fail-tape test OK ===== " >>test.out
-# scripts/cleanup
-fi
+run_bacula
+check_for_zombie_jobs storage=DDS-4
+stop_bacula
+
+check_two_logs
+check_restore_diff
+end_test
+
. scripts/functions
set_debug 0
-cwd=`pwd`
scripts/copy-crypto-confs
scripts/cleanup
echo "${cwd}/build" >/tmp/file-list
-change_jobname $JobName
+change_jobname $JobName
start_test
cat <<END_OF_DATA >tmp/bconcmds
# to a tape where we set the minimum and maximum block
# sizes.
#
-debug=0
-if test "$debug" -eq 1 ; then
- out="tee"
-else
- out="output"
-fi
-cwd=`pwd`
+TestName="fixed-block-size-tape"
+JobName=fixedblocksize
+. scripts/functions
+set_debug 0
+
scripts/copy-tape-confs
scripts/cleanup-tape
echo "${cwd}/build" >/tmp/file-list
fi
rm -f ${cwd}/tmp/1 ${cwd}/tmp/2
-echo " "
-echo " "
-echo " === Starting Fixed Block Size test at `date +%R:%S` ==="
-echo " === Starting Fixed Block Size test at `date +%R:%S` ===" >>working/log
-echo " "
+change_jobname $JobName
+start_test
+
cat <<END_OF_DATA >tmp/bconcmds
@$out /dev/null
@$out
quit
END_OF_DATA
-if test "$debug" -eq 1 ; then
- bin/bacula start
- cat tmp/bconcmds | bin/bconsole -c bin/bconsole.conf
-else
- bin/bacula start 2>&1 >/dev/null
- cat tmp/bconcmds | bin/bconsole -c bin/bconsole.conf 2>&1 >/dev/null
-fi
-scripts/check_for_zombie_jobs storage=DDS-4
-bin/bacula stop 2>&1 >/dev/null
-grep "^ Termination: *Backup OK" tmp/log1.out 2>&1 >/dev/null
-bstat=$?
-grep "^ Termination: *Restore OK" tmp/log2.out 2>&1 >/dev/null
-rstat=$?
-diff -r build tmp/bacula-restores${cwd}/build 2>&1 >/dev/null
-if [ $? != 0 -o $bstat != 0 -o $rstat != 0 ] ; then
- echo " "
- echo " "
- echo " !!!!! Fixed Block Size test Bacula source failed!!! !!!!! "
- echo " !!!!! Fixed Block Size test failed!!! !!!!! " >>test.out
- echo " "
-else
- echo " ===== Fixed Block Size test Bacula source OK ===== "
- echo " ===== Fixed Block Size test OK ===== " >>test.out
-# scripts/cleanup
-fi
+run_bacula
+check_for_zombie_jobs storage=DDS-4
+stop_bacula
+
+check_two_logs
+check_restore_diff
+end_test
#
# Run two jobs at the same time
#
-debug=0
-if test "$debug" -eq 1 ; then
- out="tee"
-else
- out="output"
-fi
+TestName="auto-label-test"
+JobName=AutoLabel
+. scripts/functions
+set_debug 0
-cwd=`pwd`
scripts/copy-tape-confs
scripts/cleanup-tape
echo "${cwd}/build" >/tmp/file-list
-echo " "
-echo " "
-echo " === Starting four-concurrent-jobs-tape at `date +%R:%S` ==="
-echo " === Starting four-concurrent-jobs-tape at `date +%R:%S` ===" >>working/log
-echo " "
+change_jobname $JobName
+start_test
cat <<END_OF_DATA >tmp/bconcmds
@output /dev/null
messages
@$out tmp/log1.out
label storage=DDS-4 volume=TestVolume001 slot=0 pool=Default
-run job=NightlySave level=Full Storage=DDS-4 yes
-run job=NightlySave level=Full Storage=DDS-4 yes
-run job=NightlySave level=Full Storage=DDS-4 yes
-run job=NightlySave level=Full Storage=DDS-4 yes
+run job=$JobName level=Full Storage=DDS-4 yes
+run job=$JobName level=Full Storage=DDS-4 yes
+run job=$JobName level=Full Storage=DDS-4 yes
+run job=$JobName level=Full Storage=DDS-4 yes
@sleep 2
status dir
@sleep 5
@$out
quit
END_OF_DATA
-if test "$debug" -eq 1 ; then
- bin/bacula start
- cat tmp/bconcmds | bin/bconsole -c bin/bconsole.conf
-else
- bin/bacula start 2>&1 >/dev/null
- cat tmp/bconcmds | bin/bconsole -c bin/bconsole.conf 2>&1 >/dev/null
-fi
-scripts/check_for_zombie_jobs storage=DDS-4
-bin/bacula stop 2>&1 >/dev/null
-grep "^ Termination: *Backup OK" tmp/log1.out 2>&1 >/dev/null
-bstat=$?
-grep "^ Termination: *Restore OK" tmp/log2.out 2>&1 >/dev/null
-rstat=$?
-diff -r build tmp/bacula-restores${cwd}/build 2>&1 >/dev/null
-if [ $? != 0 -o $bstat != 0 -o $rstat != 0 ] ; then
- echo " "
- echo " "
- echo " !!!!! four-concurrent-jobs-tape Bacula source failed!!! !!!!! "
- echo " !!!!! four-concurrent-jobs-tape failed!!! !!!!! " >>test.out
- echo " "
- exit 1
-else
- echo " ===== four-concurrent-jobs-tape Bacula source OK ===== "
- echo " ===== four-concurrent-jobs-tape OK ===== " >>test.out
- scripts/cleanup
- exit 0
-fi
+run_bacula
+check_for_zombie_jobs storage=DDS-4
+stop_bacula
+
+check_two_logs
+check_restore_diff
+end_test
#
# Run two jobs at the same time
#
-cwd=`pwd`
+TestName="four-concurrent-jobs-test"
+JobName=Four-concurrent-jobs
+. scripts/functions
+set_debug 0
+
scripts/copy-test-confs
scripts/cleanup
echo "${cwd}/build" >/tmp/file-list
-echo " "
-echo " "
-echo " === Starting four-concurrent-jobs-test at `date +%R:%S` ==="
-echo " === Starting four-concurrent-jobs-test at `date +%R:%S` ===" >>working/log
-echo " "
+change_jobname $JobName
+
+start_test
-bin/bacula start 2>&1 >/dev/null
-bin/bconsole -c bin/bconsole.conf <<END_OF_DATA 2>&1 >/dev/null
+cat <<END_OF_DATA >tmp/bconcmds
@output /dev/null
messages
-@output tmp/log1.out
+@$out tmp/log1.out
label storage=File1
TestVolume001
label storage=File1
update Volume=TestVolume001 MaxVolBytes=100000000
@#50000000
@#12
-run job=NightlySave level=Full Storage=File1
+run job=$JobName level=Full Storage=File1
yes
reload
-run job=NightlySave level=Full Storage=File1
+run job=$JobName level=Full Storage=File1
yes
reload
-run job=NightlySave level=Full Storage=File1
+run job=$JobName level=Full Storage=File1
yes
reload
-run job=NightlySave level=Full Storage=File1
+run job=$JobName level=Full Storage=File1
yes
reload
reload
@#
@# 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 " !!!!! four-concurrent-jobs-test Bacula source failed!!! !!!!! "
- echo " !!!!! four-concurrent-jobs-test failed!!! !!!!! " >>test.out
- if [ $bstat != 0 -o $rstat != 0 ] ; then
- echo " !!!!! Bad Job termination status !!!!! "
- echo " !!!!! Bad Job termination status !!!!! " >>test.out
- else
- echo " !!!!! Restored files differ !!!!! "
- echo " !!!!! Restored files differ !!!!! " >>test.out
- fi
- echo " "
- exit 1
-else
- echo " ===== four-concurrent-jobs-test Bacula source OK `date +%R:%S` ===== "
- echo " ===== four-concurrent-jobs-test OK `date +%R:%S` ===== " >>test.out
- scripts/cleanup
- exit 0
-fi
+run_bacula
+check_for_zombie_jobs storage=File1
+stop_bacula
+
+check_two_logs
+check_restore_diff
+end_test
# then backup four times, each with incremental then finally restore.
# It should require at least 4 different bsrs.
#
-debug=0
-if test "$debug" -eq 1 ; then
- out="tee"
-else
- out="output"
-fi
-cwd=`pwd`
+TestName="four-jobs-tape"
+JobName=fourjobstape
+. scripts/functions
+set_debug 0
+
scripts/copy-tape-confs
scripts/cleanup-tape
echo "${cwd}/build" >/tmp/file-list
-echo " "
-echo " "
-echo " === Starting four-jobs-tape at `date +%R:%S` ==="
-echo " === Starting four-jobs-tape at `date +%R:%S` ===" >>working/log
-echo " "
+change_jobname $JobName
+start_test
cat <<END_OF_DATA >tmp/bconcmds
@$out /dev/null
-estimate job=NightlySave listing
-estimate job=NightlySave listing
-estimate job=NightlySave listing
+estimate job=$JobName listing
+estimate job=$JobName listing
+estimate job=$JobName listing
messages
@$out tmp/log1.out
label storage=DDS-4 volume=TestVolume001 slot=0 pool=Default
-run job=NightlySave yes
+run job=$JobName yes
wait
messages
quit
@$out /dev/null
messages
@$out tmp/log1.out
-run job=NightlySave level=Incremental yes
+run job=$JobName level=Incremental yes
wait
messages
quit
@$out /dev/null
messages
@$out tmp/log1.out
-run job=NightlySave level=Incremental yes
+run job=$JobName level=Incremental yes
wait
messages
quit
@$out /dev/null
messages
@$out tmp/log1.out
-run job=NightlySave level=Incremental yes
+run job=$JobName level=Incremental yes
wait
messages
quit
@$out
quit
END_OF_DATA
-if test "$debug" -eq 1 ; then
- bin/bacula start
- cat tmp/bconcmds | bin/bconsole -c bin/bconsole.conf
-else
- bin/bacula start 2>&1 >/dev/null
- cat tmp/bconcmds | bin/bconsole -c bin/bconsole.conf 2>&1 >/dev/null
-fi
-bin/bacula stop 2>&1 >/dev/null
-grep "^ Termination: *Backup OK" tmp/log1.out 2>&1 >/dev/null
-bstat=$?
-grep "^ Termination: *Restore OK" tmp/log2.out 2>&1 >/dev/null
-rstat=$?
-diff -r build tmp/bacula-restores${cwd}/build 2>&1 >/dev/null
-if [ $? != 0 -o $bstat != 0 -o $rstat != 0 ] ; then
- echo " "
- echo " "
- echo " !!!!! four-jobs-tape Bacula source failed!!! !!!!! "
- echo " !!!!! four-jobs-tape failed!!! !!!!! " >>test.out
- echo " "
-else
- echo " ===== four-jobs-tape Bacula source OK ===== "
- echo " ===== four-jobs-tape OK ===== " >>test.out
- scripts/cleanup
-fi
+run_bacula
+check_for_zombie_jobs storage=DDS-4
+stop_bacula
+
+check_two_logs
+check_restore_diff
+end_test
#
# This script uses the virtual disk autochanger
#
+TestName="incremental-2disk-test"
+JobName=Inc2disk
+. scripts/functions
+set_debug 0
+
. config.out
if test x${AUTOCHANGER} = x/dev/null ; then
echo "incremental-2disk test skipped. No autochanger."
exit
fi
-debug=0
-if test "$debug" -eq 1 ; then
- out="tee"
-else
- out="output"
-fi
-cwd=`pwd`
-bin/bacula stop 2>&1 >/dev/null
+stop_bacula
cd bin
./drop_bacula_tables >/dev/null 2>&1
./make_bacula_tables >/dev/null 2>&1
echo "${cwd}/tmp/build/ficheriro2.txt" >>restore-list
cd ${cwd}
-echo " "
-echo " "
-echo " === Starting incremental-2disk test ==="
-echo " === Starting incremental-2disk test ===" >>working/log
-echo " "
+change_jobname $JobName
+start_test
# Write out bconsole commands
cat <<END_OF_DATA >tmp/bconcmds
@$out tmp/log1.out
label storage=DDS-4 volume=TestVolume001 slot=1 Pool=Default drive=0
label storage=DDS-4 volume=TestVolume002 slot=2 Pool=Default drive=0
-run job=NightlySave yes
+run job=$JobName yes
wait
messages
quit
END_OF_DATA
-if test "$debug" -eq 1 ; then
- bin/bacula start
- cat tmp/bconcmds | bin/bconsole -c bin/bconsole.conf
-else
- bin/bacula start 2>&1 >/dev/null
- cat tmp/bconcmds | bin/bconsole -c bin/bconsole.conf 2>&1 >/dev/null
-fi
+run_bacula
+
echo "ficheriro1.txt" >${cwd}/tmp/build/ficheriro1.txt
echo "ficheriro2.txt" >${cwd}/tmp/build/ficheriro2.txt
-bin/bconsole -c bin/bconsole.conf <<END_OF_DATA
+
+
+cat <<END_OF_DATA >tmp/bconcmds
@$out /dev/null
messages
@$out tmp/log1.out
@# Force Incremental on the second Volume
update volume=TestVolume001 VolStatus=Used
-run level=Incremental job=NightlySave yes
+run level=Incremental job=$JobName yes
wait
messages
@#
@$out
quit
END_OF_DATA
-bin/bacula stop 2>&1 >/dev/null
-grep "^ Termination: *Backup OK" tmp/log1.out 2>&1 >/dev/null
-bstat=$?
-grep "^ Termination: *Restore OK" tmp/log2.out 2>&1 >/dev/null
-rstat=$?
+
+run_bconsole
+
+check_for_zombie_jobs storage=File
+stop_bacula
#
# Delete .c files because we will only restored the txt files
#
rm -f tmp/build/*.c
-diff -r tmp/build tmp/bacula-restores${cwd}/tmp/build 2>&1 >/dev/null
-if [ $? != 0 -o $bstat != 0 -o $rstat != 0 ] ; then
- echo " "
- echo " "
- echo " !!!!! incremental-2disk test Bacula source failed!!! !!!!! "
- echo " !!!!! incremental-2disk test failed!!! !!!!! " >>test.out
- echo " "
-else
- echo " ===== incremental-2disk test Bacula source OK ===== "
- echo " ===== incremental-2disk test OK ===== " >>test.out
- scripts/cleanup
-fi
+
+check_two_logs
+check_restore_tmp_build_diff
+end_test
# Run a simple backup of the Bacula build directory then create some
# new files, do an Incremental and restore those two files.
#
-cwd=`pwd`
+TestName="incremental-tape"
+JobName=IncTape
+. scripts/functions
+set_debug 0
scripts/copy-tape-confs
scripts/cleanup-tape
echo "${cwd}/tmp/build/ficheriro2.txt" >>restore-list
cd ${cwd}
-echo " "
-echo " "
-echo " === Starting incremental-tape test at `date +%R:%S` ==="
-echo " === Starting incremental-tape test at `date +%R:%S` ===" >>working/log
-echo " "
+change_jobname $JobName
+start_test
-bin/bacula start 2>&1 >/dev/null
-bin/bconsole -c bin/bconsole.conf <<END_OF_DATA 2>&1 >/dev/null
+cat <<END_OF_DATA >tmp/bconcmds
@output /dev/null
messages
-@output tmp/log1.out
+@$out tmp/log1.out
label storage=DDS-4 volume=TestVolume001 slot=0 pool=Default
-run job=NightlySave yes
+run job=$JobName yes
wait
messages
quit
END_OF_DATA
+
scripts/check_for_zombie_jobs storage=DDS-4
+
echo "ficheriro1.txt" >${cwd}/tmp/build/ficheriro1.txt
echo "ficheriro2.txt" >${cwd}/tmp/build/ficheriro2.txt
-bin/bconsole -c bin/bconsole.conf <<END_OF_DATA 2>&1 >/dev/null
+
+cat <<END_OF_DATA >tmp/bconcmds
@output /dev/null
messages
-@output tmp/log1.out
-run level=Incremental job=NightlySave yes
+@$out tmp/log1.out
+run level=Incremental job=$JobName yes
wait
messages
@#
@# now do a restore
@#
-@output tmp/log2.out
+@$out tmp/log2.out
restore where=${cwd}/tmp/bacula-restores storage=DDS-4
7
<${cwd}/tmp/restore-list
@output
quit
END_OF_DATA
-scripts/check_for_zombie_jobs storage=DDS-4
-bin/bacula stop 2>&1 >/dev/null
-grep "^ Termination: *Backup OK" tmp/log1.out 2>&1 >/dev/null
-bstat=$?
-grep "^ Termination: *Restore OK" tmp/log2.out 2>&1 >/dev/null
-rstat=$?
+
+run_bacula
+check_for_zombie_jobs storage=DDS-4
+stop_bacula
+
#
# Delete .c files because we will only restored the txt files
#
rm -f tmp/build/*.c
-diff -r tmp/build tmp/bacula-restores${cwd}/tmp/build 2>&1 >/dev/null
-if [ $? != 0 -o $bstat != 0 -o $rstat != 0 ] ; then
- echo " "
- echo " "
- echo " !!!!! incremental-tape test Bacula source failed!!! !!!!! "
- echo " !!!!! incremental-tape test failed!!! !!!!! " >>test.out
- echo " "
-else
- echo " ===== incremental-tape test Bacula source OK ===== "
- echo " ===== incremental-tape test OK ===== " >>test.out
- scripts/cleanup
-fi
+
+check_two_logs
+check_restore_tmp_build_diff
+end_test
# then backup four times, each with incremental then finally restore.
# It should require at least 4 different bsrs.
#
-debug=0
-if test "$debug" -eq 1 ; then
- out="tee"
-else
- out="output"
-fi
+TestName="relabel-tape"
+JobName=Relabeltape
+. scripts/functions
+set_debug 0
-cwd=`pwd`
scripts/copy-tape-confs
scripts/cleanup-tape
echo "${cwd}/build" >/tmp/file-list
-echo " "
-echo " "
-echo " === Starting relabel-tape at `date +%R:%S` ==="
-echo " === Starting relabel-tape at `date +%R:%S` ===" >>working/log
-echo " "
+change_jobname $JobName
+start_test
cat <<END_OF_DATA >tmp/bconcmds
@output /dev/null
messages
@$out tmp/log1.out
label storage=DDS-4 volume=TestVolume001 slot=0 pool=Default
-run job=NightlySave level=Full yes
+run job=$JobName level=Full yes
wait
messages
add pool=Default
mount
messages
wait
-run job=NightlySave level=Full yes
+run job=$JobName level=Full yes
wait
messages
@$out
quit
END_OF_DATA
-if test "$debug" -eq 1 ; then
- bin/bacula start
- cat tmp/bconcmds | bin/bconsole -c bin/bconsole.conf
-else
- bin/bacula start 2>&1 >/dev/null
- cat tmp/bconcmds | bin/bconsole -c bin/bconsole.conf 2>&1 >/dev/null
-fi
+run_bacula
+check_for_zombie_jobs storage=DDS-4
+
echo "Backup done"
#
quit
END_OF_DATA
-if test "$debug" -eq 1 ; then
- cat tmp/bconcmds | bin/bconsole -c bin/bconsole.conf
-else
- cat tmp/bconcmds | bin/bconsole -c bin/bconsole.conf 2>&1 >/dev/null
-fi
+run_bconsole
+
+check_for_zombie_jobs storage=DDS-4
+stop_bacula
-scripts/check_for_zombie_jobs storage=DDS-4
-bin/bacula stop 2>&1 >/dev/null
-grep "^ Termination: *Backup OK" tmp/log1.out 2>&1 >/dev/null
-bstat=$?
-grep "^ Termination: *Restore OK" tmp/log2.out 2>&1 >/dev/null
-rstat=$?
-diff -r build tmp/bacula-restores${cwd}/build 2>&1 >/dev/null
-dstat=$?
-if [ $dstat != 0 -o $bstat != 0 -o $rstat != 0 ] ; then
- echo " "
- echo " "
- echo " !!!!! relabel-tape Bacula source failed!!! !!!!! "
- echo " !!!!! relabel-tape failed!!! !!!!! " >>test.out
- echo "diff=$dstat backup=$bstat restore=$rstat"
- echo " "
-else
- echo " ===== relabel-tape Bacula source OK ===== "
- echo " ===== relabel-tape OK ===== " >>test.out
- scripts/cleanup
-fi
+check_two_logs
+check_restore_diff
+end_test
# file size to 1M, it runs very slow. There are about 64 files that
# are created during each of the two backups.
#
-cwd=`pwd`
+TestName="restore-by-file-tape"
+JobName=restorebyfile
+. scripts/functions
+set_debug 0
+
scripts/copy-tape-confs
scripts/cleanup-tape
echo "${cwd}/build" >/tmp/file-list
cp ${cwd}/bin/bacula-sd.conf ${cwd}/tmp/1
sed "s%# Maximum File Size% Maximum File Size%" ${cwd}/tmp/1 >${cwd}/bin/bacula-sd.conf
-echo " "
-echo " "
-echo " === Starting restore-by-file-tape test at `date +%R:%S` ==="
-echo " === Starting restore-by-file-tape test at `date +%R:%S` ===" >>working/log
-echo " "
+change_jobname $JobName
+start_test
-bin/bacula start 2>&1 >/dev/null
-bin/bconsole -c bin/bconsole.conf <<END_OF_DATA 2>&1 >/dev/null
+cat <<END_OF_DATA >tmp/bconcmds
@output /dev/null
messages
-@output tmp/log1.out
+@$out tmp/log1.out
label storage=DDS-4 volume=TestVolume001 slot=0 pool=Default
-run job=NightlySave level=Full yes
+run job=$JobName level=Full yes
wait
messages
@#
@# now do a restore
@#
-@output tmp/log2.out
+@$out tmp/log2.out
restore where=${cwd}/tmp/bacula-restores storage=DDS-4 file=<${cwd}/tmp/restore2-list
yes
wait
@output
quit
END_OF_DATA
+
+run_bacula
+check_for_zombie_jobs storage=DDS-4
+stop_bacula
+
+check_two_logs
+
dstat=0
-scripts/check_for_zombie_jobs storage=DDS-4
#
# We need to stop and start Bacula to
# test appending to a previously written tape
#
-bin/bacula stop 2>&1 >/dev/null
-bin/bacula start 2>&1 >/dev/null
for i in `cat ${cwd}/tmp/restore2-list`; do
diff $i ${cwd}/tmp/bacula-restores$i
if [ $? != 0 ] ; then
dstat=1
fi
done
-grep "^ Termination: *Backup OK" tmp/log1.out 2>&1 >/dev/null
-bstat=$?
-grep "^ Termination: *Restore OK" tmp/log2.out 2>&1 >/dev/null
-rstat=$?
-if [ $dstat != 0 -o $bstat != 0 -o $rstat != 0 ] ; then
- echo " "
- echo " "
- echo " !!!!! restore-by-file-tape test Bacula source failed!!! !!!!! "
- echo " !!!!! restore-by-file-tape test failed!!! !!!!! " >>test.out
- echo " "
- bin/bacula stop 2>&1 >/dev/null
- exit 1
-else
- echo " First of two restores OK "
-fi
-rm -rf ${cwd}/tmp/bacula-restores
-#
-# Now do a second backup and restore
-#
-bin/bconsole -c bin/bconsole.conf <<END_OF_DATA 2>&1 >/dev/null
+
+end_test
+
+cat <<END_OF_DATA >tmp/bconcmds
@output /dev/null
messages
-@output tmp/log1.out
-run job=NightlySave level=Full yes
+@$out tmp/log1.out
+run job=$JobName level=Full yes
wait
messages
@#
@# now do a restore
@#
-@output tmp/log2.out
+@$out tmp/log2.out
restore where=${cwd}/tmp/bacula-restores
7
<${cwd}/tmp/restore2-list
@output
quit
END_OF_DATA
+
+#
+# Bacula was stopped, but we must restart it to
+# test appending to a previously written tape
+#
+run_bacula
+check_for_zombie_jobs storage=DDS-4
+stop_bacula
+
+check_two_logs
+
scripts/check_for_zombie_jobs storage=DDS-4
bin/bacula stop 2>&1 >/dev/null
for i in `cat ${cwd}/tmp/restore2-list`; do
dstat=1
fi
done
-grep "^ Termination: *Backup OK" tmp/log1.out 2>&1 >/dev/null
-bstat=$?
-grep "^ Termination: *Restore OK" tmp/log2.out 2>&1 >/dev/null
-rstat=$?
-if [ $dstat != 0 -o $bstat != 0 -o $rstat != 0 ] ; then
- echo " "
- echo " "
- echo " !!!!! restore-by-file-tape test Bacula source failed!!! !!!!! "
- echo " !!!!! restore-by-file-tape test failed!!! !!!!! " >>test.out
- echo " "
-else
- echo " ===== restore-by-file-tape test Bacula source OK ===== "
- echo " ===== restore-by-file-tape test OK ===== " >>test.out
-# scripts/cleanup
-fi
+end_test
# Run a simple backup of the Bacula build directory
# to a tape where the maximum tape file size is set to 1M
#
-cwd=`pwd`
+TestName="small-file-size-tape"
+JobName=smallfilesize
+. scripts/functions
+set_debug 0
+
scripts/copy-tape-confs
scripts/cleanup-tape
cp ${cwd}/bin/bacula-sd.conf ${cwd}/tmp/1
sed "s%# Maximum File Size% Maximum File Size%" ${cwd}/tmp/1 >${cwd}/bin/bacula-sd.conf
-echo " "
-echo " "
-echo " === Starting Small File Size test at `date +%R:%S` ==="
-echo " === Starting Small File Size test at `date +%R:%S` ===" >>working/log
-echo " "
+change_jobname $JobName
+start_test
-bin/bacula start 2>&1 >/dev/null
-bin/bconsole -c bin/bconsole.conf <<END_OF_DATA 2>&1 >/dev/null
+cat <<END_OF_DATA >tmp/bconcmds
@output /dev/null
messages
-@output tmp/log1.out
+@$out t tmp/log1.out
label storage=DDS-4 volume=TestVolume001 slot=0 pool=Default
setdebug level=2 storage=DDS-4
-run job=NightlySave yes
+run job=$JobName yes
wait
messages
@#
@# now do a restore
@#
-@output tmp/log2.out
+@$out tmp/log2.out
restore where=${cwd}/tmp/bacula-restores select storage=DDS-4
unmark *
mark *
@output
quit
END_OF_DATA
-scripts/check_for_zombie_jobs storage=DDS-4
-bin/bacula stop 2>&1 >/dev/null
-grep "^ Termination: *Backup OK" tmp/log1.out 2>&1 >/dev/null
-bstat=$?
-grep "^ Termination: *Restore OK" tmp/log2.out 2>&1 >/dev/null
-rstat=$?
-diff -r build tmp/bacula-restores${cwd}/build 2>&1 >/dev/null
-if [ $? != 0 -o $bstat != 0 -o $rstat != 0 ] ; then
- echo " "
- echo " "
- echo " !!!!! Small File Size test Bacula source failed!!! !!!!! "
- echo " !!!!! Small File Size test failed!!! !!!!! " >>test.out
- echo " "
-else
- echo " ===== Small File Size test Bacula source OK ===== "
- echo " ===== Small File Size test OK ===== " >>test.out
-# scripts/cleanup
-fi
+
+run_bacula
+check_for_zombie_jobs storage=DDS-4
+stop_bacula
+
+check_two_logs
+check_restore_diff
+end_test
#
# Test for a tape truncation bug.
#
-cwd=`pwd`
+TestName="truncate-bug-tape"
+JobName=truncatebug
+. scripts/functions
+set_debug 0
scripts/copy-tape-confs
scripts/cleanup-tape
echo "${cwd}/build" >/tmp/file-list
-echo " "
-echo " "
-echo " === Starting truncate-bug-tape test at `date +%R:%S` ==="
-echo " === Starting truncate-bug-tape test at `date +%R:%S` ===" >>working/log
-echo " "
+change_jobname $JobName
+start_test
-bin/bacula start 2>&1 >/dev/null
-bin/bconsole -c bin/bconsole.conf <<END_OF_DATA 2>&1 >/dev/null
+cat <<END_OF_DATA >tmp/bconcmds
@output /dev/null
messages
-@output tmp/log1.out
+@$out tmp/log1.out
label storage=DDS-4 volume=TestVolume001 slot=0 pool=Default
@# do a bunch of saves so we have 12 files on the tape
run job=NightlySave yes
-run level=Full job=NightlySave yes
-run level=Full job=NightlySave yes
-run level=Full job=NightlySave yes
-run level=Full job=NightlySave yes
-run level=Full job=NightlySave yes
-run level=Full job=NightlySave yes
-run level=Full job=NightlySave yes
-run level=Full job=NightlySave yes
-run level=Full job=NightlySave yes
-run level=Full job=NightlySave yes
-run level=Full job=NightlySave yes
+run level=Full job=$JobName yes
+run level=Full job=$JobName yes
+run level=Full job=$JobName yes
+run level=Full job=$JobName yes
+run level=Full job=$JobName yes
+run level=Full job=$JobName yes
+run level=Full job=$JobName yes
+run level=Full job=$JobName yes
+run level=Full job=$JobName yes
+run level=Full job=$JobName yes
+run level=Full job=$JobName yes
wait
messages
quit
END_OF_DATA
+
+run_bacula
scripts/check_for_zombie_jobs storage=DDS-4
-bin/bconsole -c bin/bconsole.conf <<END_OF_DATA 2>&1 >/dev/null
+
+cat <<END_OF_DATA >tmp/bconcmds
@output /dev/null
messages
-@output tmp/log1.out
+@$out tmp/log1.out
@#
@# now do a restore
@#
@output
quit
END_OF_DATA
+
+run_bconsole
scripts/check_for_zombie_jobs storage=DDS-4
-bin/bconsole -c bin/bconsole.conf <<END_OF_DATA 2>&1 >/dev/null
+
+cat <<END_OF_DATA >tmp/bconcmds
@output /dev/null
messages
-@output tmp/log2.out
-run level=Full job=NightlySave yes
+@$out tmp/log2.out
+run level=Full job=$JobName yes
wait
messages
quit
END_OF_DATA
bin/bacula stop 2>&1 >/dev/null
-grep "^ Termination: *Backup OK" tmp/log1.out 2>&1 >/dev/null
-bstat=$?
-grep "^ Termination: *Backup OK" tmp/log2.out 2>&1 >/dev/null
-rstat=$?
-if [ $bstat != 0 -o $rstat != 0 ] ; then
- echo " "
- echo " "
- echo " !!!!! truncate-bug-tape test Bacula source failed!!! !!!!! "
- echo " !!!!! truncate-bug-tape test failed!!! !!!!! " >>test.out
- echo " "
-else
- echo " ===== truncate-bug-tape test Bacula source OK ===== "
- echo " ===== truncate-bug-tape test OK ===== " >>test.out
- scripts/cleanup
-fi
+
+run_bconsole
+check_for_zombie_jobs storage=DDS-4
+stop_bacula
+
+check_two_logs
+# no diff made
+dstat=0
+end_test
+
# is in /tmp/file-list, which is by default the Bacula
# source code (i.e. the build directory).
#
+TestName="two-pool-tape"
+JobName=twopooltape
+. scripts/functions
+set_debug 0
+
. config.out
if test x${AUTOCHANGER} = x/dev/null ; then
echo "two-pool-tape test skipped. No autochanger."
exit
fi
-debug=0
-if test "$debug" -eq 1 ; then
- out="tee"
-else
- out="output"
-fi
-cwd=`pwd`
+
scripts/cleanup
scripts/copy-2tape-confs
scripts/prepare-two-tapes
echo "${cwd}/build" >>/tmp/file-list
echo "${cwd}/build" >>/tmp/file-list
-echo " "
-echo " "
-echo " === Starting Two Pool Tape test at `date +%R:%S` ==="
-echo " === Starting Two Pool Tape test at `date +%R:%S` ===" >>working/log
-echo " "
+start_test
+
# Write out bconsole commands to a file
cat <<END_OF_DATA >tmp/bconcmds
@output /dev/null
quit
END_OF_DATA
-# start Bacula and run bconsole commands
-if test "$debug" -eq 1 ; then
- bin/bacula start
- cat tmp/bconcmds | bin/bconsole -c bin/bconsole.conf
-else
- bin/bacula start 2>&1 >/dev/null
- cat tmp/bconcmds | bin/bconsole -c bin/bconsole.conf 2>&1 >/dev/null
-fi
-# Make sure no jobs are still running (debug check)
-scripts/check_for_zombie_jobs storage=DDS-4
+run_bacula
+check_for_zombie_jobs storage=DDS-4
+stop_bacula
+
+check_two_logs
+check_restore_diff
+end_test
-# stop Bacula
-bin/bacula stop 2>&1 >/dev/null
-# Check if backup done correctly
-grep "^ Termination: *Backup OK" tmp/log1.out 2>&1 >/dev/null
-bstat=$?
-grep "^ Termination: *Restore OK" tmp/log2.out 2>&1 >/dev/null
-rstat=$?
-diff -r build tmp/bacula-restores${cwd}/build 2>&1 >/dev/null
-if [ $? != 0 -o $bstat != 0 -o $rstat != 0 ] ; then
- echo " "
- echo " "
- echo " !!!!! Two Pool Tape test Bacula source failed!!! !!!!! "
- echo " !!!!! Two Pool Tape test failed!!! !!!!! " >>test.out
- echo " "
-else
- echo " ===== Two Pool Tape test Bacula source OK ===== "
- echo " ===== Two Pool Tape test OK ===== " >>test.out
-# scripts/cleanup
-fi
# Note, this test simulates the tape filling and writing to
# the next tape.
#
+TestName="two-volume-tape"
+JobName=twovoltape
+. scripts/functions
+set_debug 0
+
+
. config.out
if test x${AUTOCHANGER} = x/dev/null ; then
echo "two-volume-tape test skipped. No autochanger."
exit
fi
-debug=0
-if test "$debug" -eq 1 ; then
- out="tee"
-else
- out="output"
-fi
-cwd=`pwd`
+
scripts/cleanup
scripts/copy-2tape-confs
scripts/prepare-two-tapes
cp ${cwd}/bin/bacula-sd.conf ${cwd}/tmp/1
sed -f ${outf} ${cwd}/tmp/1 >${cwd}/bin/bacula-sd.conf
-echo " "
-echo " "
-echo " === Starting Two Volume Tape test at `date +%R:%S` ==="
-echo " === Starting Two Volume Tape test at `date +%R:%S` ===" >>working/log
-echo " "
+change_jobname $JobName
+start_test
+
# Write out bconsole commands
cat <<END_OF_DATA >tmp/bconcmds
@$out /dev/null
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 Tape test Bacula source failed!!! !!!!! "
- echo " !!!!! Two Volume Tape test failed!!! !!!!! " >>test.out
- echo " "
-else
- echo " ===== Two Volume Tape test Bacula source OK ===== "
- echo " ===== Two Volume Tape test OK ===== " >>test.out
-# scripts/cleanup
-fi
+check_two_logs
+check_restore_diff
+end_test
# to a tape then restore it, we do that twice to ensure that
# we can correctly append to a tape.
#
-debug=1
-if test "$debug" -eq 1 ; then
- out="tee"
-else
- out="output"
-fi
+TestName="win32-backup-tape"
+JobName=win32tape
+. scripts/functions
+set_debug 0
-cwd=`pwd`
scripts/copy-win32-confs
scripts/cleanup-tape
echo "${cwd}/build" >/tmp/file-list
-echo " "
-echo " "
-echo " === Starting Win32 Backup tape test at `date +%R:%S` ==="
-echo " === Starting Win32 Backup tape test at `date +%R:%S` ===" >>working/log
-echo " "
+change_jobname $JobName
+start_test
cat <<END_OF_DATA >tmp/bconcmds
@output /dev/null
messages
@$out tmp/log1.out
label storage=DDS-4 volume=TestVolume001 slot=0 pool=Default drive=0
-run job=NightlySave yes
+run job=$JobName yes
@sleep 10
status storage=DDS-4
@sleep 30
wait
messages
END_OF_DATA
-if test "$debug" -eq 1 ; then
- bin/bacula start
- cat tmp/bconcmds | bin/bconsole -c bin/bconsole.conf
-else
- bin/bacula start 2>&1 >/dev/null
- cat tmp/bconcmds | bin/bconsole -c bin/bconsole.conf 2>&1 >/dev/null
-fi
-scripts/check_for_zombie_jobs storage=DDS-4
+run_bacula
+check_for_zombie_jobs storage=DDS-4
+stop_bacula
-bin/bacula stop 2>&1 >/dev/null
-grep "^ Termination: *Backup OK" tmp/log1.out 2>&1 >/dev/null
-bstat=$?
-grep "^ Termination: *Restore OK" tmp/log2.out 2>&1 >/dev/null
-rstat=$?
-if [ $bstat != 0 -o $rstat != 0 ] ; then
- echo " "
- echo " "
- echo " !!!!! Win32 Backup tape test failed!!! !!!!! "
- echo " !!!!! Win32 Backup tape test failed!!! !!!!! " >>test.out
- echo " "
-else
- echo " ===== Win32 Backup tape test OK ===== "
- echo " ===== Win32 Backup tape test OK ===== " >>test.out
- scripts/cleanup
-fi
+check_two_logs
+# no diff for now
+dstat=0
+end_test
# to a tape then restore it, we do that twice to ensure that
# we can correctly append to a tape.
#
-debug=1
-if test "$debug" -eq 1 ; then
- out="tee"
-else
- out="output"
-fi
+TestName="win32-to-linux-tape"
+JobName=AutoLabel
+. scripts/functions
+set_debug 0
-cwd=`pwd`
scripts/copy-win32-confs
scripts/cleanup-tape
echo "${cwd}/build" >/tmp/file-list
-echo " "
-echo " "
-echo " === Starting Win32 Backup tape test at `date +%R:%S` ==="
-echo " === Starting Win32 Backup tape test at `date +%R:%S` ===" >>working/log
-echo " "
+change_job $JobName
+start_test
cat <<END_OF_DATA >tmp/bconcmds
@output /dev/null
wait
messages
END_OF_DATA
-if test "$debug" -eq 1 ; then
- bin/bacula start
- cat tmp/bconcmds | bin/bconsole -c bin/bconsole.conf
-else
- bin/bacula start 2>&1 >/dev/null
- cat tmp/bconcmds | bin/bconsole -c bin/bconsole.conf 2>&1 >/dev/null
-fi
-scripts/check_for_zombie_jobs storage=DDS-4
+run_bacula
+check_for_zombie_jobs storage=DDS-4
+stop_bacula
-bin/bacula stop 2>&1 >/dev/null
-grep "^ Termination: *Backup OK" tmp/log1.out 2>&1 >/dev/null
-bstat=$?
-grep "^ Termination: *Restore OK" tmp/log2.out 2>&1 >/dev/null
-rstat=$?
-if [ $bstat != 0 -o $rstat != 0 ] ; then
- echo " "
- echo " "
- echo " !!!!! Win32 Backup tape test failed!!! !!!!! "
- echo " !!!!! Win32 Backup tape test failed!!! !!!!! " >>test.out
- echo " "
-else
- echo " ===== Win32 Backup tape test OK ===== "
- echo " ===== Win32 Backup tape test OK ===== " >>test.out
-# scripts/cleanup
-fi
+check_two_logs
+# No diff for the moment
+dstat=0
+end_test