From 959ff22d2588dd435224cd999f9c303fb678710a Mon Sep 17 00:00:00 2001 From: Kern Sibbald Date: Sat, 30 Aug 2003 14:44:42 +0000 Subject: [PATCH] Add new tape tests git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@677 91ce42f0-d328-0410-95d8-f526ca767f89 --- regress/all-non-root-tape-tests | 12 +++ regress/scripts/.cvsignore | 3 + regress/scripts/bacula-dir-tape.conf.in | 132 ++++++++++++++++++++++++ regress/scripts/bacula-sd-tape.conf.in | 54 ++++++++++ regress/scripts/cleanup | 1 + regress/scripts/cleanup-tape.in | 10 ++ regress/scripts/copy-tape-confs | 5 + regress/scripts/do_sed | 8 +- regress/tests/backup-bacula-tape | 56 ++++++++++ regress/tests/bextract-test | 14 +-- regress/tests/bsr-opt-test | 14 +-- regress/tests/compressed-test | 6 +- regress/tests/concurrent-jobs-test | 15 +-- regress/tests/six-vol-test | 3 +- regress/tests/small-file-size-tape | 61 +++++++++++ regress/tests/sparse-compressed-test | 10 +- regress/tests/sparse-test | 6 +- regress/tests/two-jobs-test | 6 +- regress/tests/two-volume-tape | 71 +++++++++++++ regress/tests/verify-vol-test | 6 +- 20 files changed, 437 insertions(+), 56 deletions(-) create mode 100755 regress/all-non-root-tape-tests create mode 100644 regress/scripts/bacula-dir-tape.conf.in create mode 100644 regress/scripts/bacula-sd-tape.conf.in create mode 100755 regress/scripts/cleanup-tape.in create mode 100755 regress/scripts/copy-tape-confs create mode 100755 regress/tests/backup-bacula-tape create mode 100755 regress/tests/small-file-size-tape create mode 100755 regress/tests/two-volume-tape diff --git a/regress/all-non-root-tape-tests b/regress/all-non-root-tape-tests new file mode 100755 index 0000000000..25f55b09d9 --- /dev/null +++ b/regress/all-non-root-tape-tests @@ -0,0 +1,12 @@ +#!/bin/sh +# +# Run all tape tests +# +tests/test0 +tests/backup-bacula-tape +tests/small-file-size-tape +echo " " +echo " " +echo "Test results" +cat test.out +scripts/cleanup diff --git a/regress/scripts/.cvsignore b/regress/scripts/.cvsignore index 61a0e7ea65..0253541d2a 100644 --- a/regress/scripts/.cvsignore +++ b/regress/scripts/.cvsignore @@ -7,3 +7,6 @@ test-bacula-fd.conf test-bacula-sd.conf test-console.conf testa-bacula-dir.conf +bacula-dir-tape.conf +bacula-sd-tape.conf +cleanup-tape diff --git a/regress/scripts/bacula-dir-tape.conf.in b/regress/scripts/bacula-dir-tape.conf.in new file mode 100644 index 0000000000..da9ac34c19 --- /dev/null +++ b/regress/scripts/bacula-dir-tape.conf.in @@ -0,0 +1,132 @@ +# +# Default Bacula Director Configuration file +# +# The only thing that MUST be changed is to add one or more +# file or directory names in the Include directive of the +# FileSet resource. +# +# For Bacula release 1.30 (12 April 2003) -- redhat 7.3 +# +# You might also want to change the default email address +# from root to your address. See the "mail" and "operator" +# directives in the Messages resource. +# + +Director { # define myself + Name = @hostname@-dir + DIRport = 8101 # where we listen for UA connections + QueryFile = "@scriptdir@/query.sql" + WorkingDirectory = "@working_dir@" + PidDirectory = "@piddir@" + Maximum Concurrent Jobs = 4 + Password = "pNvX1WiXnwv2C/F7E52LGvw6rKjbbPvu2kyuPa9pVaL3" + Messages = Standard +} + +# +# Define the main nightly save backup job +# By default, this job will back up to disk in /tmp +Job { + Name = "NightlySave" + Type = Backup + Client=@hostname@-fd + FileSet="Full Set" + Storage = DDS-4 + Messages = Standard + Pool = Default + Write Bootstrap = "@working_dir@/NightlySave.bsr" + Maximum Concurrent Jobs = 4 +} + + +# Standard Restore template, to be changed by Console program +Job { + Name = "RestoreFiles" + Type = Restore + Client=@hostname@-fd + FileSet="Full Set" + Storage = DDS-4 + Messages = Standard + Pool = Default + Where = /tmp/bacula-restores +} + + +# List of files to be backed up +FileSet { + Name = "Full Set" + Include = signature=MD5 { + >${out} echo "s%@piddir@%${cwd}/working%g" >>${out} echo "s%@subsysdir@%${cwd}/working%g" >>${out} echo "s%@job_email@%${1}%g" >>${out} +echo "s%@tape_drive@%${2}%g" >>${out} echo "s%@tmpdir@%${cwd}/tmp%g" >>${out} echo "s%@hostname@%${host}%g" >>${out} @@ -26,5 +28,9 @@ sed -f ${out} ${cwd}/scripts/testa-bacula-dir.conf.in >${cwd}/scripts/testa-bacu sed -f ${out} ${cwd}/scripts/test-bacula-fd.conf.in >${cwd}/scripts/test-bacula-fd.conf sed -f ${out} ${cwd}/scripts/test-bacula-sd.conf.in >${cwd}/scripts/test-bacula-sd.conf sed -f ${out} ${cwd}/scripts/test-console.conf.in >${cwd}/scripts/test-console.conf +sed -f ${out} ${cwd}/scripts/bacula-dir-tape.conf.in >${cwd}/scripts/bacula-dir-tape.conf +sed -f ${out} ${cwd}/scripts/bacula-sd-tape.conf.in >${cwd}/scripts/bacula-sd-tape.conf +sed -f ${out} ${cwd}/scripts/cleanup-tape.in >${cwd}/scripts/cleanup-tape +chmod 777 ${cwd}/scripts/cleanup-tape rm -f ${out} diff --git a/regress/tests/backup-bacula-tape b/regress/tests/backup-bacula-tape new file mode 100755 index 0000000000..c7cd869d6e --- /dev/null +++ b/regress/tests/backup-bacula-tape @@ -0,0 +1,56 @@ +#!/bin/sh +# +# Run a simple backup of the Bacula build directory +# to a tape then restore it. +# +cwd=`pwd` +bin/bacula stop 2>&1 >/dev/null +scripts/copy-tape-confs +scripts/cleanup-tape +echo "${cwd}/build" >/tmp/file-list +bin/drop_sqlite_tables +bin/make_sqlite_tables + +echo " " +echo " " +echo " === Starting Bacula tape test ===" +echo " === Starting Bacula tape test ===" >>working/log +echo " " + +bin/bacula start 2>&1 >/dev/null +bin/console -c bin/console.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 +if [ $? != 0 -o $bstat != 0 -o $rstat != 0 ] ; then + echo " " + echo " " + echo " !!!!! Bacula tape test Bacula source failed!!! !!!!! " + echo " !!!!! Bacula tape test failed!!! !!!!! " >>test.out + echo " " +else + echo " ===== Bacula tape test Bacula source OK ===== " + echo " ===== Bacula tape test OK ===== " >>test.out + scripts/cleanup +fi diff --git a/regress/tests/bextract-test b/regress/tests/bextract-test index 182f6ec410..580b1b3efa 100755 --- a/regress/tests/bextract-test +++ b/regress/tests/bextract-test @@ -23,16 +23,10 @@ bin/console -c bin/console.conf <&1 >/dev/null +scripts/copy-tape-confs +scripts/cleanup-tape +echo "${cwd}/build" >/tmp/file-list +bin/drop_sqlite_tables +bin/make_sqlite_tables +out="/tmp/sed_tmp" +echo "s%# Maximum File Size% Maximum File Size%g" >${out} +cp ${cwd}/bin/bacula-sd.conf ${cwd}/tmp/1 +sed -f ${out} ${cwd}/tmp/1 >${cwd}/bin/bacula-sd.conf + +echo " " +echo " " +echo " === Starting Small File Size test ===" +echo " === Starting Small File Size test ===" >>working/log +echo " " + +#bin/bacula start 2>&1 >/dev/null +bin/bacula start +bin/console -c bin/console.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 +if [ $? != 0 -o $bstat != 0 -o $rstat != 0 ] ; then + echo " " + echo " " + echo " !!!!! Small File Size test Bacula source failed!!! !!!!! " + echo " !!!!! Small File Size test failed!!! !!!!! " >>test.out + echo " " +else + echo " ===== Small File Size test Bacula source OK ===== " + echo " ===== Small File Size test OK ===== " >>test.out +# scripts/cleanup +fi diff --git a/regress/tests/sparse-compressed-test b/regress/tests/sparse-compressed-test index 4d4784c0fd..2c863669c8 100755 --- a/regress/tests/sparse-compressed-test +++ b/regress/tests/sparse-compressed-test @@ -22,19 +22,15 @@ bin/console -c bin/console.conf <&1 >/dev/null +scripts/copy-tape-confs +mtx -f /dev/sg0 unload +mtx -f /dev/sg0 load 1 +mt -f /dev/nst0 rewind +mt -f /dev/nst0 weof +mtx -f /dev/sg0 unload +mt -f /dev/sg0 load 2 +mt -f /dev/nst0 rewind +mt -f /dev/nst0 weof +mtx -f /dev/sg0 unload +echo "${cwd}/build" >/tmp/file-list +bin/drop_sqlite_tables +bin/make_sqlite_tables +out="/tmp/sed_tmp" +echo "s%# Maximum File Size% Maximum File Size%g" >${out} +cp ${cwd}/bin/bacula-sd.conf ${cwd}/tmp/1 +sed -f ${out} ${cwd}/tmp/1 >${cwd}/bin/bacula-sd.conf + +echo " " +echo " " +echo " === Starting Two Volume Tape test ===" +echo " === Starting Two Volume Tape test ===" >>working/log +echo " " + +#bin/bacula start 2>&1 >/dev/null +bin/bacula start +bin/console -c bin/console.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 +if [ $? != 0 -o $bstat != 0 -o $rstat != 0 ] ; then + echo " " + echo " " + echo " !!!!! Two Volume Tape test Bacula source failed!!! !!!!! " + echo " !!!!! Two Volume Tape test failed!!! !!!!! " >>test.out + echo " " +else + echo " ===== Two Volume Tape test Bacula source OK ===== " + echo " ===== Two Volume Tape test OK ===== " >>test.out +# scripts/cleanup +fi diff --git a/regress/tests/verify-vol-test b/regress/tests/verify-vol-test index 15caa6559c..1e841c2c84 100755 --- a/regress/tests/verify-vol-test +++ b/regress/tests/verify-vol-test @@ -22,10 +22,8 @@ bin/console -c bin/console.conf <