#!/bin/sh
#
-# Run a simple backup of the Bacula build directory then do a virtual
-# backup to another device.
+# Run a simple backup of the Bacula build directory then do a
+# Virtual Full backup to another device.
#
-# This script uses the virtual disk autochanger
+# This script uses the disk autochanger
#
TestName="virtual-backup-test"
JobName=Vbackup
label storage=DiskChanger volume=ChangerVolume001 slot=1 Pool=Full drive=0
label storage=DiskChanger volume=ChangerVolume002 slot=2 Pool=Full drive=0
@# run several jobs
+@exec "sh -c 'date > ${cwd}/build/date'"
run job=$JobName level=Full yes
wait
messages
wait
messages
list jobs
+@exec "sh -c 'date > ${cwd}/build/date'"
@exec "sh -c 'touch ${cwd}/build/src/dird/*.o'"
run job=$JobName level=Incremental yes
wait
@#
@# now do a normal restore of normal backups
@#
-@$out ${cwd}/tmp/log2.out
setdebug level=10 dir
restore where=${cwd}/tmp/bacula-restores select
unmark *
yes
list volumes
@# should Consolidate Full, Differential and Incremental
-@#setdebug level=51 storage=DiskChanger
+setdebug level=150 storage=DiskChanger
+setdebug level=100 dir
run job=$JobName level=VirtualFull yes
wait
messages
@#
@# now do a restore of the consolidated Full
@#
-@$out ${cwd}/tmp/log2.out
restore where=${cwd}/tmp/bacula-restores select storage=DiskChanger
unmark *
mark *
check_for_zombie_jobs storage=File
stop_bacula
+#
+# We only used one log so copy it to the second log
+# so that any restore errors will be picked up
+#
+cp -f ${cwd}/tmp/log1.out ${cwd}/tmp/log2.out
check_two_logs
check_restore_diff
end_test