]> git.sur5r.net Git - bacula/bacula/blobdiff - regress/tests/accurate-test
update
[bacula/bacula] / regress / tests / accurate-test
index ee5aff01a1d560350ea699fbf015f359deda2016..b2211d3fdcb39c1fc13d76cc13723415413216f7 100755 (executable)
@@ -7,6 +7,7 @@
 # Run a accurate backup of the Bacula build directory
 #   then restore it.
 #
+
 TestName="accurate-test"
 JobName=backup
 . scripts/functions
@@ -14,7 +15,8 @@ scripts/cleanup
 
 copy_test_confs
 /bin/cp -f scripts/bacula-dir.conf.accurate bin/bacula-dir.conf
-sed -i s/all,/all,saved,/ bin/bacula-fd.conf
+sed s/all,/all,saved,/ bin/bacula-fd.conf > tmp/1
+cp tmp/1 bin/bacula-fd.conf
 
 change_jobname Client1 $JobName
 
@@ -25,9 +27,17 @@ rm -rf ${cwd}/build/accurate
 
 # add extra files
 mkdir ${cwd}/build/accurate
+mkdir ${cwd}/build/accurate/dirtest
+echo "test test" > ${cwd}/build/accurate/dirtest/hello
 echo "test test" > ${cwd}/build/accurate/xxx
 echo "test test" > ${cwd}/build/accurate/yyy
 echo "test test" > ${cwd}/build/accurate/zzz
+echo "test test" > ${cwd}/build/accurate/zzzzzz
+echo "test test" > ${cwd}/build/accurate/xxxxxx
+echo "test test" > ${cwd}/build/accurate/yyyyyy
+echo "test test" > ${cwd}/build/accurate/xxxxxxxxx
+echo "test test" > ${cwd}/build/accurate/yyyyyyyyy
+echo "test test" > ${cwd}/build/accurate/zzzzzzzzz
 echo ${cwd}/build > ${cwd}/tmp/file-list
 
 start_test
@@ -50,6 +60,7 @@ messages
 @# now do a restore
 @#
 @$out ${cwd}/tmp/log2.out  
+setdebug level=10 storage=File
 restore fileset=FS_TESTJOB where=${cwd}/tmp/bacula-restores select all done
 yes
 wait
@@ -74,12 +85,71 @@ rm -rf ${cwd}/tmp/bacula-restores
 # Now do a second backup after making few changes
 ################################################################
 rm ${cwd}/build/accurate/xxx  # delete a file
+rm ${cwd}/build/accurate/dirtest/hello
+
+run_bconsole
+check_for_zombie_jobs storage=File
+
+check_two_logs
+check_restore_diff
+check_files_written ${cwd}/tmp/log1.out 4
+
+rm -rf ${cwd}/tmp/bacula-restores
+
+################################################################
+# Now do a third backup after making few changes
+################################################################
+rm ${cwd}/build/accurate/yyyyyy  # delete a file
+rmdir ${cwd}/build/accurate/dirtest
+
+run_bconsole
+check_for_zombie_jobs storage=File
+
+check_two_logs
+check_restore_diff
+check_files_written ${cwd}/tmp/log1.out 3
+
+rm -rf ${cwd}/tmp/bacula-restores
+
+################################################################
+# Now do a 4 backup after making few changes
+################################################################
+rm ${cwd}/build/accurate/zzzzzz  # delete a file
+
+run_bconsole
+check_for_zombie_jobs storage=File
+
+check_two_logs
+check_restore_diff
+check_files_written ${cwd}/tmp/log1.out 2
+
+rm -rf ${cwd}/tmp/bacula-restores
+
+################################################################
+# Now do a 5 backup after making few changes
+################################################################
+rm ${cwd}/build/accurate/zzzzzzzzz
+
+run_bconsole
+check_for_zombie_jobs storage=File
+
+check_two_logs
+check_restore_diff
+check_files_written ${cwd}/tmp/log1.out 2
+
+rm -rf ${cwd}/tmp/bacula-restores
+
+################################################################
+# Now do a backup after making few changes
+################################################################
+touch ${cwd}/build/accurate/aaaaaa
 
 run_bconsole
 check_for_zombie_jobs storage=File
 
 check_two_logs
 check_restore_diff
+check_files_written ${cwd}/tmp/log1.out 2
 
 rm -rf ${cwd}/tmp/bacula-restores
 
@@ -88,13 +158,13 @@ rm -rf ${cwd}/tmp/bacula-restores
 ################################################################
 
 ${cwd}/bin/bls -c ${cwd}/bin/bacula-sd.conf -V 'TestVolume001' FileStorage > tmp/bls.out
-if ! grep -- '----' tmp/bls.out | grep xxx > /dev/null
-then
+grep -- '----' tmp/bls.out | grep xxx > /dev/null
+if [ $? != 0 ] ; then
     bstat=2
 fi
 
 ################################################################
