7 # Run a accurate backup of the Bacula build directory
11 TestName="accurate-test"
17 cp -f $rscripts/bacula-dir.conf.accurate $conf/bacula-dir.conf
18 sed s/all,/all,saved,/ $conf/bacula-fd.conf > tmp/1
19 cp tmp/1 $conf/bacula-fd.conf
21 change_jobname BackupClient1 $JobName
24 echo "##############################################" >> ${cwd}/tmp/log1.out
25 echo "$*" >> ${cwd}/tmp/log1.out
26 echo "##############################################" >> ${cwd}/tmp/log2.out
27 echo "$*" >> ${cwd}/tmp/log2.out
31 rm -rf ${cwd}/build/accurate.new
32 rm -rf ${cwd}/build/accurate
36 mkdir -p ${cwd}/build/accurate
37 mkdir -p ${cwd}/build/accurate/dirtest
38 echo "test test" > ${cwd}/build/accurate/dirtest/hello
39 echo "test test" > ${cwd}/build/accurate/xxx
40 echo "test test" > ${cwd}/build/accurate/yyy
41 echo "test test" > ${cwd}/build/accurate/zzz
42 echo "test test" > ${cwd}/build/accurate/zzzzzz
43 echo "test test" > ${cwd}/build/accurate/xxxxxx
44 echo "test test" > ${cwd}/build/accurate/yyyyyy
45 echo "test test" > ${cwd}/build/accurate/xxxxxxxxx
46 echo "test test" > ${cwd}/build/accurate/yyyyyyyyy
47 echo "test test" > ${cwd}/build/accurate/zzzzzzzzz
48 echo ${cwd}/build > ${cwd}/tmp/file-list
52 cat <<END_OF_DATA >${cwd}/tmp/bconcmds
55 label volume=TestVolume001 storage=File pool=Default
61 cat <<END_OF_DATA >${cwd}/tmp/bconcmds
62 @$out ${cwd}/tmp/log1.out
69 @$out ${cwd}/tmp/log2.out
70 setdebug level=10 storage=File
71 restore fileset=FS_TESTJOB where=${cwd}/tmp/bacula-restores select all done
78 ################################################################
79 p First : We just run full and restore to compare if all is ok
80 ################################################################
83 check_for_zombie_jobs storage=File
88 rm -rf ${cwd}/tmp/bacula-restores
90 ################################################################
91 p Now do a second backup after making few changes
92 ################################################################
93 rm ${cwd}/build/accurate/xxx # delete a file
94 rm ${cwd}/build/accurate/dirtest/hello
97 check_for_zombie_jobs storage=File
101 check_files_written ${cwd}/tmp/log1.out 4
103 rm -rf ${cwd}/tmp/bacula-restores
105 ################################################################
106 p Now do a third backup after making few changes
107 ################################################################
108 rm ${cwd}/build/accurate/yyyyyy # delete a file
109 rmdir ${cwd}/build/accurate/dirtest
112 check_for_zombie_jobs storage=File
116 check_files_written ${cwd}/tmp/log1.out 3
118 rm -rf ${cwd}/tmp/bacula-restores
120 ################################################################
121 p Now do a 4 backup after making few changes
122 ################################################################
123 rm ${cwd}/build/accurate/zzzzzz # delete a file
126 check_for_zombie_jobs storage=File
130 check_files_written ${cwd}/tmp/log1.out 2
132 rm -rf ${cwd}/tmp/bacula-restores
134 ################################################################
135 p Now do a 5 backup after making few changes
136 ################################################################
137 rm ${cwd}/build/accurate/zzzzzzzzz
140 check_for_zombie_jobs storage=File
144 check_files_written ${cwd}/tmp/log1.out 2
146 rm -rf ${cwd}/tmp/bacula-restores
148 ################################################################
149 p Now do a backup after making few changes
150 ################################################################
151 touch ${cwd}/build/accurate/aaaaaa
154 check_for_zombie_jobs storage=File
158 check_files_written ${cwd}/tmp/log1.out 2
160 rm -rf ${cwd}/tmp/bacula-restores
162 ################################################################
164 ################################################################
166 $bin/bls -c $conf/bacula-sd.conf -V 'TestVolume001' FileStorage > $tmp/bls.out
167 grep -- '----' $tmp/bls.out | grep xxx > /dev/null
168 if [ $? != 0 ] ; then
169 print_debug "ERROR: Should find deleted files into $tmp/bls.out"
173 ################################################################
174 p Now do a backup after making few changes
175 ################################################################
177 # some files will have disappear, others have their old mtime/ctime
178 mv ${cwd}/build/accurate ${cwd}/build/accurate.new
181 check_for_zombie_jobs storage=File
186 rm -rf ${cwd}/tmp/bacula-restores
188 ################################################################
189 p Now do an other test in differential mode
190 ################################################################
192 cat <<END_OF_DATA >${cwd}/tmp/bconcmds
193 @$out ${cwd}/tmp/log1.out
194 run job=$JobName level=differential yes
200 @$out ${cwd}/tmp/log2.out
201 setdebug level=10 storage=File
202 restore fileset=FS_TESTJOB where=${cwd}/tmp/bacula-restores select all done
210 check_for_zombie_jobs storage=File
215 rm -rf ${cwd}/tmp/bacula-restores
217 ################################################################
218 p Now do an other test in differential mode + incremental
219 ################################################################
222 mv ${cwd}/build/accurate.new ${cwd}/build/accurate
224 cat <<END_OF_DATA >${cwd}/tmp/bconcmds
225 @$out ${cwd}/tmp/log1.out
232 @$out ${cwd}/tmp/log2.out
233 setdebug level=10 storage=File
234 restore fileset=FS_TESTJOB where=${cwd}/tmp/bacula-restores select all done
242 check_for_zombie_jobs storage=File
247 rm -rf ${cwd}/tmp/bacula-restores
249 ################################################################
250 p Now do a backup after making few changes
251 ################################################################
252 rm ${cwd}/build/accurate/aaaaaa
253 touch ${cwd}/build/accurate/bbbbbb
256 check_for_zombie_jobs storage=File
257 check_files_written ${cwd}/tmp/log1.out 3
262 ################################################################
263 p Now do a backup after making few changes
264 ################################################################
265 mv ${cwd}/tmp/bacula-restores ${cwd}/build/accurate/
268 check_for_zombie_jobs storage=File
273 rm -rf ${cwd}/tmp/bacula-restores ${cwd}/build/accurate/bacula-restores
275 ################################################################
277 ################################################################
282 ./drop_bacula_tables >/dev/null 2>&1
283 ./make_bacula_tables >/dev/null 2>&1
284 ./grant_bacula_privileges >/dev/null 2>&1
287 echo "volume=TestVolume001" >tmp/bscan.bsr
291 $bin/bscan -c $conf/bacula-sd.conf $BSCANLIBDBI -n regress -u regress -m -s -b $tmp/bscan.bsr FileStorage 2>&1 > $tmp/bscan.log
293 cat <<END_OF_DATA >${cwd}/tmp/bconcmds
294 @$out ${cwd}/tmp/log1.out
297 @# now do a restore after bscan
299 @$out ${cwd}/tmp/log2.out
300 setdebug level=10 storage=File
301 restore fileset=FS_TESTJOB where=${cwd}/tmp/bacula-restores select all done
308 # run bacula with just the restore job
311 check_for_zombie_jobs storage=File
316 rm -rf ${cwd}/tmp/bacula-restores
318 ################################################################
319 p Now do a test with other attributes: owner, gid, rights
320 ################################################################
322 cat <<END_OF_DATA >${cwd}/tmp/bconcmds
323 @$out ${cwd}/tmp/log1.out
324 label volume=TestVolume002 storage=File pool=Default
325 run job=backup_advance yes
331 @$out ${cwd}/tmp/log2.out
332 setdebug level=10 storage=File
333 restore fileset=FS_TESTJOB_ADVANCE where=${cwd}/tmp/bacula-restores select all done
341 check_for_zombie_jobs storage=File
346 rm -rf ${cwd}/tmp/bacula-restores
349 ################################################################
350 p Use the p option for verify
351 ################################################################
353 chmod 400 ${cwd}/build/accurate/yyy
355 cat <<END_OF_DATA >${cwd}/tmp/bconcmds
356 @$out ${cwd}/tmp/log1.out
357 run job=backup_advance yes
363 @$out ${cwd}/tmp/log2.out
364 setdebug level=10 storage=File
365 restore fileset=FS_TESTJOB_ADVANCE where=${cwd}/tmp/bacula-restores select all done
373 check_for_zombie_jobs storage=File
377 check_files_written ${cwd}/tmp/log1.out 1
379 rm -rf ${cwd}/tmp/bacula-restores
381 ################################################################
382 p Test strippath option
383 ################################################################
385 cat <<END_OF_DATA >${cwd}/tmp/bconcmds
386 @$out ${cwd}/tmp/log1.out
387 setdebug level=1 client=$CLIENT
388 run job=backup fileset=FS_TESTJOB2 yes
391 @$out ${cwd}/tmp/log3.out
397 check_for_zombie_jobs storage=File
400 rm -f ${cwd}/build/accurate/yyy
402 check_for_zombie_jobs storage=File
404 jobid=`awk '/ Incr.+backup/ { jobid=$1 } END { print jobid }' ${cwd}/tmp/log3.out`
406 cat <<END_OF_DATA >${cwd}/tmp/bconcmds
407 @$out ${cwd}/tmp/log3.out
408 list files jobid=$jobid
414 grep yyy ${cwd}/tmp/log3.out > /dev/null
415 if [ $? != 0 ] ; then
416 print_debug "ERROR: Can't find yyy file into 'list files' output (${cwd}/tmp/log3.out)"
420 grep zzz ${cwd}/tmp/log3.out > /dev/null
422 print_debug "ERROR: Should not find zzz file into 'list files' output (${cwd}/tmp/log3.out)"