From 9b227ea79f314b018d748a7305e4bc68b669ba1f Mon Sep 17 00:00:00 2001 From: Kern Sibbald Date: Thu, 22 Apr 2004 12:23:22 +0000 Subject: [PATCH] Add bscan-tape test git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@1264 91ce42f0-d328-0410-95d8-f526ca767f89 --- regress/all-non-root-tape-tests | 1 + regress/scripts/bacula-dir-tape.conf.in | 2 +- regress/scripts/test-bacula-dir.conf.in | 2 +- regress/scripts/testa-bacula-dir.conf.in | 2 +- regress/tests/bscan-tape | 144 +++++++++++++++++++++++ regress/tests/four-jobs-tape | 8 ++ 6 files changed, 156 insertions(+), 3 deletions(-) create mode 100755 regress/tests/bscan-tape diff --git a/regress/all-non-root-tape-tests b/regress/all-non-root-tape-tests index 53b3f2945b..b10c8babc8 100755 --- a/regress/all-non-root-tape-tests +++ b/regress/all-non-root-tape-tests @@ -10,6 +10,7 @@ tests/incremental-tape tests/four-concurrent-jobs-tape tests/four-jobs-tape tests/fixed-block-size-tape +tests/bscan-tape echo " " echo " " echo "Test results" diff --git a/regress/scripts/bacula-dir-tape.conf.in b/regress/scripts/bacula-dir-tape.conf.in index 8868a24a4d..48d89b6eb3 100644 --- a/regress/scripts/bacula-dir-tape.conf.in +++ b/regress/scripts/bacula-dir-tape.conf.in @@ -113,7 +113,7 @@ Messages { operatorcommand = "@sbindir@/bsmtp -h localhost -f \"\(Bacula Regression\) %r\" -s \"Bacula: Intervention needed for %j\" %r" MailOnError = @job_email@ = all, !terminate operator = @job_email@ = mount - console = all, !skipped, !terminate + console = all, !skipped, !terminate, !restored # # WARNING! the following will create a file that you must cycle from # time to time as it will grow indefinitely. However, it will diff --git a/regress/scripts/test-bacula-dir.conf.in b/regress/scripts/test-bacula-dir.conf.in index 1474f3ef8a..57286c39d6 100644 --- a/regress/scripts/test-bacula-dir.conf.in +++ b/regress/scripts/test-bacula-dir.conf.in @@ -266,7 +266,7 @@ Messages { operatorcommand = "@sbindir@/bsmtp -h localhost -f \"\(Bacula Regression\) %r\" -s \"Bacula: Intervention needed for %j\" %r" MailOnError = @job_email@ = all operator = @job_email@ = mount - console = all, !skipped, !terminate + console = all, !skipped, !terminate, !restored # # WARNING! the following will create a file that you must cycle from # time to time as it will grow indefinitely. However, it will diff --git a/regress/scripts/testa-bacula-dir.conf.in b/regress/scripts/testa-bacula-dir.conf.in index 6a2aba0372..33701f7cda 100644 --- a/regress/scripts/testa-bacula-dir.conf.in +++ b/regress/scripts/testa-bacula-dir.conf.in @@ -121,7 +121,7 @@ Messages { Messages { Name = NoEmail mailcommand = "@sbindir@/bsmtp -h localhost -f \"\(Bacula Regression\) %r\" -s \"Bacula: %t %e of %c %l\" %r" - console = all, !skipped, !terminate + console = all, !skipped, !terminate, !restored append = "@working_dir@/log" = all, !skipped } diff --git a/regress/tests/bscan-tape b/regress/tests/bscan-tape new file mode 100755 index 0000000000..3fd0b84658 --- /dev/null +++ b/regress/tests/bscan-tape @@ -0,0 +1,144 @@ +#!/bin/sh +# +# Run a simple backup of the Bacula build directory using the compressed option +# then backup four times, each with incremental then +# do a bscan and restore. +# It should require at least 4 different bsrs. +# +cwd=`pwd` +bin/bacula stop 2>&1 >/dev/null +scripts/copy-tape-confs +scripts/cleanup-tape +echo "${cwd}/build" >/tmp/file-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 .. +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 bscan-tape ===" +echo " === Starting bscan-tape ===" >>working/log +echo " " + +bin/bacula start 2>&1 >/dev/null +bin/bconsole -c bin/bconsole.conf <&1 >/dev/null +@output /dev/null +estimate job=NightlySave listing +estimate job=NightlySave listing +estimate job=NightlySave listing +messages +@output tmp/log1.out +label storage=DDS-4 volume=TestVolume001 slot=0 +run job=NightlySave yes +wait +run job=NightlySave level=Full yes +wait +run job=NightlySave level=Full yes +wait +messages +quit +END_OF_DATA +scripts/check_for_zombie_jobs storage=DDS-4 +echo "Backup 1 done" +# make some files for the incremental to pick up +touch ${cwd}/build/src/dird/*.c ${cwd}/build/src/dird/*.o +touch ${cwd}/build/src/lib/*.c ${cwd}/build/src/lib/*.o + +# +# run a second job +# +bin/bconsole -c bin/bconsole.conf <&1 >/dev/null +@output /dev/null +messages +@output tmp/log1.out +run job=NightlySave level=Incremental yes +wait +messages +quit +END_OF_DATA +scripts/check_for_zombie_jobs storage=DDS-4 +echo "Backup 2 done" +touch ${cwd}/build/src/dird/*.c +touch ${cwd}/build/src/lib/*.c ${cwd}/build/src/lib/*.o +# +# run a third job +# +bin/bconsole -c bin/bconsole.conf <&1 >/dev/null +@output /dev/null +messages +@output tmp/log1.out +run job=NightlySave level=Incremental yes +wait +messages +quit +END_OF_DATA +scripts/check_for_zombie_jobs storage=DDS-4 +echo "Backup 3 done" +# make some files for the incremental to pick up +touch ${cwd}/build/src/lib/*.c ${cwd}/build/src/lib/*.o +#echo "abc" > ${cwd}/build/src/lib/dummy +# +# run a fourth job +# +bin/bconsole -c bin/bconsole.conf <&1 >/dev/null +@output /dev/null +messages +@output tmp/log1.out +run job=NightlySave level=Incremental yes +wait +messages +quit +END_OF_DATA +scripts/check_for_zombie_jobs storage=DDS-4 +echo "Backup 4 done" +# +# now drop and recreate the database +# +cd bin +./drop_bacula_tables >/dev/null 2>&1 +./make_bacula_tables >/dev/null 2>&1 +./grant_bacula_privileges 2>&1 >/dev/null +cd .. + +bin/bacula stop 2>&1 >/dev/null +echo "volume=TestVolume001" >tmp/bscan.bsr +# bin/bscan -w working -m -s -v -b tmp/bscan.bsr -c bin/bacula-sd.conf ${cwd}/tmp 2>&1 >/dev/null +bin/bscan -w working -m -s -v -b tmp/bscan.bsr -c bin/bacula-sd.conf /dev/nst0 +bin/bacula start 2>&1 >/dev/null +bin/bconsole -c bin/bconsole.conf <&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 +if [ $? != 0 -o $bstat != 0 -o $rstat != 0 ] ; then + echo " " + echo " " + echo " !!!!! bscan-tape Bacula source failed!!! !!!!! " + echo " !!!!! bscan-tape failed!!! !!!!! " >>test.out + echo " " +else + echo " ===== bscan-tape Bacula source OK ===== " + echo " ===== bscan-tape OK ===== " >>test.out +# scripts/cleanup +fi diff --git a/regress/tests/four-jobs-tape b/regress/tests/four-jobs-tape index 4b082dbe0e..71895e9737 100755 --- a/regress/tests/four-jobs-tape +++ b/regress/tests/four-jobs-tape @@ -100,11 +100,19 @@ restore where=${cwd}/tmp/bacula-restores select all done yes wait @output tmp/log2.out +@# +@# now unmount the tape and start two restores +@# at the same time +@# +unmount storage=DDS-4 +restore where=${cwd}/tmp/bacula-restores select all done +yes restore where=${cwd}/tmp/bacula-restores select unmark * mark * done yes +mount storage=DDS-4 wait messages @output -- 2.39.5