]> git.ipfire.org Git - thirdparty/bacula.git/commitdiff
regress: fix the 3 verify tests
authorAlain Spineux <alain@baculasystems.com>
Fri, 25 Nov 2022 15:57:17 +0000 (16:57 +0100)
committerEric Bollengier <eric@baculasystems.com>
Thu, 14 Sep 2023 11:57:00 +0000 (13:57 +0200)
- the estate was set before a stop_bacula/run_bacula, move the
  test at the end
- the "!verified" was not set appropriately in the tests

regress/tests/verify-cat-test
regress/tests/verify-data-test
regress/tests/verify-vol-test

index 6adb6c3be2d373ec96cb35c94456e55c204d4a41..5c957f54a34f1b69a22dcbecea4f936853a5405c 100755 (executable)
@@ -22,6 +22,12 @@ echo "${cwd}/build" >${cwd}/tmp/file-list
 change_jobname NightlySave $JobName
 start_test
 
+# enable the Verified message in the console
+sed '/console =*/ s/, !verified//g' $conf/bacula-dir.conf > $tmp/1
+mv $tmp/1 $conf/bacula-dir.conf
+sed '/director =*/ s/, !verified//g' $conf/bacula-fd.conf > $tmp/1
+mv $tmp/1 $conf/bacula-fd.conf
+
 # Create list of files being backed up and verified to compare afterwards
 files_listing=${cwd}/tmp/files
 find ${cwd}/build -print > ${files_listing}
@@ -46,37 +52,13 @@ quit
 END_OF_DATA
 
 run_bacula
-
 sleep 2
 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 '/console =*/ s/$/, !verified/g' $conf/bacula-dir.conf > $tmp/1
 mv $tmp/1 $conf/bacula-dir.conf
-
 sed '/director =*/ s/$/, !verified/g' $conf/bacula-fd.conf > $tmp/1
 mv $tmp/1 $conf/bacula-fd.conf
 
@@ -99,19 +81,40 @@ run_bacula
 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=$?
+
 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"
+   fi
    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
index c37bb898b0dd80d561277d5aaf043498147034c6..2028d0b2036c80f27dc79bc28d2c642be39efd80 100755 (executable)
@@ -32,8 +32,14 @@ find ${cwd}/build/src/filed -print >> ${files_listing}
 change_jobname NightlySave $JobName
 start_test
 
+# enable the Verified message in the console
+sed '/console =*/ s/, !verified//g' $conf/bacula-dir.conf > $tmp/1
+mv $tmp/1 $conf/bacula-dir.conf
+sed '/director =*/ s/, !verified//g' $conf/bacula-fd.conf > $tmp/1
+mv $tmp/1 $conf/bacula-fd.conf
+
 if [ x$FORCE_VOLENC = xyes ]; then
-   # force the encryption to be NULL make the sed works
+   # force the encryption to be NULL to make the "sed" of the data work
    FORCE_CIPHER=NULL
    export FORCE_CIPHER
 fi
@@ -89,15 +95,6 @@ run_bconsole
 
 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
@@ -156,6 +153,14 @@ 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 [ $? -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}
 
 while IFS= read -r line <&3; do
    grep "Veryfying: ${line}" tmp/log5.out > /dev/null
index 19c5adfab9f749cf6ed0e6bc5418a3d6152f5a7b..efaaa143718d8de9f35531b670c0c26bacf39628 100755 (executable)
@@ -30,8 +30,11 @@ start_test
 files_listing=${cwd}/tmp/files
 find ${cwd}/build -print > ${files_listing}
 
-sed -i 's/, *!verified//g' bin/bacula-dir.conf
-sed -i 's/, *!verified//g' bin/bacula-fd.conf
+# enable the Verified message in the console
+sed '/console =*/ s/, !verified//g' $conf/bacula-dir.conf > $tmp/1
+mv $tmp/1 $conf/bacula-dir.conf
+sed '/director =*/ s/, !verified//g' $conf/bacula-fd.conf > $tmp/1
+mv $tmp/1 $conf/bacula-fd.conf
 
 cat <<END_OF_DATA >tmp/bconcmds
 @output /dev/null
@@ -87,6 +90,39 @@ print_info()
 
 run_bacula
 
+
+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 '/console =*/ s/$/, !verified/g' $conf/bacula-dir.conf > $tmp/1
+mv $tmp/1 $conf/bacula-dir.conf
+sed '/director =*/ s/$/, !verified/g' $conf/bacula-fd.conf > $tmp/1
+mv $tmp/1 $conf/bacula-fd.conf
+
+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/log2.out > /dev/null
    if [ $? -ne 0 ]; then
@@ -108,9 +144,6 @@ while IFS= read -r line <&3; do
    fi
 done 3< ${files_listing}
 
-check_for_zombie_jobs storage=File
-stop_bacula
-
 grep "^  Termination: *Backup OK" tmp/log1.out 2>&1 >/dev/null
 bstat=$?
 grep "^  Termination: *Verify OK" tmp/log2.out 2>&1 >/dev/null
@@ -124,37 +157,6 @@ if [ $? != 0 ]; then
     print_info "ERROR: Verify job in error in $tmp/log4.out"
     rstat=1
 fi
-dstat=0
-
-# Turn off verbose file listing, rerun verify jobs and check if files are not listed as expected
-sed '/console =*/ s/$/, !verified/g' $conf/bacula-dir.conf > $tmp/1
-mv $tmp/1 $conf/bacula-dir.conf
-
-sed '/director =*/ s/$/, !verified/g' $conf/bacula-fd.conf > $tmp/1
-mv $tmp/1 $conf/bacula-fd.conf
-
-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