ADD_TEST(changer:incremental-changer "@regressdir@/tests/incremental-changer")
ADD_TEST(changer:two-pool-changer "@regressdir@/tests/two-pool-changer")
ADD_TEST(changer:two-volume-changer "@regressdir@/tests/two-volume-changer")
-# ADD_TEST(changer:two-vol-manual-tape "@regressdir@/tests/two-vol-manual-tape")
+# ADD_TEST(changer:manual-two-vol-tape "@regressdir@/tests/manual-two-vol-tape")
ADD_TEST(changer:vol-duration-changer "@regressdir@/tests/vol-duration-changer")
ADD_TEST(2drive-changer:2drive-incremental-changer "@regressdir@/tests/2drive-incremental-changer")
nice tests/small-file-size-tape
nice tests/truncate-bug-tape
nice tests/verify-vol-tape
-# nice tests/two-vol-manual-tape
+nice tests/manual-two-vol-tape
echo "End all non-root tape tests"
echo "End all non-root tape tests" >>test.out
--- /dev/null
+#!/bin/sh
+#
+# Label two tapes, write to the first, then recycle it and destroy
+# the header. Bacula should discover that, mark the tape in
+# error and continue onto the second tape.
+#
+TestName="bad-label-changer"
+JobName=badlabelchanger
+. scripts/functions
+
+require_tape_drive
+require_autochanger
+
+scripts/cleanup
+scripts/copy-2tape-confs
+scripts/prepare-two-tapes
+
+echo "${cwd}/build" >${cwd}/tmp/file-list
+
+outf="tmp/sed_tmp"
+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
+
+# Write out bconsole commands
+cat <<END_OF_DATA >tmp/bconcmds
+@$out /dev/null
+messages
+@$out tmp/log1.out
+label storage=DDS-4 volume=TestVolume002 slot=$SLOT2 pool=Default drive=$DRIVE1
+label storage=DDS-4 volume=TestVolume001 slot=$SLOT1 pool=Default drive=$DRIVE1
+@#setdebug level=10 client=$CLIENT
+setdebug level=150 storage=DDS-4
+run job=$JobName yes
+wait
+purge volume=TestVolume001
+messages
+quit
+END_OF_DATA
+
+run_bacula
+check_for_zombie_jobs storage=DDS-4
+stop_bacula
+
+# Overwrite TestVolume001 label
+init_drive ${TAPE_DRIVE}
+
+cat <<END_OF_DATA >tmp/bconcmds
+@$out /dev/null
+messages
+list volumes
+run job=$JobName level=Full storage=DDS-4 yes
+wait
+messages
+@#
+@# now do a restore
+@#
+@$out tmp/log2.out
+restore where=${cwd}/tmp/bacula-restores select all storage=DDS-4 done
+yes
+wait
+messages
+@$out
+quit
+END_OF_DATA
+
+run_bacula
+check_for_zombie_jobs storage=DDS-4
+stop_bacula
+
+check_two_logs
+check_restore_diff
+end_test
--- /dev/null
+#!/bin/sh
+#
+# Run a job with a limited tape size so that the tape fills up.
+# Then manually unload the tape and load a new one, label
+# it.
+#
+TestName="two-vol-manual-tape"
+JobName=twovolmanualtape
+. scripts/functions
+
+require_tape_drive
+require_autochanger
+
+scripts/cleanup
+scripts/copy-tape-confs
+echo "${cwd}/build" >${cwd}/tmp/file-list
+MTX=$AUTOCHANGER_SCRIPT
+
+# Sleep longer if real tape
+if [ x${USE_VTAPE} = xyes ] ; then
+ sleep=20
+else
+ sleep=90
+fi
+
+slot=0
+export slot
+
+# TODO -- check this
+init_slot $TAPE_DRIVE $SLOT1
+init_slot $TAPE_DRIVE $SLOT2
+
+load_slot1
+
+init_drive ${TAPE_DRIVE}
+
+change_jobname $JobName
+start_test
+
+# Label second volume
+cat <<END_OF_DATA >tmp/bconcmds
+@out /dev/null
+messages
+@$out tmp/log1.out
+label storage=DDS-4 volume=TestVolume002 slot=0 pool=Default drive=0
+unmount storage=DDS-4
+quit
+END_OF_DATA
+
+run_bacula
+
+# Load slot2
+load_other_slot $slot
+init_drive ${TAPE_DRIVE}
+
+# label first volume, and run first half of job
+cat <<END_OF_DATA >tmp/bconcmds
+@$out tmp/log1.out
+label storage=DDS-4 volume=TestVolume001 slot=0 pool=Default drive=0
+update Volume=TestVolume001 MaxVolBytes=500000 pool=Default drive=0
+list volumes
+setdebug level=150 storage=DDS-4
+run job=$JobName yes
+@# This sleep must be long enough for the first tape to fill (4MB)
+@# otherwise the following mtx-changer commands will fail
+@sleep $sleep
+list volumes
+unmount storage=DDS-4
+list volumes
+status storage=DDS-4
+messages
+quit
+END_OF_DATA
+
+run_bconsole
+
+load_other_slot $slot
+
+cat <<END_OF_DATA >tmp/bconcmds
+@$out tmp/log1.out
+mount storage=DDS-4
+@# backup should continue
+wait
+@#
+@# now do a restore
+@#
+@#restore where=${cwd}/tmp/bacula-restores select all storage=DDS-4 done
+@#yes
+wait
+list volumes
+messages
+@$out
+quit
+END_OF_DATA
+
+# run second half of backup + restore
+run_bconsole
+
+touch tmp/log2.out
+
+check_for_zombie_jobs storage=DDS-4
+stop_bacula
+
+check_two_logs
+#check_restore_diff
+dstat=0 # no diff
+rstat=0 # no restore
+end_test
+++ /dev/null
-#!/bin/sh
-#
-# Run a job with a limited tape size so that the tape fills up.
-# Then manually unload the tape and load a new one, label
-# it.
-#
-TestName="two-vol-manual-tape"
-JobName=twovolmanualtape
-. scripts/functions
-
-require_tape_drive
-require_autochanger
-
-scripts/cleanup
-scripts/copy-tape-confs
-echo "${cwd}/build" >${cwd}/tmp/file-list
-MTX=$AUTOCHANGER_SCRIPT
-
-# Sleep longer if real tape
-if [ x${USE_VTAPE} = xyes ] ; then
- sleep=20
-else
- sleep=90
-fi
-
-slot=0
-export slot
-
-# TODO -- check this
-init_slot $TAPE_DRIVE $SLOT1
-init_slot $TAPE_DRIVE $SLOT2
-
-load_slot1
-
-init_drive ${TAPE_DRIVE}
-
-change_jobname $JobName
-start_test
-
-# Label second volume
-cat <<END_OF_DATA >tmp/bconcmds
-@out /dev/null
-messages
-@$out tmp/log1.out
-label storage=DDS-4 volume=TestVolume002 slot=0 pool=Default drive=0
-unmount storage=DDS-4
-quit
-END_OF_DATA
-
-run_bacula
-
-# Load slot2
-load_other_slot $slot
-init_drive ${TAPE_DRIVE}
-
-# label first volume, and run first half of job
-cat <<END_OF_DATA >tmp/bconcmds
-@$out tmp/log1.out
-label storage=DDS-4 volume=TestVolume001 slot=0 pool=Default drive=0
-update Volume=TestVolume001 MaxVolBytes=500000 pool=Default drive=0
-list volumes
-setdebug level=150 storage=DDS-4
-run job=$JobName yes
-@# This sleep must be long enough for the first tape to fill (4MB)
-@# otherwise the following mtx-changer commands will fail
-@sleep $sleep
-list volumes
-unmount storage=DDS-4
-list volumes
-status storage=DDS-4
-messages
-quit
-END_OF_DATA
-
-run_bconsole
-
-load_other_slot $slot
-
-cat <<END_OF_DATA >tmp/bconcmds
-@$out tmp/log1.out
-mount storage=DDS-4
-@# backup should continue
-wait
-@#
-@# now do a restore
-@#
-@#restore where=${cwd}/tmp/bacula-restores select all storage=DDS-4 done
-@#yes
-wait
-list volumes
-messages
-@$out
-quit
-END_OF_DATA
-
-# run second half of backup + restore
-run_bconsole
-
-touch tmp/log2.out
-
-check_for_zombie_jobs storage=DDS-4
-stop_bacula
-
-check_two_logs
-#check_restore_diff
-dstat=0 # no diff
-rstat=0 # no restore
-end_test
--- /dev/null
+#!/bin/sh
+#
+# Run a simple backup of the Bacula build directory then do a virtual
+# backup to another device.
+#
+# This script uses the virtual disk autochanger
+#
+TestName="virtual-backup-test"
+JobName=Vbackup
+. scripts/functions
+
+
+scripts/cleanup
+scripts/copy-migration-confs
+scripts/prepare-two-disks
+echo "${cwd}/build" >${cwd}/tmp/file-list
+
+change_jobname NightlySave $JobName
+start_test
+
+#
+# Note, we first backup into Pool Default,
+# then Migrate into Pool Full.
+# Pool Default uses Storage=File
+# Pool Full uses Storage=DiskChanger
+
+# Write out bconsole commands
+cat <<END_OF_DATA >${cwd}/tmp/bconcmds
+@output
+messages
+@$out ${cwd}/tmp/log1.out
+@#setdebug level=100 storage=File
+label storage=File volume=FileVolume001 Pool=Default
+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
+run job=$JobName level=Full yes
+wait
+messages
+list jobs
+@exec "sh -c 'touch ${cwd}/build/src/dird/*.c'"
+run job=$JobName level=Incremental yes
+wait
+messages
+list jobs
+@exec "sh -c 'touch ${cwd}/build/src/dird/*.o'"
+run job=$JobName level=Differential yes
+wait
+messages
+list jobs
+@exec "sh -c 'touch ${cwd}/build/src/dird/*.o'"
+run job=$JobName level=Incremental yes
+wait
+messages
+list jobs
+list volumes
+setdebug level=100 dir
+@# should migrate two jobs
+@#setdebug level=51 storage=DiskChanger
+run job=$JobName level=VirtualFull yes
+wait
+messages
+list volumes
+list jobs
+@#
+@# now do a restore
+@#
+@$out ${cwd}/tmp/log2.out
+restore where=${cwd}/tmp/bacula-restores select storage=DiskChanger
+unmark *
+mark *
+done
+yes
+list volumes
+wait
+messages
+@output
+quit
+END_OF_DATA
+
+run_bacula
+check_for_zombie_jobs storage=File
+stop_bacula
+
+check_two_logs
+check_restore_diff
+end_test