From: Michal Rakowski Date: Wed, 21 Jul 2021 11:18:55 +0000 (+0200) Subject: regress: Update verify tests with files listing X-Git-Tag: Release-11.3.2~408 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=94434ddf4923c55696f3b5e5a2b1df33623e0179;p=thirdparty%2Fbacula.git regress: Update verify tests with files listing --- diff --git a/regress/tests/verify-cat-test b/regress/tests/verify-cat-test index 7faa03262..e557e7947 100755 --- a/regress/tests/verify-cat-test +++ b/regress/tests/verify-cat-test @@ -22,11 +22,15 @@ echo "${cwd}/build" >${cwd}/tmp/file-list 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 <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 @@ -44,12 +48,67 @@ END_OF_DATA 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 <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 diff --git a/regress/tests/verify-data-test b/regress/tests/verify-data-test index 9bc0e3139..5229493b5 100755 --- a/regress/tests/verify-data-test +++ b/regress/tests/verify-data-test @@ -24,6 +24,11 @@ echo "${cwd}/build/src/filed" >>$tmp/file-list #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 @@ -76,9 +81,17 @@ END_OF_DATA 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 @@ -114,6 +127,34 @@ sleep 1 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 <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 diff --git a/regress/tests/verify-vol-test b/regress/tests/verify-vol-test index d1473f857..dadb35fc7 100755 --- a/regress/tests/verify-vol-test +++ b/regress/tests/verify-vol-test @@ -24,7 +24,9 @@ rm -f ${cwd}/build/sparsefile 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 <tmp/bconcmds @output /dev/null @@ -68,8 +70,29 @@ END_OF_DATA 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 @@ -86,4 +109,56 @@ if [ $? != 0 ]; then 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 <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