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
270 ${cwd}/bin/bscan -c ${cwd}/bin/bacula-sd.conf -n regress -u regress -m -s -b tmp/bscan.bsr FileStorage 2>&1 > ${cwd}/tmp/bscan.log
272 cat <<END_OF_DATA >${cwd}/tmp/bconcmds
273 @$out ${cwd}/tmp/log1.out
278 @$out ${cwd}/tmp/log2.out
279 restore fileset=FS_TESTJOB where=${cwd}/tmp/bacula-restores select all done
287 # run bacula with just the restore job
290 check_for_zombie_jobs storage=File
295 rm -rf ${cwd}/tmp/bacula-restores
297 ################################################################
298 # Now do a test with other attributes (owner, gid, rights)
299 ################################################################
301 cat <<END_OF_DATA >${cwd}/tmp/bconcmds
302 @$out ${cwd}/tmp/log1.out
303 label volume=TestVolume002 storage=File pool=Default
304 run job=backup_advance yes
310 @$out ${cwd}/tmp/log2.out
311 restore fileset=FS_TESTJOB_ADVANCE where=${cwd}/tmp/bacula-restores select all done
320 check_for_zombie_jobs storage=File
325 rm -rf ${cwd}/tmp/bacula-restores
328 ################################################################
329 # Use the p option for verify
330 ################################################################
332 chmod 400 ${cwd}/build/accurate/yyy
334 cat <<END_OF_DATA >${cwd}/tmp/bconcmds
335 @$out ${cwd}/tmp/log1.out
336 run job=backup_advance yes
342 @$out ${cwd}/tmp/log2.out
343 restore fileset=FS_TESTJOB_ADVANCE where=${cwd}/tmp/bacula-restores select all done
352 check_for_zombie_jobs storage=File
357 rm -rf ${cwd}/tmp/bacula-restores
359 ################################################################
360 # Test strippath option
361 ################################################################
363 cat <<END_OF_DATA >${cwd}/tmp/bconcmds
364 @$out ${cwd}/tmp/log1.out
365 setdebug level=1 client
366 run job=backup fileset=FS_TESTJOB2 yes
369 @$out ${cwd}/tmp/log3.out
375 check_for_zombie_jobs storage=File
378 rm -f ${cwd}/build/accurate/yyy
380 check_for_zombie_jobs storage=File
382 jobid=`awk '/ Incr.+backup/ { jobid=$1 } END { print jobid }' ${cwd}/tmp/log3.out`
384 cat <<END_OF_DATA >${cwd}/tmp/bconcmds
385 @$out ${cwd}/tmp/log3.out
386 list files jobid=$jobid
392 grep yyy ${cwd}/tmp/log3.out > /dev/null
393 if [ $? != 0 ] ; then
394 print_debug "Can't find xxx file into 'list files' output (${cwd}/tmp/log3.out)"
398 if grep zzz ${cwd}/tmp/log3.out > /dev/null
400 print_debug "Can't find zzz file into 'list files' output (${cwd}/tmp/log3.out)"