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 setdebug level=10 storage=File
64 restore fileset=FS_TESTJOB where=${cwd}/tmp/bacula-restores select all done
72 ################################################################
73 # First : We just run full and restore to compare if all is ok
74 ################################################################
77 check_for_zombie_jobs storage=File
82 rm -rf ${cwd}/tmp/bacula-restores
84 ################################################################
85 # Now do a second backup after making few changes
86 ################################################################
87 rm ${cwd}/build/accurate/xxx # delete a file
88 rm ${cwd}/build/accurate/dirtest/hello
91 check_for_zombie_jobs storage=File
95 check_files_written ${cwd}/tmp/log1.out 4
97 rm -rf ${cwd}/tmp/bacula-restores
99 ################################################################
100 # Now do a third backup after making few changes
101 ################################################################
102 rm ${cwd}/build/accurate/yyyyyy # delete a file
103 rmdir ${cwd}/build/accurate/dirtest
106 check_for_zombie_jobs storage=File
110 check_files_written ${cwd}/tmp/log1.out 3
112 rm -rf ${cwd}/tmp/bacula-restores
114 ################################################################
115 # Now do a 4 backup after making few changes
116 ################################################################
117 rm ${cwd}/build/accurate/zzzzzz # delete a file
120 check_for_zombie_jobs storage=File
124 check_files_written ${cwd}/tmp/log1.out 2
126 rm -rf ${cwd}/tmp/bacula-restores
128 ################################################################
129 # Now do a 5 backup after making few changes
130 ################################################################
131 rm ${cwd}/build/accurate/zzzzzzzzz
134 check_for_zombie_jobs storage=File
138 check_files_written ${cwd}/tmp/log1.out 2
140 rm -rf ${cwd}/tmp/bacula-restores
142 ################################################################
143 # Now do a backup after making few changes
144 ################################################################
145 touch ${cwd}/build/accurate/aaaaaa
148 check_for_zombie_jobs storage=File
152 check_files_written ${cwd}/tmp/log1.out 2
154 rm -rf ${cwd}/tmp/bacula-restores
156 ################################################################
158 ################################################################
160 ${cwd}/bin/bls -c ${cwd}/bin/bacula-sd.conf -V 'TestVolume001' FileStorage > tmp/bls.out
161 grep -- '----' tmp/bls.out | grep xxx > /dev/null
162 if [ $? != 0 ] ; then
166 ################################################################
167 # Now do a backup after making few changes
168 ################################################################
170 # some files will have disappear, others have their old mtime/ctime
171 mv ${cwd}/build/accurate ${cwd}/build/accurate.new
174 check_for_zombie_jobs storage=File
179 rm -rf ${cwd}/tmp/bacula-restores
181 ################################################################
182 # Now do an other test in differential mode
183 ################################################################
185 cat <<END_OF_DATA >${cwd}/tmp/bconcmds
186 @$out ${cwd}/tmp/log1.out
187 run job=$JobName level=differential yes
193 @$out ${cwd}/tmp/log2.out
194 setdebug level=10 storage=File
195 restore fileset=FS_TESTJOB where=${cwd}/tmp/bacula-restores select all done
204 check_for_zombie_jobs storage=File
209 rm -rf ${cwd}/tmp/bacula-restores
211 ################################################################
212 # Now do an other test in differential mode + incremental
213 ################################################################
216 mv ${cwd}/build/accurate.new ${cwd}/build/accurate
218 cat <<END_OF_DATA >${cwd}/tmp/bconcmds
219 @$out ${cwd}/tmp/log1.out
226 @$out ${cwd}/tmp/log2.out
227 setdebug level=10 storage=File
228 restore fileset=FS_TESTJOB where=${cwd}/tmp/bacula-restores select all done
237 check_for_zombie_jobs storage=File
242 rm -rf ${cwd}/tmp/bacula-restores
244 ################################################################
245 # Now do a backup after making few changes
246 ################################################################
247 rm ${cwd}/build/accurate/aaaaaa
248 touch ${cwd}/build/accurate/bbbbbb
251 check_for_zombie_jobs storage=File
252 check_files_written ${cwd}/tmp/log1.out 3
257 ################################################################
258 # Now do a backup after making few changes
259 ################################################################
260 mv ${cwd}/tmp/bacula-restores ${cwd}/build/accurate/
263 check_for_zombie_jobs storage=File
268 rm -rf ${cwd}/tmp/bacula-restores ${cwd}/build/accurate/bacula-restores
270 ################################################################
272 ################################################################
277 ./drop_bacula_tables >/dev/null 2>&1
278 ./make_bacula_tables >/dev/null 2>&1
279 ./grant_bacula_privileges >/dev/null 2>&1
282 echo "volume=TestVolume001" >tmp/bscan.bsr
286 ${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
288 cat <<END_OF_DATA >${cwd}/tmp/bconcmds
289 @$out ${cwd}/tmp/log1.out
294 @$out ${cwd}/tmp/log2.out
295 setdebug level=10 storage=File
296 restore fileset=FS_TESTJOB where=${cwd}/tmp/bacula-restores select all done
304 # run bacula with just the restore job
307 check_for_zombie_jobs storage=File
312 rm -rf ${cwd}/tmp/bacula-restores
314 ################################################################
315 # Now do a test with other attributes (owner, gid, rights)
316 ################################################################
318 cat <<END_OF_DATA >${cwd}/tmp/bconcmds
319 @$out ${cwd}/tmp/log1.out
320 label volume=TestVolume002 storage=File pool=Default
321 run job=backup_advance yes
327 @$out ${cwd}/tmp/log2.out
328 setdebug level=10 storage=File
329 restore fileset=FS_TESTJOB_ADVANCE where=${cwd}/tmp/bacula-restores select all done
338 check_for_zombie_jobs storage=File
343 rm -rf ${cwd}/tmp/bacula-restores
346 ################################################################
347 # Use the p option for verify
348 ################################################################
350 chmod 400 ${cwd}/build/accurate/yyy
352 cat <<END_OF_DATA >${cwd}/tmp/bconcmds
353 @$out ${cwd}/tmp/log1.out
354 run job=backup_advance yes
360 @$out ${cwd}/tmp/log2.out
361 setdebug level=10 storage=File
362 restore fileset=FS_TESTJOB_ADVANCE where=${cwd}/tmp/bacula-restores select all done
371 check_for_zombie_jobs storage=File
375 check_files_written ${cwd}/tmp/log1.out 1
377 rm -rf ${cwd}/tmp/bacula-restores
379 ################################################################
380 # Test strippath option
381 ################################################################
383 cat <<END_OF_DATA >${cwd}/tmp/bconcmds
384 @$out ${cwd}/tmp/log1.out
385 setdebug level=1 client=$CLIENT
386 run job=backup fileset=FS_TESTJOB2 yes
389 @$out ${cwd}/tmp/log3.out
395 check_for_zombie_jobs storage=File
398 rm -f ${cwd}/build/accurate/yyy
400 check_for_zombie_jobs storage=File
402 jobid=`awk '/ Incr.+backup/ { jobid=$1 } END { print jobid }' ${cwd}/tmp/log3.out`
404 cat <<END_OF_DATA >${cwd}/tmp/bconcmds
405 @$out ${cwd}/tmp/log3.out
406 list files jobid=$jobid
412 grep yyy ${cwd}/tmp/log3.out > /dev/null
413 if [ $? != 0 ] ; then
414 print_debug "Can't find yyy file into 'list files' output (${cwd}/tmp/log3.out)"
418 if grep zzz ${cwd}/tmp/log3.out > /dev/null
420 print_debug "Can't find zzz file into 'list files' output (${cwd}/tmp/log3.out)"