#!/bin/sh
#
# Run a simple backup of the Bacula build directory then create some
-# new files, do a Decremental and restore those two files.
+# new files, do a differential and restore those two files.
#
+debug=0
+if test "$debug" -eq 1 ; then
+ out="tee"
+else
+ out="output"
+fi
+
cwd=`pwd`
scripts/copy-test-confs
scripts/cleanup
echo " "
echo " "
-echo " === Starting decremental-test at `date +%R:%S` ==="
-echo " === Starting decremental-test at `date +%R:%S` ===" >>working/log
+echo " === Starting differential-test at `date +%R:%S` ==="
+echo " === Starting differential-test at `date +%R:%S` ===" >>working/log
echo " "
-bin/bacula start 2>&1 >/dev/null
-bin/bconsole -c bin/bconsole.conf <<END_OF_DATA 2>&1 >/dev/null
-@output /dev/null
+cat <<END_OF_DATA >tmp/bconcmds
+@$out /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
+
+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
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
-@output /dev/null
+
+cat <<END_OF_DATA >tmp/bconcmds
+@$out /dev/null
messages
-@output tmp/log1.out
-@# Force decremental on the second Volume
+@$out tmp/log1.out
+@# Force differential on the second Volume
update volume=TestVolume001 VolStatus=Used
-run level=decremental job=CompressedTest yes
+run level=differential job=CompressedTest yes
wait
messages
-@output
+@$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
+
scripts/check_for_zombie_jobs storage=File
echo "ficheriro2.txt" >${cwd}/tmp/build/ficheriro2.txt
-bin/bconsole -c bin/bconsole.conf <<END_OF_DATA 2>&1 >/dev/null
-@output /dev/null
+
+cat <<END_OF_DATA >tmp/bconcmds
+@$out /dev/null
messages
-@output tmp/log1.out
+@$out tmp/log1.out
run level=incremental job=CompressedTest yes
wait
messages
@#
@# now do a restore
@#
-@output tmp/log2.out
+@$out tmp/log2.out
restore where=${cwd}/tmp/bacula-restores storage=File file=<${cwd}/tmp/restore-list
yes
wait
messages
-@output
+@$out
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
grep "^ Termination: *Backup OK" tmp/log1.out 2>&1 >/dev/null
grep "^ Termination: *Restore OK" tmp/log2.out 2>&1 >/dev/null
rstat=$?
#
-# Delete .c files because we will only restored the txt files
+# 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 " !!!!! decremental-test Bacula source failed!!! !!!!! "
- echo " !!!!! decremental-test failed!!! !!!!! " >>test.out
+ 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
fi
echo " "
else
- echo " ===== decremental-test Bacula source OK ===== "
- echo " ===== decremental-test OK ===== " >>test.out
+ echo " ===== differential-test Bacula source OK ===== "
+ echo " ===== differential-test OK ===== " >>test.out
scripts/cleanup
fi
# totally full. I.e. make sure that bsr selects all tapes
# including those fully spanned.
#
+debug=1
+if test "$debug" -eq 1 ; then
+ out="tee"
+else
+ out="output"
+fi
+
cwd=`pwd`
scripts/copy-test-confs
scripts/cleanup
echo " === Starting span-vol-test at `date +%R:%S` ===" >working/log
echo " "
-bin/bacula start 2>&1 >/dev/null
-bin/bconsole -c bin/bconsole.conf <<END_OF_DATA 2>&1 >/dev/null
-@output /dev/null
+cat <<END_OF_DATA >tmp/bconcmds
+@$out /dev/null
messages
-@output tmp/log1.out
-label storage=File1 volume=TestVolume001
-label storage=File1 volume=TestVolume002
-label storage=File1 volume=TestVolume003
+@$out tmp/log1.out
label storage=File1 volume=TestVolume004
-update Volume=TestVolume001 MaxVolBytes=3000000
-update Volume=TestVolume002 MaxVolBytes=3000000
+label storage=File1 volume=TestVolume003
+label storage=File1 volume=TestVolume002
+label storage=File1 volume=TestVolume001
+update Volume=TestVolume004 MaxVolBytes=3000000
update Volume=TestVolume003 MaxVolBytes=3000000
+update Volume=TestVolume002 MaxVolBytes=3000000
run job=NightlySave storage=File1 yes
wait
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 *
yes
wait
messages
-@output
+@$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=File1
bin/bacula stop 2>&1 >/dev/null
grep "^ Termination: *Backup OK" tmp/log1.out 2>&1 >/dev/null
# 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
+
cwd=`pwd`
scripts/copy-test-confs
scripts/cleanup
echo " === Starting verify Volume Test at `date +%R:%S` ===" >>working/log
echo " "
-bin/bacula start 2>&1 >/dev/null
-bin/bconsole -c bin/bconsole.conf <<END_OF_DATA 2>&1 >/dev/null
-@output /dev/null
+cat <<END_OF_DATA >tmp/bconcmds
+@$out /dev/null
messages
-@output tmp/log1.out
+@$out tmp/log1.out
setdebug level=1 storage=File sd
label storage=File volume=TestVolume001
run job=NightlySave yes
@#
@# now do a verify volume
@#
-@output ${cwd}/tmp/original
+@$out ${cwd}/tmp/original
run job=VerifyVolume
yes
wait
messages
-@output
+@$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
+
sleep 2
scripts/check_for_zombie_jobs storage=File
bin/bacula stop 2>&1 >/dev/null