X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;f=regress%2Ftests%2Fbackup-bacula-test;h=d4ab848716fd5676ee0761d34a3edc3f05065b96;hb=25daee7d2a896f1da1f4ac8ffd8b1b57454d1943;hp=cf372872a21ab75075eb827b406077632e9279e7;hpb=e3dd737ab654bfe54cd9b1b59c07f1f66894ff1c;p=bacula%2Fbacula diff --git a/regress/tests/backup-bacula-test b/regress/tests/backup-bacula-test index cf372872a2..d4ab848716 100755 --- a/regress/tests/backup-bacula-test +++ b/regress/tests/backup-bacula-test @@ -3,30 +3,32 @@ # Run a simple backup of the Bacula build directory # then restore it. # -debug=0 -if test "$debug" -eq 1 ; then - out="tee" -else - out="output" -fi +TestName="backup-bacula-test" +JobName=backup +. scripts/functions -cwd=`pwd` -scripts/copy-confs scripts/cleanup +scripts/copy-confs -echo " " -echo " " -echo " === Starting Backup Bacula Test at `date +%R:%S` ===" -echo " === Starting Backup Bacula Test at `date +%R:%S` ===" >>working/log -echo " " +# +# Zap out any schedule in default conf file so that +# it doesn't start during our test +# +outf="tmp/sed_tmp" +echo "s% Schedule =%# Schedule =%g" >${outf} +cp ${cwd}/bin/bacula-dir.conf ${cwd}/tmp/1 +sed -f ${outf} ${cwd}/tmp/1 >${cwd}/bin/bacula-dir.conf -cat <tmp/bconcmds +change_jobname Client1 $JobName +start_test + +cat <${cwd}/tmp/bconcmds @output /dev/null messages -@$out tmp/log1.out -label volume=TestVolume001 -@#setdebug level=100 storage=File -run job=Client1 yes +@$out ${cwd}/tmp/log1.out +setdebug level=100 storage=File +label volume=TestVolume001 storage=File pool=Default +run job=$JobName yes status storage=File status storage=File status storage=File @@ -50,7 +52,7 @@ messages @# @# now do a restore @# -@$out tmp/log2.out +@$out ${cwd}/tmp/log2.out restore where=${cwd}/tmp/bacula-restores select all done yes wait @@ -59,37 +61,41 @@ messages quit END_OF_DATA -if test "$debug" -eq 1 ; then - bin/bacula start - cat tmp/bconcmds | bin/bconsole -c bin/bconsole.conf -else - bin/bacula start 2>&1 >/dev/null - cat tmp/bconcmds | bin/bconsole -c bin/bconsole.conf 2>&1 >/dev/null -fi +run_bacula +check_for_zombie_jobs storage=File +stop_bacula + +cat <${cwd}/tmp/bconcmds +@output /dev/null +messages +@$out ${cwd}/tmp/log1.out +@#setdebug level=100 storage=File +run job=$JobName yes +wait +messages +@# +@# now do a restore +@# +@$out ${cwd}/tmp/log2.out +restore where=${cwd}/tmp/bacula-restores select all done +yes +wait +messages +@$out +quit +END_OF_DATA + +# +# Now do a second backup after making a few changes +# +touch ${cwd}/build/src/dird/*.c +echo "test test" > ${cwd}/build/src/dird/xxx +# + +run_bacula +check_for_zombie_jobs storage=File +stop_bacula -scripts/check_for_zombie_jobs storage=File -bin/bacula stop 2>&1 >/dev/null -grep "^ Termination: *Backup OK" tmp/log1.out 2>&1 >/dev/null -bstat=$? -grep "^ Termination: *Restore OK" tmp/log2.out 2>&1 >/dev/null -rstat=$? -# diff -r build tmp/bacula-restores${cwd}/build 2>&1 >/dev/null -diff -r build tmp/bacula-restores${cwd}/build -if [ $? != 0 -o $bstat != 0 -o $rstat != 0 ] ; then - echo " " - echo " " - echo " !!!!! Backup Bacula Test failed!!! !!!!! " - echo " !!!!! Backup Bacula Test failed!!! !!!!! " >>test.out - if [ $bstat != 0 -o $rstat != 0 ] ; then - echo " !!!!! Bad Job termination status !!!!! " - echo " !!!!! Bad Job termination status !!!!! " >>test.out - else - echo " !!!!! Restored files differ !!!!! " - echo " !!!!! Restored files differ !!!!! " >>test.out - fi - echo " " -else - echo " ===== Backup Bacula Test OK ===== " - echo " ===== Backup Bacula Test OK ===== " >>test.out - scripts/cleanup -fi +check_two_logs +check_restore_diff +end_test