X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;f=regress%2Ftests%2Frestore-by-file-tape;h=fefc274ac860a9a6e17a3ef44769e0e2652ae018;hb=3448d94ab63e631f378fa674240b98133c9a5d29;hp=1377af458658d786cfb2c83bfc4f576b3695da54;hpb=e54ed58d45a9f0ab037c477294a66e95ffc4373b;p=bacula%2Fbacula diff --git a/regress/tests/restore-by-file-tape b/regress/tests/restore-by-file-tape index 1377af4586..fefc274ac8 100755 --- a/regress/tests/restore-by-file-tape +++ b/regress/tests/restore-by-file-tape @@ -6,34 +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` +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 + +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 `date +%R:%S` ===" -echo " === Starting restore-by-file-tape test `date +%R:%S` ===" >>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 @@ -41,50 +43,34 @@ messages @output quit END_OF_DATA + +run_bacula +check_for_zombie_jobs storage=DDS-4 +stop_bacula + dstat=0 -scripts/check_for_zombie_jobs storage=DDS-4 # # 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 @@ -95,6 +81,17 @@ 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 @@ -103,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