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 -i s/all,/all,saved,/ bin/bacula-fd.conf
19 change_jobname Client1 $JobName
22 rm -rf ${cwd}/build/accurate.new
23 rm -rf ${cwd}/build/accurate
27 mkdir ${cwd}/build/accurate
28 echo "test test" > ${cwd}/build/accurate/xxx
29 echo "test test" > ${cwd}/build/accurate/yyy
30 echo "test test" > ${cwd}/build/accurate/zzz
31 echo ${cwd}/build > ${cwd}/tmp/file-list
35 cat <<END_OF_DATA >${cwd}/tmp/bconcmds
38 label volume=TestVolume001 storage=File pool=Default
44 cat <<END_OF_DATA >${cwd}/tmp/bconcmds
45 @$out ${cwd}/tmp/log1.out
52 @$out ${cwd}/tmp/log2.out
53 restore fileset=FS_TESTJOB where=${cwd}/tmp/bacula-restores select all done
61 ################################################################
62 # First : We just run full and restore to compare if all is ok
63 ################################################################
66 check_for_zombie_jobs storage=File
71 rm -rf ${cwd}/tmp/bacula-restores
73 ################################################################
74 # Now do a second backup after making few changes
75 ################################################################
76 rm ${cwd}/build/accurate/xxx # delete a file
79 check_for_zombie_jobs storage=File
84 rm -rf ${cwd}/tmp/bacula-restores
86 ################################################################
88 ################################################################
90 ${cwd}/bin/bls -c ${cwd}/bin/bacula-sd.conf -V 'TestVolume001' FileStorage > tmp/bls.out
91 grep -- '----' tmp/bls.out | grep xxx > /dev/null
96 ################################################################
97 # Now do a third backup after making few changes
98 ################################################################
100 # some files will have disappear, others have their old mtime/ctime
101 mv ${cwd}/build/accurate ${cwd}/build/accurate.new
104 check_for_zombie_jobs storage=File
109 rm -rf ${cwd}/tmp/bacula-restores
111 ################################################################
112 # Now do an other test in differential mode
113 ################################################################
115 cat <<END_OF_DATA >${cwd}/tmp/bconcmds
116 @$out ${cwd}/tmp/log1.out
117 run job=$JobName level=differential yes
123 @$out ${cwd}/tmp/log2.out
124 restore fileset=FS_TESTJOB where=${cwd}/tmp/bacula-restores select all done
133 check_for_zombie_jobs storage=File
138 rm -rf ${cwd}/tmp/bacula-restores
140 ################################################################
141 # Now do an other test in differential mode + incremental
142 ################################################################
145 mv ${cwd}/build/accurate.new ${cwd}/build/accurate
147 cat <<END_OF_DATA >${cwd}/tmp/bconcmds
148 @$out ${cwd}/tmp/log1.out
155 @$out ${cwd}/tmp/log2.out
156 restore fileset=FS_TESTJOB where=${cwd}/tmp/bacula-restores select all done
165 check_for_zombie_jobs storage=File
170 rm -rf ${cwd}/tmp/bacula-restores
172 ################################################################
174 ################################################################
179 ./drop_bacula_tables >/dev/null 2>&1
180 ./make_bacula_tables >/dev/null 2>&1
181 ./grant_bacula_privileges >/dev/null 2>&1
184 echo "volume=TestVolume001" >tmp/bscan.bsr
186 ${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
188 cat <<END_OF_DATA >${cwd}/tmp/bconcmds
189 @$out ${cwd}/tmp/log1.out
194 @$out ${cwd}/tmp/log2.out
195 restore fileset=FS_TESTJOB where=${cwd}/tmp/bacula-restores select all done
203 # run bacula with just the restore job
206 check_for_zombie_jobs storage=File
211 rm -rf ${cwd}/tmp/bacula-restores
213 ################################################################
214 # Now do a test with other attributes (owner, gid, rights)
215 ################################################################
217 cat <<END_OF_DATA >${cwd}/tmp/bconcmds
218 @$out ${cwd}/tmp/log1.out
219 label volume=TestVolume002 storage=File pool=Default
220 run job=backup_advance yes
226 @$out ${cwd}/tmp/log2.out
227 restore fileset=FS_TESTJOB_ADVANCE where=${cwd}/tmp/bacula-restores select all done
236 check_for_zombie_jobs storage=File
241 rm -rf ${cwd}/tmp/bacula-restores
244 ################################################################
245 # Use the p option for verify
246 ################################################################
248 chmod 400 ${cwd}/build/accurate/yyy
250 cat <<END_OF_DATA >${cwd}/tmp/bconcmds
251 @$out ${cwd}/tmp/log1.out
252 run job=backup_advance yes
258 @$out ${cwd}/tmp/log2.out
259 restore fileset=FS_TESTJOB_ADVANCE where=${cwd}/tmp/bacula-restores select all done
268 check_for_zombie_jobs storage=File
273 rm -rf ${cwd}/tmp/bacula-restores
275 ################################################################
276 # Test strippath option
277 ################################################################
279 cat <<END_OF_DATA >${cwd}/tmp/bconcmds
280 @$out ${cwd}/tmp/log1.out
281 setdebug level=1 client
282 run job=backup fileset=FS_TESTJOB2 yes
285 @$out ${cwd}/tmp/log3.out
291 check_for_zombie_jobs storage=File
294 rm -f ${cwd}/build/accurate/yyy
296 check_for_zombie_jobs storage=File
298 jobid=`awk '/ Incr.+backup/ { jobid=$1 } END { print jobid }' ${cwd}/tmp/log3.out`
300 cat <<END_OF_DATA >${cwd}/tmp/bconcmds
301 @$out ${cwd}/tmp/log3.out
302 list files jobid=$jobid
308 grep yyy ${cwd}/tmp/log3.out > /dev/null
309 if [ $? != 0 ] ; then
310 print_debug "Can't find xxx file into 'list files' output (${cwd}/tmp/log3.out)"
314 if grep zzz ${cwd}/tmp/log3.out > /dev/null
316 print_debug "Can't find zzz file into 'list files' output (${cwd}/tmp/log3.out)"