X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;f=regress%2Ftests%2Faccurate-test;h=80168c8b4be86f47fe11df7b2c93e10b66d80fb3;hb=607d301d1a4c30080d46cc380edf2bb3501899d7;hp=713faecf713b0cd87ee757aac047ed06cba1026b;hpb=3fa9faf7fee0025b318b2da92b6e52a3ee00ea4f;p=bacula%2Fbacula diff --git a/regress/tests/accurate-test b/regress/tests/accurate-test index 713faecf71..80168c8b4b 100755 --- a/regress/tests/accurate-test +++ b/regress/tests/accurate-test @@ -1,8 +1,13 @@ #!/bin/sh # +# TODO: +# - test bextract +# - with strip path +# # Run a accurate backup of the Bacula build directory # then restore it. # + TestName="accurate-test" JobName=backup . scripts/functions @@ -10,15 +15,36 @@ scripts/cleanup copy_test_confs /bin/cp -f scripts/bacula-dir.conf.accurate bin/bacula-dir.conf +sed s/all,/all,saved,/ bin/bacula-fd.conf > tmp/1 +cp tmp/1 bin/bacula-fd.conf + +change_jobname Client1 $JobName +p() { + echo "##############################################" >> ${cwd}/tmp/log1.out + echo "$*" >> ${cwd}/tmp/log1.out + echo "##############################################" >> ${cwd}/tmp/log2.out + echo "$*" >> ${cwd}/tmp/log2.out +} + +# cleanup rm -rf ${cwd}/build/accurate.new rm -rf ${cwd}/build/accurate -change_jobname Client1 $JobName + +# 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 @@ -41,7 +67,8 @@ messages @# now do a restore @# @$out ${cwd}/tmp/log2.out -restore where=${cwd}/tmp/bacula-restores select all done +setdebug level=10 storage=File +restore fileset=FS_TESTJOB where=${cwd}/tmp/bacula-restores select all done yes wait messages @@ -49,6 +76,10 @@ messages quit END_OF_DATA +################################################################ +p First : We just run full and restore to compare if all is ok +################################################################ + run_bconsole check_for_zombie_jobs storage=File @@ -57,20 +88,93 @@ check_restore_diff rm -rf ${cwd}/tmp/bacula-restores -# Now do a second backup after making a few changes -# -rm ${cwd}/build/accurate/xxx +################################################################ +p 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 second backup after making a few changes -# +################################################################ +p 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 + +################################################################ +p 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 + +################################################################ +p 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 + +################################################################ +p 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 + +################################################################ +p Check with bls +################################################################ + +$bin/bls -c bin/bacula-sd.conf -V 'TestVolume001' FileStorage > tmp/bls.out +grep -- '----' tmp/bls.out | grep xxx > /dev/null +if [ $? != 0 ] ; then + bstat=2 +fi + +################################################################ +p Now do a backup after making few changes +################################################################ + +# some files will have disappear, others have their old mtime/ctime mv ${cwd}/build/accurate ${cwd}/build/accurate.new run_bconsole @@ -81,5 +185,248 @@ check_restore_diff rm -rf ${cwd}/tmp/bacula-restores +################################################################ +p Now do an other test in differential mode +################################################################ + +cat <${cwd}/tmp/bconcmds +@$out ${cwd}/tmp/log1.out +run job=$JobName level=differential yes +wait +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 +messages +@$out +quit +END_OF_DATA + +run_bconsole +check_for_zombie_jobs storage=File + +check_two_logs +check_restore_diff + +rm -rf ${cwd}/tmp/bacula-restores + +################################################################ +p Now do an other test in differential mode + incremental +################################################################ + +# make some changes +mv ${cwd}/build/accurate.new ${cwd}/build/accurate + +cat <${cwd}/tmp/bconcmds +@$out ${cwd}/tmp/log1.out +run job=$JobName yes +wait +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 +messages +@$out +quit +END_OF_DATA + +run_bconsole +check_for_zombie_jobs storage=File + +check_two_logs +check_restore_diff + +rm -rf ${cwd}/tmp/bacula-restores + +################################################################ +p 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 + +################################################################ +p 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 + +################################################################ +p Check with bscan +################################################################ + +stop_bacula + +cd ${cwd}/bin + ./drop_bacula_tables >/dev/null 2>&1 + ./make_bacula_tables >/dev/null 2>&1 + ./grant_bacula_privileges >/dev/null 2>&1 +cd .. + +echo "volume=TestVolume001" >tmp/bscan.bsr + +bscan_libdbi + +$bin/bscan -c bin/bacula-sd.conf $BSCANLIBDBI -n regress -u regress -m -s -b tmp/bscan.bsr FileStorage 2>&1 > ${cwd}/tmp/bscan.log + +cat <${cwd}/tmp/bconcmds +@$out ${cwd}/tmp/log1.out +messages +@# +@# now do a restore after bscan +@# +@$out ${cwd}/tmp/log2.out +setdebug level=10 storage=File +restore fileset=FS_TESTJOB where=${cwd}/tmp/bacula-restores select all done +yes +wait +messages +@$out +quit +END_OF_DATA + +# run bacula with just the restore job +run_bacula + +check_for_zombie_jobs storage=File + +check_two_logs +check_restore_diff + +rm -rf ${cwd}/tmp/bacula-restores + +################################################################ +p Now do a test with other attributes: owner, gid, rights +################################################################ + +cat <${cwd}/tmp/bconcmds +@$out ${cwd}/tmp/log1.out +label volume=TestVolume002 storage=File pool=Default +run job=backup_advance yes +wait +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 +messages +@$out +quit +END_OF_DATA + +run_bconsole +check_for_zombie_jobs storage=File + +check_two_logs +check_restore_diff + +rm -rf ${cwd}/tmp/bacula-restores + + +################################################################ +p Use the p option for verify +################################################################ + +chmod 400 ${cwd}/build/accurate/yyy + +cat <${cwd}/tmp/bconcmds +@$out ${cwd}/tmp/log1.out +run job=backup_advance yes +wait +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 +messages +@$out +quit +END_OF_DATA + +run_bconsole +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 + +################################################################ +p Test strippath option +################################################################ + +cat <${cwd}/tmp/bconcmds +@$out ${cwd}/tmp/log1.out +setdebug level=1 client=$CLIENT +run job=backup fileset=FS_TESTJOB2 yes +wait +messages +@$out ${cwd}/tmp/log3.out +st dir +quit +END_OF_DATA + +run_bconsole +check_for_zombie_jobs storage=File + +# run incremental +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` + +cat <${cwd}/tmp/bconcmds +@$out ${cwd}/tmp/log3.out +list files jobid=$jobid +quit +END_OF_DATA + +run_bconsole + +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 + print_debug "Can't find zzz file into 'list files' output (${cwd}/tmp/log3.out)" + dstat=2 +fi + stop_bacula end_test