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 mkdir ${cwd}/build/accurate/dirtest
30 echo "test test" > ${cwd}/build/accurate/dirtest/hello
31 echo "test test" > ${cwd}/build/accurate/xxx
32 echo "test test" > ${cwd}/build/accurate/yyy
33 echo "test test" > ${cwd}/build/accurate/zzz
34 echo "test test" > ${cwd}/build/accurate/zzzzzz
35 echo "test test" > ${cwd}/build/accurate/xxxxxx
36 echo "test test" > ${cwd}/build/accurate/yyyyyy
37 echo "test test" > ${cwd}/build/accurate/xxxxxxxxx
38 echo "test test" > ${cwd}/build/accurate/yyyyyyyyy
39 echo "test test" > ${cwd}/build/accurate/zzzzzzzzz
40 echo ${cwd}/build > ${cwd}/tmp/file-list
44 cat <<END_OF_DATA >${cwd}/tmp/bconcmds
47 label volume=TestVolume001 storage=File pool=Default
53 cat <<END_OF_DATA >${cwd}/tmp/bconcmds
54 @$out ${cwd}/tmp/log1.out
61 @$out ${cwd}/tmp/log2.out
62 restore fileset=FS_TESTJOB where=${cwd}/tmp/bacula-restores select all done
70 ################################################################
71 # First : We just run full and restore to compare if all is ok
72 ################################################################
75 check_for_zombie_jobs storage=File
80 rm -rf ${cwd}/tmp/bacula-restores
82 ################################################################
83 # Now do a second backup after making few changes
84 ################################################################
85 rm ${cwd}/build/accurate/xxx # delete a file
86 rm ${cwd}/build/accurate/dirtest/hello
89 check_for_zombie_jobs storage=File
94 rm -rf ${cwd}/tmp/bacula-restores
96 ################################################################
97 # Now do a third backup after making few changes
98 ################################################################
99 rm ${cwd}/build/accurate/yyyyyy # delete a file
100 rmdir ${cwd}/build/accurate/dirtest
103 check_for_zombie_jobs storage=File
108 rm -rf ${cwd}/tmp/bacula-restores
110 ################################################################
111 # Now do a 4 backup after making few changes
112 ################################################################
113 rm ${cwd}/build/accurate/zzzzzz # delete a file
116 check_for_zombie_jobs storage=File
121 rm -rf ${cwd}/tmp/bacula-restores
123 ################################################################
124 # Now do a 5 backup after making few changes
125 ################################################################
126 rm ${cwd}/build/accurate/zzzzzzzzz
129 check_for_zombie_jobs storage=File
134 rm -rf ${cwd}/tmp/bacula-restores
136 ################################################################
137 # Now do a backup after making few changes
138 ################################################################
139 touch ${cwd}/build/accurate/aaaaaa
142 check_for_zombie_jobs storage=File
147 rm -rf ${cwd}/tmp/bacula-restores
149 ################################################################
151 ################################################################
153 ${cwd}/bin/bls -c ${cwd}/bin/bacula-sd.conf -V 'TestVolume001' FileStorage > tmp/bls.out
154 grep -- '----' tmp/bls.out | grep xxx > /dev/null
155 if [ $? != 0 ] ; then
159 ################################################################
160 # Now do a backup after making few changes
161 ################################################################
163 # some files will have disappear, others have their old mtime/ctime
164 mv ${cwd}/build/accurate ${cwd}/build/accurate.new
167 check_for_zombie_jobs storage=File
172 rm -rf ${cwd}/tmp/bacula-restores
174 ################################################################
175 # Now do an other test in differential mode
176 ################################################################
178 cat <<END_OF_DATA >${cwd}/tmp/bconcmds
179 @$out ${cwd}/tmp/log1.out
180 run job=$JobName level=differential yes
186 @$out ${cwd}/tmp/log2.out
187 restore fileset=FS_TESTJOB where=${cwd}/tmp/bacula-restores select all done
196 check_for_zombie_jobs storage=File
201 rm -rf ${cwd}/tmp/bacula-restores
203 ################################################################
204 # Now do an other test in differential mode + incremental
205 ################################################################
208 mv ${cwd}/build/accurate.new ${cwd}/build/accurate
210 cat <<END_OF_DATA >${cwd}/tmp/bconcmds
211 @$out ${cwd}/tmp/log1.out
218 @$out ${cwd}/tmp/log2.out
219 restore fileset=FS_TESTJOB where=${cwd}/tmp/bacula-restores select all done
228 check_for_zombie_jobs storage=File
233 rm -rf ${cwd}/tmp/bacula-restores
235 ################################################################
236 # Now do a backup after making few changes
237 ################################################################
238 rm ${cwd}/build/accurate/aaaaaa
239 touch ${cwd}/build/accurate/bbbbbb
242 check_for_zombie_jobs storage=File
247 ################################################################
248 # Now do a backup after making few changes
249 ################################################################
250 mv ${cwd}/tmp/bacula-restores ${cwd}/build/accurate/
253 check_for_zombie_jobs storage=File
258 rm -rf ${cwd}/tmp/bacula-restores ${cwd}/build/accurate/bacula-restores
260 ################################################################
262 ################################################################
267 ./drop_bacula_tables >/dev/null 2>&1
268 ./make_bacula_tables >/dev/null 2>&1
269 ./grant_bacula_privileges >/dev/null 2>&1
272 echo "volume=TestVolume001" >tmp/bscan.bsr
276 ${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
278 cat <<END_OF_DATA >${cwd}/tmp/bconcmds
279 @$out ${cwd}/tmp/log1.out
284 @$out ${cwd}/tmp/log2.out
285 restore fileset=FS_TESTJOB where=${cwd}/tmp/bacula-restores select all done
293 # run bacula with just the restore job
296 check_for_zombie_jobs storage=File
301 rm -rf ${cwd}/tmp/bacula-restores
303 ################################################################
304 # Now do a test with other attributes (owner, gid, rights)
305 ################################################################
307 cat <<END_OF_DATA >${cwd}/tmp/bconcmds
308 @$out ${cwd}/tmp/log1.out
309 label volume=TestVolume002 storage=File pool=Default
310 run job=backup_advance yes
316 @$out ${cwd}/tmp/log2.out
317 restore fileset=FS_TESTJOB_ADVANCE where=${cwd}/tmp/bacula-restores select all done
326 check_for_zombie_jobs storage=File
331 rm -rf ${cwd}/tmp/bacula-restores
334 ################################################################
335 # Use the p option for verify
336 ################################################################
338 chmod 400 ${cwd}/build/accurate/yyy
340 cat <<END_OF_DATA >${cwd}/tmp/bconcmds
341 @$out ${cwd}/tmp/log1.out
342 run job=backup_advance yes
348 @$out ${cwd}/tmp/log2.out
349 restore fileset=FS_TESTJOB_ADVANCE where=${cwd}/tmp/bacula-restores select all done
358 check_for_zombie_jobs storage=File
363 rm -rf ${cwd}/tmp/bacula-restores
365 ################################################################
366 # Test strippath option
367 ################################################################
369 cat <<END_OF_DATA >${cwd}/tmp/bconcmds
370 @$out ${cwd}/tmp/log1.out
371 setdebug level=1 client=$CLIENT
372 run job=backup fileset=FS_TESTJOB2 yes
375 @$out ${cwd}/tmp/log3.out
381 check_for_zombie_jobs storage=File
384 rm -f ${cwd}/build/accurate/yyy
386 check_for_zombie_jobs storage=File
388 jobid=`awk '/ Incr.+backup/ { jobid=$1 } END { print jobid }' ${cwd}/tmp/log3.out`
390 cat <<END_OF_DATA >${cwd}/tmp/bconcmds
391 @$out ${cwd}/tmp/log3.out
392 list files jobid=$jobid
398 grep yyy ${cwd}/tmp/log3.out > /dev/null
399 if [ $? != 0 ] ; then
400 print_debug "Can't find xxx file into 'list files' output (${cwd}/tmp/log3.out)"
404 if grep zzz ${cwd}/tmp/log3.out > /dev/null
406 print_debug "Can't find zzz file into 'list files' output (${cwd}/tmp/log3.out)"