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
172 ################################################################
173 p Now do a backup after making few changes
174 ################################################################
176 # some files will have disappear, others have their old mtime/ctime
177 mv ${cwd}/build/accurate ${cwd}/build/accurate.new
180 check_for_zombie_jobs storage=File
185 rm -rf ${cwd}/tmp/bacula-restores
187 ################################################################
188 p Now do an other test in differential mode
189 ################################################################
191 cat <<END_OF_DATA >${cwd}/tmp/bconcmds
192 @$out ${cwd}/tmp/log1.out
193 run job=$JobName level=differential yes
199 @$out ${cwd}/tmp/log2.out
200 setdebug level=10 storage=File
201 restore fileset=FS_TESTJOB where=${cwd}/tmp/bacula-restores select all done
209 check_for_zombie_jobs storage=File
214 rm -rf ${cwd}/tmp/bacula-restores
216 ################################################################
217 p Now do an other test in differential mode + incremental
218 ################################################################
221 mv ${cwd}/build/accurate.new ${cwd}/build/accurate
223 cat <<END_OF_DATA >${cwd}/tmp/bconcmds
224 @$out ${cwd}/tmp/log1.out
231 @$out ${cwd}/tmp/log2.out
232 setdebug level=10 storage=File
233 restore fileset=FS_TESTJOB where=${cwd}/tmp/bacula-restores select all done
241 check_for_zombie_jobs storage=File
246 rm -rf ${cwd}/tmp/bacula-restores
248 ################################################################
249 p Now do a backup after making few changes
250 ################################################################
251 rm ${cwd}/build/accurate/aaaaaa
252 touch ${cwd}/build/accurate/bbbbbb
255 check_for_zombie_jobs storage=File
256 check_files_written ${cwd}/tmp/log1.out 3
261 ################################################################
262 p Now do a backup after making few changes
263 ################################################################
264 mv ${cwd}/tmp/bacula-restores ${cwd}/build/accurate/
267 check_for_zombie_jobs storage=File
272 rm -rf ${cwd}/tmp/bacula-restores ${cwd}/build/accurate/bacula-restores
274 ################################################################
276 ################################################################
281 ./drop_bacula_tables >/dev/null 2>&1
282 ./make_bacula_tables >/dev/null 2>&1
283 ./grant_bacula_privileges >/dev/null 2>&1
286 echo "volume=TestVolume001" >tmp/bscan.bsr
290 $bin/bscan -c $conf/bacula-sd.conf $BSCANLIBDBI -n regress -u regress -m -s -b $tmp/bscan.bsr FileStorage 2>&1 > $tmp/bscan.log
292 cat <<END_OF_DATA >${cwd}/tmp/bconcmds
293 @$out ${cwd}/tmp/log1.out
296 @# now do a restore after bscan
298 @$out ${cwd}/tmp/log2.out
299 setdebug level=10 storage=File
300 restore fileset=FS_TESTJOB where=${cwd}/tmp/bacula-restores select all done
307 # run bacula with just the restore job
310 check_for_zombie_jobs storage=File
315 rm -rf ${cwd}/tmp/bacula-restores
317 ################################################################
318 p Now do a test with other attributes: owner, gid, rights
319 ################################################################
321 cat <<END_OF_DATA >${cwd}/tmp/bconcmds
322 @$out ${cwd}/tmp/log1.out
323 label volume=TestVolume002 storage=File pool=Default
324 run job=backup_advance yes
330 @$out ${cwd}/tmp/log2.out
331 setdebug level=10 storage=File
332 restore fileset=FS_TESTJOB_ADVANCE where=${cwd}/tmp/bacula-restores select all done
340 check_for_zombie_jobs storage=File
345 rm -rf ${cwd}/tmp/bacula-restores
348 ################################################################
349 p Use the p option for verify
350 ################################################################
352 chmod 400 ${cwd}/build/accurate/yyy
354 cat <<END_OF_DATA >${cwd}/tmp/bconcmds
355 @$out ${cwd}/tmp/log1.out
356 run job=backup_advance yes
362 @$out ${cwd}/tmp/log2.out
363 setdebug level=10 storage=File
364 restore fileset=FS_TESTJOB_ADVANCE where=${cwd}/tmp/bacula-restores select all done
372 check_for_zombie_jobs storage=File
376 check_files_written ${cwd}/tmp/log1.out 1
378 rm -rf ${cwd}/tmp/bacula-restores
380 ################################################################
381 p Test strippath option
382 ################################################################
384 cat <<END_OF_DATA >${cwd}/tmp/bconcmds
385 @$out ${cwd}/tmp/log1.out
386 setdebug level=1 client=$CLIENT
387 run job=backup fileset=FS_TESTJOB2 yes
390 @$out ${cwd}/tmp/log3.out
396 check_for_zombie_jobs storage=File
399 rm -f ${cwd}/build/accurate/yyy
401 check_for_zombie_jobs storage=File
403 jobid=`awk '/ Incr.+backup/ { jobid=$1 } END { print jobid }' ${cwd}/tmp/log3.out`
405 cat <<END_OF_DATA >${cwd}/tmp/bconcmds
406 @$out ${cwd}/tmp/log3.out
407 list files jobid=$jobid
413 grep yyy ${cwd}/tmp/log3.out > /dev/null
414 if [ $? != 0 ] ; then
415 print_debug "Can't find yyy file into 'list files' output (${cwd}/tmp/log3.out)"
419 if grep zzz ${cwd}/tmp/log3.out > /dev/null
421 print_debug "Can't find zzz file into 'list files' output (${cwd}/tmp/log3.out)"