X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;f=regress%2Ftests%2Frestore-by-file-tape;h=fefc274ac860a9a6e17a3ef44769e0e2652ae018;hb=3448d94ab63e631f378fa674240b98133c9a5d29;hp=f8dd658c3a79a53db78d9f4f4b66e48b3d0b9e3f;hpb=3bbe968eabc0e35ea5aa8ab4d261967eaafebded;p=bacula%2Fbacula diff --git a/regress/tests/restore-by-file-tape b/regress/tests/restore-by-file-tape index f8dd658c3a..fefc274ac8 100755 --- a/regress/tests/restore-by-file-tape +++ b/regress/tests/restore-by-file-tape @@ -6,39 +6,36 @@ # file size to 1M, it runs very slow. There are about 64 files that # are created during each of the two backups. # -cwd=`pwd` -bin/bacula stop 2>&1 >/dev/null +TestName="restore-by-file-tape" +JobName=restorebyfile +. scripts/functions + +require_tape_drive + scripts/copy-tape-confs scripts/cleanup-tape -echo "${cwd}/build" >/tmp/file-list -sed s%\^%${cwd}% ${cwd}/scripts/flist >${cwd}/tmp/restore2-list -cd bin -./drop_bacula_tables >/dev/null 2>&1 -./make_bacula_tables >/dev/null 2>&1 -./grant_bacula_privileges 2>&1 >/dev/null -cd .. + +echo "${cwd}/build" >${cwd}/tmp/file-list +sed s%\^%${cwd}% ${cwd}/scripts/flist | sort | uniq >${cwd}/tmp/restore2-list + cp ${cwd}/bin/bacula-sd.conf ${cwd}/tmp/1 sed "s%# Maximum File Size% Maximum File Size%" ${cwd}/tmp/1 >${cwd}/bin/bacula-sd.conf -echo " " -echo " " -echo " === Starting restore-by-file-tape test ===" -echo " === Starting restore-by-file-tape test ===" >>working/log -echo " " +change_jobname NightlySave $JobName +start_test -bin/bacula start 2>&1 >/dev/null -bin/bconsole -c bin/bconsole.conf <${cwd}/tmp/bconcmds @output /dev/null messages -@output tmp/log1.out -label storage=DDS-4 volume=TestVolume001 slot=0 -run job=NightlySave level=Full yes +@$out ${cwd}/tmp/log1.out +label storage=DDS-4 volume=TestVolume001 slot=0 pool=Default +run job=$JobName level=Full yes wait messages @# @# now do a restore @# -@output tmp/log2.out +@$out ${cwd}/tmp/log2.out restore where=${cwd}/tmp/bacula-restores storage=DDS-4 file=<${cwd}/tmp/restore2-list yes wait @@ -46,49 +43,34 @@ messages @output quit END_OF_DATA + +run_bacula +check_for_zombie_jobs storage=DDS-4 +stop_bacula + dstat=0 # # We need to stop and start Bacula to # test appending to a previously written tape # -bin/bacula stop 2>&1 >/dev/null -bin/bacula start 2>&1 >/dev/null for i in `cat ${cwd}/tmp/restore2-list`; do diff $i ${cwd}/tmp/bacula-restores$i if [ $? != 0 ] ; then dstat=1 fi done -grep "^Termination: *Backup OK" tmp/log1.out 2>&1 >/dev/null -bstat=$? -grep "^Termination: *Restore OK" tmp/log2.out 2>&1 >/dev/null -rstat=$? -if [ $dstat != 0 -o $bstat != 0 -o $rstat != 0 ] ; then - echo " " - echo " " - echo " !!!!! restore-by-file-tape test Bacula source failed!!! !!!!! " - echo " !!!!! restore-by-file-tape test failed!!! !!!!! " >>test.out - echo " " - bin/bacula stop 2>&1 >/dev/null - exit 1 -else - echo " First of two restores OK " -fi -rm -rf ${cwd}/tmp/bacula-restores -# -# Now do a second backup and restore -# -bin/bconsole -c bin/bconsole.conf <${cwd}/tmp/bconcmds @output /dev/null messages -@output tmp/log1.out -run job=NightlySave level=Full yes +@$out ${cwd}/tmp/log1.out +run job=$JobName level=Full yes wait messages @# @# now do a restore @# -@output tmp/log2.out +@$out ${cwd}/tmp/log2.out restore where=${cwd}/tmp/bacula-restores 7 <${cwd}/tmp/restore2-list @@ -99,6 +81,18 @@ messages @output quit END_OF_DATA + +# +# Bacula was stopped, but we must restart it to +# test appending to a previously written tape +# +run_bacula +check_for_zombie_jobs storage=DDS-4 +stop_bacula + +check_two_logs + +scripts/check_for_zombie_jobs storage=DDS-4 bin/bacula stop 2>&1 >/dev/null for i in `cat ${cwd}/tmp/restore2-list`; do diff $i ${cwd}/tmp/bacula-restores$i @@ -106,18 +100,5 @@ for i in `cat ${cwd}/tmp/restore2-list`; do dstat=1 fi done -grep "^Termination: *Backup OK" tmp/log1.out 2>&1 >/dev/null -bstat=$? -grep "^Termination: *Restore OK" tmp/log2.out 2>&1 >/dev/null -rstat=$? -if [ $dstat != 0 -o $bstat != 0 -o $rstat != 0 ] ; then - echo " " - echo " " - echo " !!!!! restore-by-file-tape test Bacula source failed!!! !!!!! " - echo " !!!!! restore-by-file-tape test failed!!! !!!!! " >>test.out - echo " " -else - echo " ===== restore-by-file-tape test Bacula source OK ===== " - echo " ===== restore-by-file-tape test OK ===== " >>test.out -# scripts/cleanup -fi + +end_test