change_jobname NightlySave $JobName
start_test
+# Create list of files being backed up and verified to compare afterwards
+files_listing=${cwd}/tmp/files
+find ${cwd}/build -print > ${files_listing}
+
cat <<END_OF_DATA >tmp/bconcmds
@output /dev/null
messages
-@$out tmp/log1.out
@#exec "sh -c 'touch ${cwd}/build/xxx_new_file'"
+@$out tmp/log1.out
run job=VerifyVolume level=InitCatalog yes
wait
messages
run_bacula
sleep 2
-check_for_zombie_jobs storage=File
+check_for_zombie_jobs storage=File
stop_bacula
+while IFS= read -r line <&3; do
+ grep "Veryfying: ${line}" tmp/log1.out > /dev/null
+ if [ $? -ne 0 ]; then
+ estat=1
+ print_debug "Did not found ${line} file in verified files log!"
+ print_debug "see: ${cwd}/tmp/log1.out"
+ fi
+ grep "Veryfying: ${line}" tmp/original > /dev/null
+ if [ $? -ne 0 ]; then
+ estat=1
+ print_debug "Did not found ${line} file in verified files log!"
+ print_debug "see: ${cwd}/tmp/original"
+ fi
+done 3< ${files_listing}
+
+
grep "^ Termination: *Verify OK" tmp/log1.out 2>&1 >/dev/null
bstat=$?
grep "^ Termination: *Verify OK" ${cwd}/tmp/original 2>&1 >/dev/null
rstat=$?
dstat=0
+
+# Turn off verbose file listing, rerun verify jobs and check if files are not listed as expected
+sed -i '/console =*/ s/$/, !verified/g' bin/bacula-dir.conf | grep verified
+sed -i '/director =*/ s/$/, !verified/g' bin/bacula-fd.conf | grep verified
+
+cat <<END_OF_DATA >tmp/bconcmds
+@output /dev/null
+messages
+@$out tmp/log2.out
+run job=VerifyVolume level=InitCatalog yes
+wait
+messages
+@$out tmp/log3.out
+run job=VerifyVolume level=Catalog yes
+wait
+messages
+quit
+END_OF_DATA
+
+run_bacula
+
+check_for_zombie_jobs storage=File
+stop_bacula
+
+while IFS= read -r line <&3; do
+ grep "Veryfying: ${line}" tmp/log2.out > /dev/null
+ if [ $? -eq 0 ]; then
+ estat=1
+ print_debug "Found ${line} file in verified files log, no files should be listed now!"
+ print_debug "see: ${cwd}/tmp/log2.out"
+ grep "Veryfying: ${line}" tmp/log3.out > /dev/null
+ if [ $? -eq 0 ]; then
+ estat=1
+ print_debug "Found ${line} file in verified files log, no files should be listed now!"
+ print_debug "see: ${cwd}/tmp/log3.out"
+ fi
+ fi
+done 3< ${files_listing}
+
end_test
#mkdir -p $tmp/files
#dd if=${cwd}/build/configure of=$tmp/files/sparsefile bs=1 count=1 seek=10M > /dev/null
+# Create list of files being backed up and verified to compare afterwards
+files_listing=${cwd}/tmp/files
+find ${cwd}/build/src/dird -print > ${files_listing}
+find ${cwd}/build/src/filed -print >> ${files_listing}
+
change_jobname NightlySave $JobName
start_test
run_bconsole
-check_for_zombie_jobs storage=File
stop_bacula
+while IFS= read -r line <&3; do
+ grep "Veryfying: ${line}" tmp/log2.out > /dev/null
+ if [ $? -ne 0 ]; then
+ estat=1
+ print_debug "Did not found ${line} file in verified files log!"
+ print_debug "see: ${cwd}/tmp/log2.out"
+ fi
+done 3< ${files_listing}
+
$bperl -e 'add_attribute("$conf/bacula-sd.conf", "BlockChecksum", "no", "Device")'
nbok=2
check_for_zombie_jobs storage=File
stop_bacula
+# Turn off verbose file listing, rerun verify jobs and check if files are not listed as expected
+sed -i '/console =*/ s/$/, !verified/g' bin/bacula-dir.conf | grep verified
+sed -i '/director =*/ s/$/, !verified/g' bin/bacula-fd.conf | grep verified
+
+cat <<END_OF_DATA >tmp/bconcmds
+@output /dev/null
+messages
+@$out tmp/log5.out
+run job=VerifyData jobid=1 yes
+wait
+messages
+quit
+END_OF_DATA
+
+run_bacula
+check_for_zombie_jobs storage=File
+stop_bacula
+
+
+while IFS= read -r line <&3; do
+ grep "Veryfying: ${line}" tmp/log5.out > /dev/null
+ if [ $? -eq 0 ]; then
+ estat=1
+ print_debug "Found ${line} file in verified files log, no files should be listed now!"
+ print_debug "see: ${cwd}/tmp/log5.out"
+ fi
+done 3< ${files_listing}
+
nb=`grep "^ Termination: *Backup OK" tmp/log1.out | wc -l`
if [ $nb -ne 6 ]; then
bstat=1
change_jobname NightlySave $JobName
start_test
-#$bperl -e "add_attribute('$conf/bacula-dir.conf', 'VerifyJob', '$JobName', 'Job', 'VerifyVolume')"
+# Create list of files being backed up and verified to compare afterwards
+files_listing=${cwd}/tmp/files
+find ${cwd}/build -print > ${files_listing}
cat <<END_OF_DATA >tmp/bconcmds
@output /dev/null
run_bacula
+while IFS= read -r line <&3; do
+ grep "Veryfying: ${line}" tmp/log2.out > /dev/null
+ if [ $? -ne 0 ]; then
+ estat=1
+ print_debug "Did not found ${line} file in verified files log!"
+ print_debug "see: ${cwd}/tmp/log2.out"
+ fi
+ grep "Veryfying: ${line}" tmp/log3.out > /dev/null
+ if [ $? -ne 0 ]; then
+ estat=1
+ print_debug "Did not found ${line} file in verified files log!"
+ print_debug "see: ${cwd}/tmp/log3.out"
+ fi
+ grep "Veryfying: ${line}" tmp/log4.out > /dev/null
+ if [ $? -ne 0 ]; then
+ estat=1
+ print_debug "Did not found ${line} file in verified files log!"
+ print_debug "see: ${cwd}/tmp/log4.out"
+ fi
+done 3< ${files_listing}
+
sleep 2
-check_for_zombie_jobs storage=File
+check_for_zombie_jobs storage=File
stop_bacula
grep "^ Termination: *Backup OK" tmp/log1.out 2>&1 >/dev/null
rstat=1
fi
dstat=0
+
+# Turn off verbose file listing, rerun verify jobs and check if files are not listed as expected
+sed -i '/console =*/ s/$/, !verified/g' bin/bacula-dir.conf | grep verified
+sed -i '/director =*/ s/$/, !verified/g' bin/bacula-fd.conf | grep verified
+
+cat <<END_OF_DATA >tmp/bconcmds
+@output /dev/null
+messages
+@$out ${cwd}/tmp/log5.out
+reload
+setdebug level=200 dir tags=sql trace=1
+run job=VerifyVolume yes
+wait
+messages
+@$out ${cwd}/tmp/log6.out
+run job=VerifyVolume level=DiskToCatalog jobid=1
+yes
+wait
+messages
+@$out ${cwd}/tmp/log7.out
+run job=VerifyDiskToCatalog yes
+wait
+messages
+quit
+END_OF_DATA
+
+run_bacula
+
+while IFS= read -r line <&3; do
+ grep "Veryfying: ${line}" tmp/log5.out > /dev/null
+ if [ $? -eq 0 ]; then
+ estat=1
+ print_debug "Found ${line} file in verified files log, no files should be listed now!"
+ print_debug "see: ${cwd}/tmp/log5.out"
+ fi
+ grep "Veryfying: ${line}" tmp/log6.out > /dev/null
+ if [ $? -eq 0 ]; then
+ estat=1
+ print_debug "Found ${line} file in verified files log, no files should be listed now!"
+ print_debug "see: ${cwd}/tmp/log6.out"
+ fi
+ grep "Veryfying: ${line}" tmp/log7.out > /dev/null
+ if [ $? -eq 0 ]; then
+ estat=1
+ print_debug "Found ${line} file in verified files log, no files should be listed now!"
+ print_debug "see: ${cwd}/tmp/log7.out"
+ fi
+done 3< ${files_listing}
+
+check_for_zombie_jobs storage=File
+stop_bacula
+
end_test