3 # Copyright (C) 2000-2015 Kern Sibbald
4 # License: BSD 2-Clause; see file LICENSE-FOSS
8 # Run a simple backup of the Bacula build directory then create some
9 # new files, do an Incremental and restore those two files.
11 # This script uses the virtual disk autochanger
13 TestName="incremental-2disk"
18 scripts/copy-2disk-confs
19 scripts/prepare-disk-changer
21 echo "${cwd}/tmp/build" >${cwd}/tmp/file-list
22 if test ! -d ${cwd}/tmp/build ; then
23 mkdir -p ${cwd}/tmp/build
25 cp -p ${cwd}/build/src/dird/*.c ${cwd}/tmp/build
27 echo "${cwd}/tmp/build/ficheriro1.txt" >restore-list
28 echo "${cwd}/tmp/build/ficheriro2.txt" >>restore-list
31 change_jobname $JobName
34 # Write out bconsole commands
35 cat <<END_OF_DATA >${cwd}/tmp/bconcmds
38 @$out ${cwd}/tmp/log1.out
39 label storage=tape volume=TestVolume001 slot=1 Pool=Default drive=0
40 label storage=tape volume=TestVolume002 slot=2 Pool=Default drive=0
49 echo "ficheriro1.txt" >${cwd}/tmp/build/ficheriro1.txt
50 echo "ficheriro2.txt" >${cwd}/tmp/build/ficheriro2.txt
53 cat <<END_OF_DATA >${cwd}/tmp/bconcmds
56 @$out ${cwd}/tmp/log1.out
57 @# Force Incremental on the second Volume
58 update volume=TestVolume001 VolStatus=Used
59 run level=Incremental job=$JobName yes
65 @$out ${cwd}/tmp/log2.out
66 restore where=${cwd}/tmp/bacula-restores
68 <${cwd}/tmp/restore-list
78 check_for_zombie_jobs storage=File
81 # Delete .c files because we will only restored the txt files
83 rm -f ${cwd}/tmp/build/*.c
86 check_restore_tmp_build_diff
89 # This script seems to more or less randomly fail, so we
90 # add extra code here to produce a "dump" in the event of
93 if [ $dstat != 0 -o $bstat != 0 -o $rstat != 0 ] ; then
94 cat ${cwd}/tmp/log1.out
96 cat ${cwd}/tmp/log2.out
98 diff -r ${cwd}/tmp/build ${cwd}/tmp/bacula-restores${cwd}/tmp/build