RemovableMedia = yes;
@@sbindir@/tape_options
# Maximum File Size = 1000000
-# MaximumVolumeSize = 100M
+# MaximumVolumeSize = 400M
}
#
fi
}
+run_btape()
+{
+ if test "$debug" -eq 1 ; then
+ cat tmp/bconcmds | bin/btape -c bin/bacula-sd.conf DDS-4 | tee tmp/log1.out
+ else
+ cat tmp/bconcmds | bin/btape -c bin/bacula-sd.conf DDS-4 2>&1 >tmp/log1.out
+ fi
+}
+
+
stop_bacula()
{
bin/bacula stop 2>&1 >/dev/null
change_jobname()
{
+ if test $# == 1; then
+ oldname=NightlySave
+ newname=$1
+ else
+ oldname=$1
+ newname=$2
+ fi
rm -f bin/1
mv bin/bacula-dir.conf bin/1
- echo "s%NightlySave%$1%g" >/tmp/1
+ echo "s%${oldname}%${newname}%g" >/tmp/1
sed -f /tmp/1 bin/1 >bin/bacula-dir.conf
+ echo "Job ${oldname} changed to ${newname}"
}
check_two_logs()
fi
}
+copy_tape_confs()
+{
+ scripts/copy-tape-confs
+ scripts/cleanup-tape
+}
+
+copy_test_confs()
+{
+ scripts/copy-test-confs
+ scripts/cleanup
+}
+
+
# Save current directory
cwd=`pwd`
JobName=AutoLabel
. scripts/functions
set_debug 0
+copy_test_confs
-cwd=`pwd`
-scripts/copy-test-confs
-scripts/cleanup
echo "${cwd}/build" >/tmp/file-list
cp ${cwd}/bin/bacula-dir.conf ${cwd}/tmp/1
sed "s%# Label Format% Label Format%" ${cwd}/tmp/1 >${cwd}/bin/bacula-dir.conf
+change_jobname CompressedTest $JobName
start_test
-cat <<END_OF_DATA >tmp/bconcmds
+cat <<END_OF_SCRIPT >tmp/bconcmds
@output /dev/null
messages
@$out tmp/log1.out
list pools
messages
@#setdebug level=110 storage=File
-run job=CompressedTest storage=File yes
+run job=$JobName storage=File yes
list pools
list volumes
wait
messages
@$out
quit
-END_OF_DATA
+END_OF_SCRIPT
run_bacula
check_for_zombie_jobs storage=File
echo "${cwd}/build" >/tmp/file-list
-change_job $JobName
+change_jobname NightlySave $JobName
start_test
relabel pool=Default storage=DDS-4 oldVolume=TestVolume001 volume=TestVolume002 slot=0
purge volume=TestVolume002
relabel pool=Default storage=DDS-4 oldVolume=TestVolume002 volume=TestVolume001 slot=0
-run job=NightlySave yes
+run job=$JobName yes
status storage=DDS-4
status storage=DDS-4
status storage=DDS-4
messages
@$out tmp/log1.out
list volumes
-run job=NightlySave yes
+run job=$JobName yes
wait
list volumes
messages
scripts/copy-confs
scripts/cleanup
+change_jobname Client1 $JobName
start_test
cat <<END_OF_DATA >tmp/bconcmds
@$out tmp/log1.out
label volume=TestVolume001
@#setdebug level=100 storage=File
-run job=Client1 yes
+run job=$JobName yes
status storage=File
status storage=File
status storage=File
scripts/cleanup
echo "${cwd}/build" >/tmp/file-list
-change_jobname $JobName
+change_jobname NightlySave $JobName
start_test
cat <<END_OF_DATA >tmp/bconcmds
. scripts/functions
set_debug 0
-scripts/copy-tape-confs
-scripts/cleanup-tape
+copy_tape_confs
+
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
-change_jobname $JobName
+change_jobname NightlySave $JobName
start_test
cat <<END_OF_DATA >tmp/bconcmds
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
+
echo "Backup 1 done"
# make some files for the incremental to pick up
touch ${cwd}/build/src/dird/*.c ${cwd}/build/src/dird/*.o
messages
quit
END_OF_DATA
-if test "$debug" -eq 1 ; then
- bin/bacula start
- cat tmp/bconcmds | bin/bconsole -c bin/bconsole.conf
-else
- bin/bacula start 2>&1 >/dev/null
- cat tmp/bconcmds | bin/bconsole -c bin/bconsole.conf 2>&1 >/dev/null
-fi
+run_bacula
scripts/check_for_zombie_jobs storage=DDS-4
+
echo "Backup 2 done"
touch ${cwd}/build/src/dird/*.c
touch ${cwd}/build/src/lib/*.c ${cwd}/build/src/lib/*.o
messages
quit
END_OF_DATA
-if test "$debug" -eq 1 ; then
- bin/bacula start
- cat tmp/bconcmds | bin/bconsole -c bin/bconsole.conf
-else
- bin/bacula start 2>&1 >/dev/null
- cat tmp/bconcmds | bin/bconsole -c bin/bconsole.conf 2>&1 >/dev/null
-fi
+run_bacula
scripts/check_for_zombie_jobs storage=DDS-4
+
echo "Backup 3 done"
# make some files for the incremental to pick up
touch ${cwd}/build/src/lib/*.c ${cwd}/build/src/lib/*.o
#
# run a fourth job
#
-
cat <<END_OF_DATA >tmp/bconcmds
@$out /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
+
+run_bacula
scripts/check_for_zombie_jobs storage=DDS-4
+stop_bacula
+
echo "Backup 4 done"
#
# now drop and recreate the database
./grant_bacula_privileges 2>&1 >/dev/null
cd ..
-bin/bacula stop 2>&1 >/dev/null
echo "volume=TestVolume001" >tmp/bscan.bsr
bin/bscan -w working -m -s -v -b tmp/bscan.bsr -c bin/bacula-sd.conf DDS-4 2>&1 >/dev/null
-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
@$out /dev/null
messages
@$out tmp/log2.out
scripts/cleanup
echo "${cwd}/build" >/tmp/file-list
-change_jobname $JobName
+change_jobname NightlySave $JobName
start_test
cat <<END_OF_DATA >tmp/bconcmds
scripts/cleanup
echo "${cwd}/build" >/tmp/file-list
-change_jobname $JobName
-
+change_jobname NightlySave $JobName
start_test
cat <<END_OF_DATA >tmp/bconcmds
. scripts/functions
set_debug 0
-scripts/copy-tape-confs
-scripts/cleanup-tape
+copy_tape_confs
echo "${cwd}/build" >/tmp/file-list
start_test
-bin/btape -c bin/bacula-sd.conf DDS-4 <<END_OF_DATA 2>&1 >tmp/log1.out
+cat <<END_OF_DATA >tmp/bconcmds
fill
s
quit
END_OF_DATA
+run_btape DDS-4
grep "^The last block on the tape matches\. Test succeeded\." tmp/log1.out 2>&1 >/dev/null
if [ $? != 0 ] ; then
scripts/cleanup
echo "${cwd}/build" >/tmp/file-list
+change_jobname CompressedTest $JobName
start_test
cat <<END_OF_DATA >tmp/bconcmds
status all
messages
label storage=File volume=TestVolume001
-run job=CompressedTest storage=File yes
+run job=$JobName storage=File yes
wait
messages
@#
check_two_logs
check_restore_diff
end_test
-
. scripts/functions
set_debug 0
-scripts/copy-test-confs
-scripts/cleanup
+copy_test_confs
+
echo "${cwd}/tmp/largefile" >/tmp/file-list
if test -c /dev/urandom ; then
# Create 56MB file with random data
echo "largefile created"
+change_jobname CompressedTest $JobName
start_test
cat <<END_OF_DATA >tmp/bconcmds
messages
@$out tmp/log1.out
label storage=File volume=TestVolume001
-run job=CompressedTest level=Full yes
-run job=CompressedTest level=Full yes
-run job=CompressedTest level=Full yes
-run job=CompressedTest level=Full yes
+run job=$JobName level=Full yes
+run job=$JobName level=Full yes
+run job=$JobName level=Full yes
+run job=$JobName level=Full yes
wait
messages
@#
stop_bacula
check_two_logs
-check_restore_diff
+diff tmp/largefile tmp/bacula-restores${cwd}/tmp/largefile 2>&1 >/dev/null
+dstat=$?
end_test
echo "${cwd}/tmp/build/ficheriro2.txt" >>restore-list
cd ${cwd}
+change_jobname CompressedTest $JobName
start_test
cat <<END_OF_DATA >tmp/bconcmds
@$out tmp/log1.out
label storage=File volume=TestVolume002
label storage=File volume=TestVolume001
-run job=CompressedTest yes
+run job=$JobName yes
wait
messages
quit
@$out tmp/log1.out
@# Force differential on the second Volume
update volume=TestVolume002 VolStatus=Used
-run level=differential job=CompressedTest yes
+run level=differential job=$JobName yes
wait
messages
@$out
@$out /dev/null
messages
@$out tmp/log1.out
-run level=incremental job=CompressedTest yes
+run level=incremental job=$JobName yes
wait
messages
@#
scripts/cleanup
echo "${cwd}/build" >/tmp/file-list
-change_jobname $JobName
+change_jobname NightlySave $JobName
start_test
cat <<END_OF_DATA >tmp/bconcmds
@$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
@#
TestName="fixed-block-size-tape"
JobName=fixedblocksize
. scripts/functions
-set_debug 0
+set_debug 1
+
+copy_tape_confs
-scripts/copy-tape-confs
-scripts/cleanup-tape
echo "${cwd}/build" >/tmp/file-list
cp ${cwd}/bin/bacula-sd.conf ${cwd}/tmp/1
fi
rm -f ${cwd}/tmp/1 ${cwd}/tmp/2
-change_jobname $JobName
+change_jobname NightlySave $JobName
start_test
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
@#
scripts/cleanup
echo "${cwd}/build" >/tmp/file-list
-change_jobname $JobName
-
+change_jobname NightlySave $JobName
start_test
cat <<END_OF_DATA >tmp/bconcmds
scripts/cleanup
echo "${cwd}/build" >/tmp/file-list
+change_jobname CompressedTest $JobName
start_test
cat <<END_OF_DATA >tmp/bconcmds
@output /dev/null
-estimate job=CompressedTest listing
-estimate job=CompressedTest listing
-estimate job=CompressedTest listing
+estimate job=$JobName listing
+estimate job=$JobName listing
+estimate job=$JobName listing
messages
@$out tmp/log1.out
label storage=File volume=TestVolume001
-run job=CompressedTest yes
+run job=$JobName yes
wait
messages
quit
@output /dev/null
messages
@$out tmp/log1.out
-run job=CompressedTest
+run job=$JobName
yes
wait
messages
messages
@output tmp/log1.out
label storage=File volume=TestVolume001
-run job=CompressedTest yes
+run job=$JobName yes
wait
messages
quit
messages
@output tmp/log1.out
label storage=File volume=TestVolume001
-run job=CompressedTest yes
+run job=$JobName yes
wait
messages
quit
. scripts/functions
set_debug 0
-cwd=`pwd`
scripts/copy-test-confs
scripts/cleanup
echo "${cwd}/tmp/build" >/tmp/file-list
echo "${cwd}/tmp/build/ficheriro2.txt" >>restore-list
cd ${cwd}
+change_jobname CompressedTest $JobName
start_test
cat <<END_OF_DATA >tmp/bconcmds
@$out tmp/log1.out
label storage=File volume=TestVolume001
label storage=File volume=TestVolume002
-run job=CompressedTest yes
+run job=$JobName yes
wait
messages
quit
@$out tmp/log1.out
@# Force Incremental on the second Volume
update volume=TestVolume001 VolStatus=Used
-run level=Differential job=CompressedTest yes
+run level=Differential job=$JobName yes
wait
messages
quit
@output /dev/null
messages
@$out tmp/log1.out
-run level=Incremental job=CompressedTest yes
+run level=Incremental job=$JobName yes
wait
messages
quit
@output /dev/null
messages
@$out tmp/log1.out
-run level=Differential job=CompressedTest yes
+run level=Differential job=$JobName yes
wait
messages
quit
@output /dev/null
messages
@$out tmp/log1.out
-run level=Incremental job=CompressedTest yes
+run level=Incremental job=$JobName yes
wait
messages
quit
@output /dev/null
messages
@$out tmp/log1.out
-run level=Incremental job=CompressedTest yes
+run level=Incremental job=$JobName yes
wait
messages
quit
@output /dev/null
messages
@$out tmp/log1.out
-run level=Incremental job=CompressedTest yes
+run level=Incremental job=$JobName yes
wait
messages
quit
@output /dev/null
messages
@$out tmp/log1.out
-run level=Incremental job=CompressedTest yes
+run level=Incremental job=$JobName yes
wait
messages
@#
. scripts/functions
set_debug 0
-cwd=`pwd`
scripts/copy-test-confs
scripts/cleanup
echo "${cwd}/tmp/build" >/tmp/file-list
echo "${cwd}/tmp/build/ficheriro2.txt" >>restore-list
cd ${cwd}
+change_jobname CompressedTest $JobName
start_test
cat <<END_OF_DATA >tmp/bconcmds
@$out tmp/log1.out
label storage=File volume=TestVolume001
label storage=File volume=TestVolume002
-run job=CompressedTest yes
+run job=$JobName yes
wait
messages
quit
@$out tmp/log1.out
@# Force differental on the second Volume
update volume=TestVolume001 VolStatus=Used
-run level=differental job=CompressedTest yes
+run level=differental job=$JobName yes
wait
messages
@output
@output /dev/null
messages
@$out tmp/log1.out
-run level=incremental job=CompressedTest yes
+run level=incremental job=$JobName yes
wait
messages
@#
scripts/copy-test-confs
scripts/cleanup
echo "${cwd}/build" >/tmp/file-list
-change_jobname $JobName
+change_jobname NightlySave $JobName
start_test
cat <<END_OF_DATA >tmp/bconcmds
#
TestName="restore-by-file-test"
-JobName=SpanVol
+JobName=restorebyfile
. scripts/functions
set_debug 0
rm -f 1
cd ${cwd}
+change_jobname CompressedTest $JobName
start_test
cat <<END_OF_DATA >tmp/bconcmds
messages
@$out tmp/log1.out
label storage=File volume=TestVolume001
-run job=CompressedTest yes
+run job=$JobName yes
wait
messages
@#
. scripts/functions
set_debug 0
-cwd=`pwd`
scripts/copy-test-confs
scripts/cleanup
echo "${cwd}/tmp/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
+change_jobname CompressedTest $JobName
start_test
cat <<END_OF_DATA >tmp/bconcmds
messages
@$out tmp/log1.out
label storage=File volume=TestVolume001
-run job=CompressedTest yes
+run job=$JobName yes
wait
messages
@#
echo "${cwd}/build" >/tmp/file-list
sed s%\^%${cwd}% ${cwd}/scripts/flist >${cwd}/tmp/restore2-list
+change_jobname CompressedTest $JobName
start_test
cat <<END_OF_DATA >tmp/bconcmds
messages
@$out tmp/log1.out
label storage=File volume=TestVolume001
-run job=CompressedTest yes
+run job=$JobName yes
wait
messages
@#
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
+change_jobname NightlySave $JobName
start_test
# Write out bconsole commands
echo "No random device. Test skipped.\n"
exit 0
fi
-cwd=`pwd`
+
scripts/copy-testa-confs
scripts/cleanup
echo "${cwd}/tmp/largefile" >/tmp/file-list
dd if=/dev/urandom of=${cwd}/tmp/largefile bs=1024 count=55000
echo "largefile created"
+change_jobname MultiVol $JobName
start_test
cat <<END_OF_DATA >tmp/bconcmds
@output /dev/null
messages
@$out tmp/log1.out
-run job=MultiVol storage=File yes
+run job=$JobName storage=File yes
wait
messages
@#
scripts/copy-test-confs
scripts/cleanup
echo "${cwd}/build" >/tmp/file-list
-change_jobname $JobName
+change_jobname NightlySave $JobName
start_test
cat <<END_OF_DATA >tmp/bconcmds
scripts/copy-test-confs
scripts/cleanup
echo "${cwd}/build" >/tmp/file-list
-change_jobname $JobName
+change_jobname CompressedTest $JobName
start_test
cat >tmp/bconcmds <<END_OF_DATA
@output /dev/null
messages
@output/dev/null
-estimate job=CompressedTest listing
-estimate job=CompressedTest listing
-estimate job=CompressedTest listing
+estimate job=$JobName listing
+estimate job=$JobName listing
+estimate job=$JobName listing
messages
@$out tmp/log1.out
label storage=File volume=TestVolume001
-run job=CompressedTest yes
+run job=$JobName yes
wait
messages
quit
@output /dev/null
messages
@$out tmp/log1.out
-run job=CompressedTest
+run job=$JobName
yes
wait
messages
scripts/copy-test-confs
scripts/cleanup
echo "${cwd}/build" >/tmp/file-list
-change_jobname $JobName
+change_jobname NightlySave $JobName
start_test
cat <<END_OF_DATA >tmp/bconcmds
cp ${cwd}/bin/bacula-sd.conf ${cwd}/tmp/1
sed -f ${outf} ${cwd}/tmp/1 >${cwd}/bin/bacula-sd.conf
-change_jobname $JobName
-
+change_jobname NightlySave $JobName
start_test
+
# Write out bconsole commands
cat <<END_OF_DATA >tmp/bconcmds
@$out /dev/null
scripts/copy-test-confs
scripts/cleanup
echo "${cwd}/build" >/tmp/file-list
-change_jobname $JobName
+change_jobname NightlySave $JobName
start_test
cat <<END_OF_DATA >tmp/bconcmds
cwd=`pwd`
scripts/copy-test-confs
scripts/cleanup
-change_jobname $JobName
+change_jobname NightlySave $JobName
#
# Note, we save the weird-files directory twice on purpose
# because this causes problems with hard linked files
rm -rf weird-files2
cp -Rp weird-files weird-files2
echo "${cwd}/weird-files2" >/tmp/file-list
-change_jobname $JobName
+change_jobname NightlySave $JobName
start_test
bin/testls weird-files2 >${cwd}/tmp/original