7 # Run a accurate backup of the Bacula build directory
10 TestName="accurate-test"
16 /bin/cp -f scripts/bacula-dir.conf.accurate bin/bacula-dir.conf
17 sed s/all,/all,saved,/ bin/bacula-fd.conf > tmp/1
18 cp tmp/1 bin/bacula-fd.conf
20 change_jobname Client1 $JobName
23 rm -rf ${cwd}/build/accurate.new
24 rm -rf ${cwd}/build/accurate
28 mkdir ${cwd}/build/accurate
29 echo "test test" > ${cwd}/build/accurate/xxx
30 echo "test test" > ${cwd}/build/accurate/yyy
31 echo "test test" > ${cwd}/build/accurate/zzz
32 echo "test test" > ${cwd}/build/accurate/zzzzzz
33 echo "test test" > ${cwd}/build/accurate/xxxxxx
34 echo "test test" > ${cwd}/build/accurate/yyyyyy
35 echo "test test" > ${cwd}/build/accurate/xxxxxxxxx
36 echo "test test" > ${cwd}/build/accurate/yyyyyyyyy
37 echo "test test" > ${cwd}/build/accurate/zzzzzzzzz
38 echo ${cwd}/build > ${cwd}/tmp/file-list
42 cat <<END_OF_DATA >${cwd}/tmp/bconcmds
45 label volume=TestVolume001 storage=File pool=Default
51 cat <<END_OF_DATA >${cwd}/tmp/bconcmds
52 @$out ${cwd}/tmp/log1.out
59 @$out ${cwd}/tmp/log2.out
60 restore fileset=FS_TESTJOB where=${cwd}/tmp/bacula-restores select all done
68 ################################################################
69 # First : We just run full and restore to compare if all is ok
70 ################################################################
73 check_for_zombie_jobs storage=File
78 rm -rf ${cwd}/tmp/bacula-restores
80 ################################################################
81 # Now do a second backup after making few changes
82 ################################################################
83 rm ${cwd}/build/accurate/xxx # delete a file
86 check_for_zombie_jobs storage=File
91 rm -rf ${cwd}/tmp/bacula-restores
93 ################################################################
94 # Now do a third backup after making few changes
95 ################################################################
96 rm ${cwd}/build/accurate/yyyyyy # delete a file
99 check_for_zombie_jobs storage=File
104 rm -rf ${cwd}/tmp/bacula-restores
106 ################################################################
107 # Now do a 4 backup after making few changes
108 ################################################################
109 rm ${cwd}/build/accurate/zzzzzz # delete a file
112 check_for_zombie_jobs storage=File
117 rm -rf ${cwd}/tmp/bacula-restores
119 ################################################################
120 # Now do a 5 backup after making few changes
121 ################################################################
122 rm ${cwd}/build/accurate/zzzzzzzzz
125 check_for_zombie_jobs storage=File
130 rm -rf ${cwd}/tmp/bacula-restores
132 ################################################################
133 # Now do a backup after making few changes
134 ################################################################
135 touch ${cwd}/build/accurate/aaaaaa
138 check_for_zombie_jobs storage=File
143 rm -rf ${cwd}/tmp/bacula-restores
145 ################################################################
147 ################################################################
149 ${cwd}/bin/bls -c ${cwd}/bin/bacula-sd.conf -V 'TestVolume001' FileStorage > tmp/bls.out
150 grep -- '----' tmp/bls.out | grep xxx > /dev/null
151 if [ $? != 0 ] ; then
155 ################################################################
156 # Now do a backup after making few changes
157 ################################################################
159 # some files will have disappear, others have their old mtime/ctime
160 mv ${cwd}/build/accurate ${cwd}/build/accurate.new
163 check_for_zombie_jobs storage=File
168 rm -rf ${cwd}/tmp/bacula-restores
170 ################################################################
171 # Now do an other test in differential mode
172 ################################################################
174 cat <<END_OF_DATA >${cwd}/tmp/bconcmds
175 @$out ${cwd}/tmp/log1.out
176 run job=$JobName level=differential yes
182 @$out ${cwd}/tmp/log2.out
183 restore fileset=FS_TESTJOB where=${cwd}/tmp/bacula-restores select all done
192 check_for_zombie_jobs storage=File
197 rm -rf ${cwd}/tmp/bacula-restores
199 ################################################################
200 # Now do an other test in differential mode + incremental
201 ################################################################
204 mv ${cwd}/build/accurate.new ${cwd}/build/accurate
206 cat <<END_OF_DATA >${cwd}/tmp/bconcmds
207 @$out ${cwd}/tmp/log1.out
214 @$out ${cwd}/tmp/log2.out
215 restore fileset=FS_TESTJOB where=${cwd}/tmp/bacula-restores select all done
224 check_for_zombie_jobs storage=File
229 rm -rf ${cwd}/tmp/bacula-restores
231 ################################################################
232 # Now do a backup after making few changes
233 ################################################################
234 rm ${cwd}/build/accurate/aaaaaa
235 touch ${cwd}/build/accurate/bbbbbb
238 check_for_zombie_jobs storage=File
243 ################################################################
244 # Now do a backup after making few changes
245 ################################################################
246 mv ${cwd}/tmp/bacula-restores ${cwd}/build/accurate/
249 check_for_zombie_jobs storage=File
254 rm -rf ${cwd}/tmp/bacula-restores ${cwd}/build/accurate/bacula-restores
256 ################################################################
258 ################################################################
263 ./drop_bacula_tables >/dev/null 2>&1
264 ./make_bacula_tables >/dev/null 2>&1
265 ./grant_bacula_privileges >/dev/null 2>&1
268 echo "volume=TestVolume001" >tmp/bscan.bsr
272 ${cwd}/bin/bscan -c ${cwd}/bin/bacula-sd.conf $BSCANLIBDBI -n regress -u regress -m -s -b tmp/bscan.bsr FileStorage 2>&1 > ${cwd}/tmp/bscan.log
274 cat <<END_OF_DATA >${cwd}/tmp/bconcmds
275 @$out ${cwd}/tmp/log1.out
280 @$out ${cwd}/tmp/log2.out
281 restore fileset=FS_TESTJOB where=${cwd}/tmp/bacula-restores select all done
289 # run bacula with just the restore job
292 check_for_zombie_jobs storage=File
297 rm -rf ${cwd}/tmp/bacula-restores
299 ################################################################
300 # Now do a test with other attributes (owner, gid, rights)
301 ################################################################
303 cat <<END_OF_DATA >${cwd}/tmp/bconcmds
304 @$out ${cwd}/tmp/log1.out
305 label volume=TestVolume002 storage=File pool=Default
306 run job=backup_advance yes
312 @$out ${cwd}/tmp/log2.out
313 restore fileset=FS_TESTJOB_ADVANCE where=${cwd}/tmp/bacula-restores select all done
322 check_for_zombie_jobs storage=File
327 rm -rf ${cwd}/tmp/bacula-restores
330 ################################################################
331 # Use the p option for verify
332 ################################################################
334 chmod 400 ${cwd}/build/accurate/yyy
336 cat <<END_OF_DATA >${cwd}/tmp/bconcmds
337 @$out ${cwd}/tmp/log1.out
338 run job=backup_advance yes
344 @$out ${cwd}/tmp/log2.out
345 restore fileset=FS_TESTJOB_ADVANCE where=${cwd}/tmp/bacula-restores select all done
354 check_for_zombie_jobs storage=File
359 rm -rf ${cwd}/tmp/bacula-restores
361 ################################################################
362 # Test strippath option
363 ################################################################
365 cat <<END_OF_DATA >${cwd}/tmp/bconcmds
366 @$out ${cwd}/tmp/log1.out
367 setdebug level=1 client=$CLIENT
368 run job=backup fileset=FS_TESTJOB2 yes
371 @$out ${cwd}/tmp/log3.out
377 check_for_zombie_jobs storage=File
380 rm -f ${cwd}/build/accurate/yyy
382 check_for_zombie_jobs storage=File
384 jobid=`awk '/ Incr.+backup/ { jobid=$1 } END { print jobid }' ${cwd}/tmp/log3.out`
386 cat <<END_OF_DATA >${cwd}/tmp/bconcmds
387 @$out ${cwd}/tmp/log3.out
388 list files jobid=$jobid
394 grep yyy ${cwd}/tmp/log3.out > /dev/null
395 if [ $? != 0 ] ; then
396 print_debug "Can't find xxx file into 'list files' output (${cwd}/tmp/log3.out)"
400 if grep zzz ${cwd}/tmp/log3.out > /dev/null
402 print_debug "Can't find zzz file into 'list files' output (${cwd}/tmp/log3.out)"