-# Now do a third backup after making few changes
+# Now do a backup after making few changes
 ################################################################
 
 # some files will have disappear, others have their old mtime/ctime
@@ -121,6 +191,7 @@ messages
 @# now do a restore
 @#
 @$out ${cwd}/tmp/log2.out  
+setdebug level=10 storage=File
 restore fileset=FS_TESTJOB where=${cwd}/tmp/bacula-restores select all done
 yes
 wait
@@ -153,6 +224,7 @@ messages
 @# now do a restore
 @#
 @$out ${cwd}/tmp/log2.out  
+setdebug level=10 storage=File
 restore fileset=FS_TESTJOB where=${cwd}/tmp/bacula-restores select all done
 yes
 wait
@@ -169,6 +241,32 @@ check_restore_diff
 
 rm -rf ${cwd}/tmp/bacula-restores
 
+################################################################
+# Now do a backup after making few changes
+################################################################
+rm ${cwd}/build/accurate/aaaaaa
+touch ${cwd}/build/accurate/bbbbbb
+
+run_bconsole
+check_for_zombie_jobs storage=File
+check_files_written ${cwd}/tmp/log1.out 3
+
+check_two_logs
+check_restore_diff
+
+################################################################
+# Now do a backup after making few changes
+################################################################
+mv ${cwd}/tmp/bacula-restores ${cwd}/build/accurate/
+
+run_bconsole
+check_for_zombie_jobs storage=File
+
+check_two_logs
+check_restore_diff
+
+rm -rf ${cwd}/tmp/bacula-restores ${cwd}/build/accurate/bacula-restores
+
 ################################################################
 # Check with bscan
 ################################################################
@@ -183,7 +281,9 @@ cd ..
 
 echo "volume=TestVolume001" >tmp/bscan.bsr
 
-${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
+bscan_libdbi
+
+${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
 
 cat <<END_OF_DATA >${cwd}/tmp/bconcmds
 @$out ${cwd}/tmp/log1.out
@@ -192,6 +292,7 @@ messages
 @# now do a restore
 @#
 @$out ${cwd}/tmp/log2.out  
+setdebug level=10 storage=File
 restore fileset=FS_TESTJOB where=${cwd}/tmp/bacula-restores select all done
 yes
 wait
@@ -224,6 +325,7 @@ messages
 @# now do a restore
 @#
 @$out ${cwd}/tmp/log2.out  
+setdebug level=10 storage=File
 restore fileset=FS_TESTJOB_ADVANCE where=${cwd}/tmp/bacula-restores select all done
 yes
 wait
@@ -256,6 +358,7 @@ messages
 @# now do a restore
 @#
 @$out ${cwd}/tmp/log2.out  
+setdebug level=10 storage=File
 restore fileset=FS_TESTJOB_ADVANCE where=${cwd}/tmp/bacula-restores select all done
 yes
 wait
@@ -269,21 +372,17 @@ check_for_zombie_jobs storage=File
 
 check_two_logs
 check_restore_diff
+check_files_written ${cwd}/tmp/log1.out 1
 
 rm -rf ${cwd}/tmp/bacula-restores
 
-if ! grep 'st_mode  differ' tmp/log1.out > /dev/null
-then
-    bstat=2
-fi
-
 ################################################################
 # Test strippath option
 ################################################################
 
 cat <<END_OF_DATA >${cwd}/tmp/bconcmds
 @$out ${cwd}/tmp/log1.out
-setdebug  level=1 client
+setdebug  level=1 client=$CLIENT
 run job=backup fileset=FS_TESTJOB2 yes
 wait
 messages
@@ -300,7 +399,7 @@ rm -f ${cwd}/build/accurate/yyy
 run_bconsole
 check_for_zombie_jobs storage=File
 
-jobid=$(awk '/ Incr.+backup/ { jobid=$1 } END { print jobid }' ${cwd}/tmp/log3.out)
+jobid=`awk '/ Incr.+backup/ { jobid=$1 } END { print jobid }' ${cwd}/tmp/log3.out`
 
 cat <<END_OF_DATA >${cwd}/tmp/bconcmds
 @$out ${cwd}/tmp/log3.out
@@ -310,16 +409,17 @@ END_OF_DATA
 
 run_bconsole
 
-if ! grep yyy ${cwd}/tmp/log3.out > /dev/null
-then
-    bstat=2
+grep yyy ${cwd}/tmp/log3.out > /dev/null
+if [ $? != 0 ] ; then
+    print_debug "Can't find yyy file into 'list files' output (${cwd}/tmp/log3.out)"
+    dstat=2
 fi
 
 if grep zzz ${cwd}/tmp/log3.out > /dev/null
 then
-    bstat=2
+    print_debug "Can't find zzz file into 'list files' output (${cwd}/tmp/log3.out)"
+    dstat=2
 fi
 
 stop_bacula
 end_test
-