7 # Run a accurate backup of the Bacula build directory
11 TestName="accurate-test"
17 /bin/cp -f scripts/bacula-dir.conf.accurate bin/bacula-dir.conf
18 sed s/all,/all,saved,/ bin/bacula-fd.conf > tmp/1
19 cp tmp/1 bin/bacula-fd.conf
21 change_jobname Client1 $JobName
24 rm -rf ${cwd}/build/accurate.new
25 rm -rf ${cwd}/build/accurate
29 mkdir ${cwd}/build/accurate
30 mkdir ${cwd}/build/accurate/dirtest
31 echo "test test" > ${cwd}/build/accurate/dirtest/hello
32 echo "test test" > ${cwd}/build/accurate/xxx
33 echo "test test" > ${cwd}/build/accurate/yyy
34 echo "test test" > ${cwd}/build/accurate/zzz
35 echo "test test" > ${cwd}/build/accurate/zzzzzz
36 echo "test test" > ${cwd}/build/accurate/xxxxxx
37 echo "test test" > ${cwd}/build/accurate/yyyyyy
38 echo "test test" > ${cwd}/build/accurate/xxxxxxxxx
39 echo "test test" > ${cwd}/build/accurate/yyyyyyyyy
40 echo "test test" > ${cwd}/build/accurate/zzzzzzzzz
41 echo ${cwd}/build > ${cwd}/tmp/file-list
45 cat <<END_OF_DATA >${cwd}/tmp/bconcmds
48 label volume=TestVolume001 storage=File pool=Default
54 cat <<END_OF_DATA >${cwd}/tmp/bconcmds
55 @$out ${cwd}/tmp/log1.out
62 @$out ${cwd}/tmp/log2.out
63 restore fileset=FS_TESTJOB where=${cwd}/tmp/bacula-restores select all done
71 ################################################################
72 # First : We just run full and restore to compare if all is ok
73 ################################################################
76 check_for_zombie_jobs storage=File
81 rm -rf ${cwd}/tmp/bacula-restores
83 ################################################################
84 # Now do a second backup after making few changes
85 ################################################################
86 rm ${cwd}/build/accurate/xxx # delete a file
87 rm ${cwd}/build/accurate/dirtest/hello
90 check_for_zombie_jobs storage=File
94 check_files_written ${cwd}/tmp/log1.out 4
96 rm -rf ${cwd}/tmp/bacula-restores
98 ################################################################
99 # Now do a third backup after making few changes
100 ################################################################
101 rm ${cwd}/build/accurate/yyyyyy # delete a file
102 rmdir ${cwd}/build/accurate/dirtest
105 check_for_zombie_jobs storage=File
109 check_files_written ${cwd}/tmp/log1.out 3
111 rm -rf ${cwd}/tmp/bacula-restores
113 ################################################################
114 # Now do a 4 backup after making few changes
115 ################################################################
116 rm ${cwd}/build/accurate/zzzzzz # delete a file
119 check_for_zombie_jobs storage=File
123 check_files_written ${cwd}/tmp/log1.out 2
125 rm -rf ${cwd}/tmp/bacula-restores
127 ################################################################
128 # Now do a 5 backup after making few changes
129 ################################################################
130 rm ${cwd}/build/accurate/zzzzzzzzz
133 check_for_zombie_jobs storage=File
137 check_files_written ${cwd}/tmp/log1.out 2
139 rm -rf ${cwd}/tmp/bacula-restores
141 ################################################################
142 # Now do a backup after making few changes
143 ################################################################
144 touch ${cwd}/build/accurate/aaaaaa
147 check_for_zombie_jobs storage=File
151 check_files_written ${cwd}/tmp/log1.out 2
153 rm -rf ${cwd}/tmp/bacula-restores
155 ################################################################
157 ################################################################
159 ${cwd}/bin/bls -c ${cwd}/bin/bacula-sd.conf -V 'TestVolume001' FileStorage > tmp/bls.out
160 grep -- '----' tmp/bls.out | grep xxx > /dev/null
161 if [ $? != 0 ] ; then
165 ################################################################
166 # Now do a backup after making few changes
167 ################################################################
169 # some files will have disappear, others have their old mtime/ctime
170 mv ${cwd}/build/accurate ${cwd}/build/accurate.new
173 check_for_zombie_jobs storage=File
178 rm -rf ${cwd}/tmp/bacula-restores
180 ################################################################
181 # Now do an other test in differential mode
182 ################################################################
184 cat <<END_OF_DATA >${cwd}/tmp/bconcmds
185 @$out ${cwd}/tmp/log1.out
186 run job=$JobName level=differential yes
192 @$out ${cwd}/tmp/log2.out
193 restore fileset=FS_TESTJOB where=${cwd}/tmp/bacula-restores select all done
202 check_for_zombie_jobs storage=File
207 rm -rf ${cwd}/tmp/bacula-restores
209 ################################################################
210 # Now do an other test in differential mode + incremental
211 ################################################################
214 mv ${cwd}/build/accurate.new ${cwd}/build/accurate
216 cat <<END_OF_DATA >${cwd}/tmp/bconcmds
217 @$out ${cwd}/tmp/log1.out
224 @$out ${cwd}/tmp/log2.out
225 restore fileset=FS_TESTJOB where=${cwd}/tmp/bacula-restores select all done
234 check_for_zombie_jobs storage=File
239 rm -rf ${cwd}/tmp/bacula-restores
241 ################################################################
242 # Now do a backup after making few changes
243 ################################################################
244 rm ${cwd}/build/accurate/aaaaaa
245 touch ${cwd}/build/accurate/bbbbbb
248 check_for_zombie_jobs storage=File
249 check_files_written ${cwd}/tmp/log1.out 3
254 ################################################################
255 # Now do a backup after making few changes
256 ################################################################
257 mv ${cwd}/tmp/bacula-restores ${cwd}/build/accurate/
260 check_for_zombie_jobs storage=File
265 rm -rf ${cwd}/tmp/bacula-restores ${cwd}/build/accurate/bacula-restores
267 ################################################################
269 ################################################################
274 ./drop_bacula_tables >/dev/null 2>&1
275 ./make_bacula_tables >/dev/null 2>&1
276 ./grant_bacula_privileges >/dev/null 2>&1
279 echo "volume=TestVolume001" >tmp/bscan.bsr
283 ${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
285 cat <<END_OF_DATA >${cwd}/tmp/bconcmds
286 @$out ${cwd}/tmp/log1.out
291 @$out ${cwd}/tmp/log2.out
292 restore fileset=FS_TESTJOB where=${cwd}/tmp/bacula-restores select all done
300 # run bacula with just the restore job
303 check_for_zombie_jobs storage=File
308 rm -rf ${cwd}/tmp/bacula-restores
310 ################################################################
311 # Now do a test with other attributes (owner, gid, rights)
312 ################################################################
314 cat <<END_OF_DATA >${cwd}/tmp/bconcmds
315 @$out ${cwd}/tmp/log1.out
316 label volume=TestVolume002 storage=File pool=Default
317 run job=backup_advance yes
323 @$out ${cwd}/tmp/log2.out
324 restore fileset=FS_TESTJOB_ADVANCE where=${cwd}/tmp/bacula-restores select all done
333 check_for_zombie_jobs storage=File
338 rm -rf ${cwd}/tmp/bacula-restores
341 ################################################################
342 # Use the p option for verify
343 ################################################################
345 chmod 400 ${cwd}/build/accurate/yyy
347 cat <<END_OF_DATA >${cwd}/tmp/bconcmds
348 @$out ${cwd}/tmp/log1.out
349 run job=backup_advance yes
355 @$out ${cwd}/tmp/log2.out
356 restore fileset=FS_TESTJOB_ADVANCE where=${cwd}/tmp/bacula-restores select all done
365 check_for_zombie_jobs storage=File
369 check_files_written ${cwd}/tmp/log1.out 1
371 rm -rf ${cwd}/tmp/bacula-restores
373 ################################################################
374 # Test strippath option
375 ################################################################
377 cat <<END_OF_DATA >${cwd}/tmp/bconcmds
378 @$out ${cwd}/tmp/log1.out
379 setdebug level=1 client=$CLIENT
380 run job=backup fileset=FS_TESTJOB2 yes
383 @$out ${cwd}/tmp/log3.out
389 check_for_zombie_jobs storage=File
392 rm -f ${cwd}/build/accurate/yyy
394 check_for_zombie_jobs storage=File
396 jobid=`awk '/ Incr.+backup/ { jobid=$1 } END { print jobid }' ${cwd}/tmp/log3.out`
398 cat <<END_OF_DATA >${cwd}/tmp/bconcmds
399 @$out ${cwd}/tmp/log3.out
400 list files jobid=$jobid
406 grep yyy ${cwd}/tmp/log3.out > /dev/null
407 if [ $? != 0 ] ; then
408 print_debug "Can't find yyy file into 'list files' output (${cwd}/tmp/log3.out)"
412 if grep zzz ${cwd}/tmp/log3.out > /dev/null
414 print_debug "Can't find zzz file into 'list files' output (${cwd}/tmp/log3.out)"