3 # Copyright (C) 2000-2017 Kern Sibbald
4 # License: BSD 2-Clause; see file LICENSE-FOSS
7 # Run a simple backup of the Bacula build directory
8 # then verify the data on the volume.
10 TestName="verify-data-test"
18 scripts/copy-test-confs
19 echo "${cwd}/tmp/files" >$tmp/file-list
20 echo "${cwd}/build/src/dird" >>$tmp/file-list
21 echo "${cwd}/build/src/filed" >>$tmp/file-list
24 # Add this back when verify can handle sparse files
25 # the same way that backup does
28 dd if=${cwd}/build/configure of=$tmp/files/sparsefile bs=1 count=1 seek=10M > /dev/null
30 change_jobname NightlySave $JobName
33 cat <<END_OF_DATA >tmp/bconcmds
37 label storage=File volume=TestVolume001
38 run job=$JobName level=full fileset=FS1 yes
39 run job=$JobName level=full fileset=FS5 yes
40 run job=$JobName level=full fileset=FSno5 yes
41 run job=$JobName level=full fileset=FS5nocheck yes
45 @# now do a verify volume
47 @$out ${cwd}/tmp/log2.out
48 setdebug level=10 client
49 run job=VerifyData jobid=1 yes
50 run job=VerifyData jobid=2 yes
51 run job=VerifyData jobid=3 yes
52 run job=VerifyData jobid=4 yes
61 check_for_zombie_jobs storage=File
64 $bperl -e 'add_attribute("$conf/bacula-sd.conf", "BlockChecksum", "no", "Device")'
67 # NOTE!!! sed is an ASCII file editor not a binary file editor
68 # Thus in general, the following sed will not work and is
69 # not portable. It is known to fail on FreeBSD, but *seems* to work
72 # Introduce a volume error by modifying the some Volume data
74 if [ x$FORCE_DEDUP = xyes ]; then
76 elif [ x$FORCE_ALIGNED = xyes ]; then
77 sed -i 's/DUALCASE/PUALCASE/g' $tmp/TestVolume001.add
79 sed -i 's/DUALCASE/PUALCASE/g' $tmp/TestVolume001
82 cat <<END_OF_DATA >tmp/bconcmds
85 @# now do a verify volume with errors. Note, which JobId produces
86 @# verify errors depends on the size of data stored (less with dedup
89 @$out ${cwd}/tmp/log3.out
90 setdebug level=10 client
91 run job=VerifyData jobid=1 yes
92 run job=VerifyData jobid=2 yes
93 run job=VerifyData jobid=3 yes
94 run job=VerifyData jobid=4 yes
103 check_for_zombie_jobs storage=File
106 nb=`grep "^ Termination: *Backup OK" tmp/log1.out | wc -l`
107 if [ $nb -ne 4 ]; then
110 nb=`grep "^ Termination: *Verify OK" tmp/log2.out | wc -l`
111 if [ $nb -ne 4 ]; then
114 nb=`grep "^ Termination: *Verify OK" tmp/log3.out | wc -l`
115 if [ $nb -ne $nbok ]; then
116 echo "nb=${nb} nbok=${nbok}"