X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;f=regress%2Ftests%2Frestore-by-file-tape;h=060a43e73aed41c3857efd94bd451e52cefc8d5c;hb=38b243eb09f97315282dd31dd4f162fcbb6c6778;hp=b7c9e79ecdd587003a1806a8a26ad8b867eda0b4;hpb=5b2ea5eae435a25d1641a0e1423ac2d273de8ec0;p=bacula%2Fbacula diff --git a/regress/tests/restore-by-file-tape b/regress/tests/restore-by-file-tape index b7c9e79ecd..060a43e73a 100755 --- a/regress/tests/restore-by-file-tape +++ b/regress/tests/restore-by-file-tape @@ -6,89 +6,71 @@ # 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 -bin/drop_sqlite_tables -bin/make_sqlite_tables + +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 -restore where=${cwd}/tmp/bacula-restores -7 -<${cwd}/tmp/restore2-list - +@$out ${cwd}/tmp/log2.out +restore where=${cwd}/tmp/bacula-restores storage=DDS-4 file=<${cwd}/tmp/restore2-list yes wait 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,25 +81,24 @@ messages @output quit END_OF_DATA -bin/bacula stop 2>&1 >/dev/null + +# +# 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 +stop_bacula 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 " " -else - echo " ===== restore-by-file-tape test Bacula source OK ===== " - echo " ===== restore-by-file-tape test OK ===== " >>test.out -# scripts/cleanup -fi + +end_test