From: Kern Sibbald Date: Thu, 24 Apr 2003 17:32:27 +0000 (+0000) Subject: Initial revision X-Git-Tag: Release-1.30~10 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=4ee91493e376603836ad60ae78da1a0e603c9755;p=bacula%2Fbacula Initial revision git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@457 91ce42f0-d328-0410-95d8-f526ca767f89 --- diff --git a/regress/.cvsignore b/regress/.cvsignore new file mode 100644 index 0000000000..57d10e103b --- /dev/null +++ b/regress/.cvsignore @@ -0,0 +1,3 @@ +build +bin +test.out diff --git a/regress/README b/regress/README new file mode 100644 index 0000000000..a087726a51 --- /dev/null +++ b/regress/README @@ -0,0 +1,51 @@ + Bacula Regression + Kern Sibbald + April 2003 + +This is Bacula's regression script directory. + +To set it up, first edit Makefile and set BACULA-SOURCE to point +to your source. + +Second, make sure that depkgs is in the parent directory of this +directory (i.e. at the same level) and that it is pre-built. + +Then do: + + make setup + +You run the above one time. + +Then you can run any of the tests in the tests subdirectory. +Each test whose name ends in -root requires you to be root for +a resonable run. Each test is totally independent of any other +test. Aside from the required "make setup", each test is totally +self-initalizing and should clean up after itself. + +Not all the tests yet report OK. This is simply because there are +some spurious differences that I haven't yet taken the time to +eliminate. + +The tests expect you to execute them from the main regress +directory! + +You can run them individually as: + + tests/two-jobs-test + +or all tests: + + su + ./all-tests + +or all non-root tests + + ./all-non-root-tests + +after running the root tests, while still root, it is a good idea +to do: + + make reset + +this cleans up any files that may be created with root permissions. + diff --git a/regress/all-non-root-tests b/regress/all-non-root-tests new file mode 100755 index 0000000000..64d87e5e80 --- /dev/null +++ b/regress/all-non-root-tests @@ -0,0 +1,12 @@ +#!/bin/sh +# +# Run all tests +# +tests/test0 +tests/backup-bacula-test +tests/sparse-test +tests/compressed-test +tests/sparse-compressed-test +tests/wierd-files-test +tests/two-jobs-test +cat test.out diff --git a/regress/all-tests b/regress/all-tests new file mode 100755 index 0000000000..d8b5d1a053 --- /dev/null +++ b/regress/all-tests @@ -0,0 +1,15 @@ +#!/bin/sh +# +# Run all tests +# +tests/test0 +tests/backup-bacula-test +tests/sparse-test +tests/compressed-test +tests/sparse-compressed-test +tests/wierd-files-test +tests/two-jobs-test +tests/dev-test-root +tests/etc-test-root +tests/lib-test-root +cat test.out diff --git a/regress/scripts/.cvsignore b/regress/scripts/.cvsignore new file mode 100644 index 0000000000..8e10c79323 --- /dev/null +++ b/regress/scripts/.cvsignore @@ -0,0 +1,8 @@ +bacula-dir.conf +bacula-fd.conf +bacula-sd.conf +console.conf +test-bacula-dir.conf +test-bacula-fd.conf +test-bacula-sd.conf +test-console.conf diff --git a/regress/scripts/copy-confs b/regress/scripts/copy-confs new file mode 100755 index 0000000000..ee77a34c59 --- /dev/null +++ b/regress/scripts/copy-confs @@ -0,0 +1,5 @@ +#!/bin/sh +/bin/cp -f scripts/bacula-dir.conf bin/bacula-dir.conf +/bin/cp -f scripts/bacula-sd.conf bin/bacula-sd.conf +/bin/cp -f scripts/bacula-fd.conf bin/bacula-fd.conf +/bin/cp -f scripts/console.conf bin/console.conf diff --git a/regress/scripts/copy-test-confs b/regress/scripts/copy-test-confs new file mode 100755 index 0000000000..45a30a2425 --- /dev/null +++ b/regress/scripts/copy-test-confs @@ -0,0 +1,5 @@ +#!/bin/sh +/bin/cp -f scripts/test-bacula-dir.conf bin/bacula-dir.conf +/bin/cp -f scripts/test-bacula-sd.conf bin/bacula-sd.conf +/bin/cp -f scripts/test-bacula-fd.conf bin/bacula-fd.conf +/bin/cp -f scripts/test-console.conf bin/console.conf diff --git a/regress/scripts/do_sed b/regress/scripts/do_sed new file mode 100755 index 0000000000..61ea5fcb39 --- /dev/null +++ b/regress/scripts/do_sed @@ -0,0 +1,17 @@ +#!/bin/sh +out="/tmp/sed_tmp" +cwd=`pwd` +# Create sed command script +echo "s%@sbindir@%${cwd}/bin%g" >${out} +echo "s%@scriptdir@%${cwd}/bin%g" >>${out} +echo "s%@working_dir@%${cwd}/bin/working%g" >>${out} +echo "s%@piddir@%${cwd}/bin/working%g" >>${out} +echo "s%@subsysdir@%${cwd}/bin/working%g" >>${out} + +# process .in files with sed script +sed -f ${out} ${cwd}/scripts/test-bacula-dir.conf.in >${cwd}/scripts/test-bacula-dir.conf +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 + +rm -f ${out} diff --git a/regress/scripts/exclude-dev-test b/regress/scripts/exclude-dev-test new file mode 100644 index 0000000000..4165ea1ae7 --- /dev/null +++ b/regress/scripts/exclude-dev-test @@ -0,0 +1,5 @@ +dev/ptmx +dev/pts +dev/rd/c5d2 +dev/rd +dev/shm diff --git a/regress/scripts/exclude-etc-test b/regress/scripts/exclude-etc-test new file mode 100644 index 0000000000..f59ca8df2a --- /dev/null +++ b/regress/scripts/exclude-etc-test @@ -0,0 +1 @@ +etc/mail/statistics diff --git a/regress/scripts/exclude-lib-test b/regress/scripts/exclude-lib-test new file mode 100644 index 0000000000..5be32f443b --- /dev/null +++ b/regress/scripts/exclude-lib-test @@ -0,0 +1,5 @@ +lib/ld-2.2.5.so +lib/libtermcap.so.2.0.8 +lib/libc-2.2.5.so +lib/libnsl-2.2.5.so +lib/libnss_files-2.2.5.so diff --git a/regress/scripts/regress-config b/regress/scripts/regress-config new file mode 100755 index 0000000000..2e95818317 --- /dev/null +++ b/regress/scripts/regress-config @@ -0,0 +1,19 @@ +#!/bin/sh +# +# This is the configuration script for regression testing +# + +CFLAGS="-g -O2 -Wall" \ + ./configure \ + --sbindir=$1/bin \ + --sysconfdir=$1/bin \ + --with-pid-dir=$1/bin/working \ + --with-subsys-dir=$1/bin/working \ + --enable-smartalloc \ + --with-sqlite=$1/../depkgs/sqlite \ + --with-working-dir=$1/bin/working \ + --with-dump-email=kern+ok@sibbald.com \ + --with-job-email=kern+ok@sibbald.com \ + --with-baseport=8101 + +exit 0 diff --git a/regress/scripts/setup b/regress/scripts/setup new file mode 100755 index 0000000000..e6d4c552f5 --- /dev/null +++ b/regress/scripts/setup @@ -0,0 +1,42 @@ +#!/bin/sh +# +# Script to setup running Bacula regression tests +# +cwd=`pwd` +if [ $# != 1 ] ; then + echo "Arg 1 must be a Bacula release directory." + echo " " + exit 1 +fi +if [ ! -d $1 ] ; then + echo "Arg 1 must be a Bacula release directory." + echo " " + exit 1 +fi +if [ ! -d ../depkgs ] ; then + cd .. + cwd=`pwd` + echo "The regression scripts require ${cwd}/depkgs but not found!" + echo " " + exit 1 +fi +rm -rf build bin +cp -rp $1 build +cp scripts/regress-config build +cd build +./regress-config ${cwd} +make +make install +cp src/tools/testls ../bin + +cd .. +bin/bacula stop +bin/create_sqlite_database +bin/drop_sqlite_tables +bin/make_sqlite_tables +bin/bacula start +bin/bacula stop +# +# Save Bacula default conf files for later use +# +scripts/do_sed diff --git a/regress/scripts/test-bacula-dir.conf.in b/regress/scripts/test-bacula-dir.conf.in new file mode 100644 index 0000000000..603fd48970 --- /dev/null +++ b/regress/scripts/test-bacula-dir.conf.in @@ -0,0 +1,247 @@ +# +# 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 = rufus-dir + DIRport = 8101 # where we listen for UA connections + QueryFile = "@scriptdir@/query.sql" + WorkingDirectory = "@working_dir@" + PidDirectory = "@piddir@" + SubSysDirectory = "@subsysdir@" + Maximum Concurrent Jobs = 1 + Password = "pNvX1WiXnwv2C/F7E52LGvw6rKjbbPvu2kyuPa9pVaL3" # Console password + 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=rufus-fd + FileSet="Full Set" + Storage = File + Messages = Standard + Pool = Default + Write Bootstrap = "@working_dir@/NightlySave.bsr" +} + +Job { + Name = "SparseTest" + Type = Backup + Client=rufus-fd + FileSet="SparseSet" + Storage = File + Messages = Standard + Pool = Default + Write Bootstrap = "@working_dir@/NightlySave.bsr" +} + +Job { + Name = "CompressedTest" + Type = Backup + Client=rufus-fd + FileSet="CompressedSet" + Storage = File + Messages = Standard + Pool = Default + Write Bootstrap = "@working_dir@/NightlySave.bsr" +} + +Job { + Name = "SparseCompressedTest" + Type = Backup + Client=rufus-fd + FileSet="SparseCompressedSet" + Storage = File + Messages = Standard + Pool = Default + Write Bootstrap = "@working_dir@/NightlySave.bsr" +} + + + + +# Backup the catalog database (after the nightly save) +Job { + Name = "BackupCatalog" + Type = Backup + Client=rufus-fd + FileSet="Catalog" +# Schedule = "WeeklyCycleAfterBackup" + Storage = File + Messages = Standard + Pool = Default + # This creates an ASCII copy of the catalog + RunBeforeJob = "@sbindir@/make_catalog_backup -u bacula" + # This deletes the copy of the catalog + RunAfterJob = "@sbindir@/delete_catalog_backup" + Write Bootstrap = "@working_dir@/BackupCatalog.bsr" +} + +# Standard Restore template, to be changed by Console program +Job { + Name = "RestoreFiles" + Type = Restore + Client=rufus-fd + FileSet="Full Set" + Storage = File + Messages = Standard + Pool = Default + Where = /tmp/bacula-restores +} + + +# List of files to be backed up +FileSet { + Name = "Full Set" + Include = signature=MD5 { + >test.out + echo " " +else + echo " ===== Test1 Bacula source OK ===== " + echo " ===== Test1 OK ===== " >>test.out +fi +rm -rf /tmp/bacula-restores diff --git a/regress/tests/compressed-test b/regress/tests/compressed-test new file mode 100755 index 0000000000..a483cb3999 --- /dev/null +++ b/regress/tests/compressed-test @@ -0,0 +1,48 @@ +#!/bin/sh +# +# Run a simple backup of the Bacula build directory using the compressed option +# then restore it. +# +cwd=`pwd` +scripts/copy-test-confs +rm -rf /tmp/TestVolume001 /tmp/bacula-restores +echo "${cwd}/build" >/tmp/file-list +bin/bacula stop +bin/drop_sqlite_tables +bin/make_sqlite_tables +bin/bacula start +bin/console -c bin/console.conf <>test.out + echo " " +else + echo " ===== compressed-test Bacula source OK ===== " + echo " ===== compressed-test OK ===== " >>test.out +fi +rm -rf /tmp/bacula-restores diff --git a/regress/tests/dev-test-root b/regress/tests/dev-test-root new file mode 100755 index 0000000000..99db4b6b4a --- /dev/null +++ b/regress/tests/dev-test-root @@ -0,0 +1,66 @@ +#!/bin/sh +# +# Run a simple backup of the Bacula build directory +# then restore it. +# +echo " " +echo " " +echo " === /dev save/restore test ===" +echo " " +echo " " +if [ $UID != 0 ] ; then + echo " " + echo "You must be root to run this test." + echo " ===== dev test failed!!! ===== " + echo " ===== dev test failed!!! ===== " >>test.out + echo " " + exit 1 +fi +cwd=`pwd` +scripts/copy-test-confs +echo "/dev" >/tmp/file-list +rm -rf /tmp/TestVolume001 /tmp/bacula-restores +bin/bacula stop +bin/drop_sqlite_tables +bin/make_sqlite_tables +bin/bacula start +bin/console -c bin/console.conf </tmp/original +cd /tmp/bacula-restores +${cwd}/bin/testls -e ${cwd}/scripts/exclude-etc-test dev >/tmp/restored +diff /tmp/original /tmp/restored +if [ $? != 0 ] ; then + echo " " + echo " " + echo " ===== dev test failed!!! ===== " + echo " ===== dev test failed!!! ===== " >>test.out + echo " " +else + echo " ===== dev test OK ===== " + echo " ===== dev test OK ===== " >>test.out + rm -rf /tmp/bacula-restores /tmp/original /tmp/restored + rm -rf /tmp/file-list /tmp/job /tmp/TestVolume001 +fi diff --git a/regress/tests/etc-test-root b/regress/tests/etc-test-root new file mode 100755 index 0000000000..b8ab1ac2ff --- /dev/null +++ b/regress/tests/etc-test-root @@ -0,0 +1,66 @@ +#!/bin/sh +# +# Run a simple backup of the Bacula build directory +# then restore it. +# +echo " " +echo " " +echo " === /etc save/restore test ===" +echo " " +echo " " +if [ $UID != 0 ] ; then + echo " " + echo "You must be root to run this test." + echo " ===== Test4 failed!!! ===== " + echo " ===== Test4 failed!!! ===== " >>test.out + echo " " + exit 1 +fi +cwd=`pwd` +scripts/copy-test-confs +echo "/etc" >/tmp/file-list +rm -rf /tmp/TestVolume001 /tmp/bacula-restores +bin/bacula stop +bin/drop_sqlite_tables +bin/make_sqlite_tables +bin/bacula start +bin/console -c bin/console.conf </tmp/original +cd /tmp/bacula-restores +${cwd}/bin/testls -e ${cwd}/scripts/exclude-etc-test etc >/tmp/restored +diff /tmp/original /tmp/restored +if [ $? != 0 ] ; then + echo " " + echo " " + echo " ===== Test4 /etc failed!!! ===== " + echo " ===== Test4 failed!!! ===== " >>test.out + echo " " +else + echo " ===== Test4 /etc OK ===== " + echo " ===== Test4 OK ===== " >>test.out + rm -rf /tmp/bacula-restores /tmp/original /tmp/restored + rm -rf /tmp/file-list /tmp/job /tmp/TestVolume001 +fi diff --git a/regress/tests/lib-test-root b/regress/tests/lib-test-root new file mode 100755 index 0000000000..b069eace79 --- /dev/null +++ b/regress/tests/lib-test-root @@ -0,0 +1,66 @@ +#!/bin/sh +# +# Run a simple backup of the Bacula build directory +# then restore it. +# +echo " " +echo " " +echo " === /lib save/restore test ===" +echo " " +echo " " +if [ $UID != 0 ] ; then + echo " " + echo "You must be root to run this test." + echo " ===== Test5 failed!!! ===== " + echo " ===== Test5 failed!!! ===== " >>test.out + echo " " + exit 1 +fi +cwd=`pwd` +scripts/copy-test-confs +echo "/lib" >/tmp/file-list +rm -rf /tmp/TestVolume001 /tmp/bacula-restores +bin/bacula stop +bin/drop_sqlite_tables +bin/make_sqlite_tables +bin/bacula start +bin/console -c bin/console.conf </tmp/original +cd /tmp/bacula-restores +${cwd}/bin/testls -e ${cwd}/scripts/exclude-lib-test lib >/tmp/restored +diff /tmp/original /tmp/restored +if [ $? != 0 ] ; then + echo " " + echo " " + echo " ===== Test5 /lib failed!!! ===== " + echo " ===== Test5 failed!!! ===== " >>test.out + echo " " +else + echo " ===== Test5 /lib OK ===== " + echo " ===== Test5 OK ===== " >>test.out + rm -rf /tmp/bacula-restores /tmp/original /tmp/restored + rm -rf /tmp/file-list /tmp/job /tmp/TestVolume001 +fi diff --git a/regress/tests/sparse-compressed-test b/regress/tests/sparse-compressed-test new file mode 100755 index 0000000000..50b5b9cbaa --- /dev/null +++ b/regress/tests/sparse-compressed-test @@ -0,0 +1,48 @@ +#!/bin/sh +# +# Run a simple backup of the Bacula build directory using the Sparse option +# then restore it. +# +cwd=`pwd` +scripts/copy-test-confs +rm -rf /tmp/TestVolume001 /tmp/bacula-restores +echo "${cwd}/build" >/tmp/file-list +bin/bacula stop +bin/drop_sqlite_tables +bin/make_sqlite_tables +bin/bacula start +bin/console -c bin/console.conf <>test.out + echo " " +else + echo " ===== sparse-compressed-test Bacula source OK ===== " + echo " ===== sparse-compressed-test OK ===== " >>test.out +fi +rm -rf /tmp/bacula-restores diff --git a/regress/tests/sparse-test b/regress/tests/sparse-test new file mode 100755 index 0000000000..4fa9ba4fd8 --- /dev/null +++ b/regress/tests/sparse-test @@ -0,0 +1,48 @@ +#!/bin/sh +# +# Run a simple backup of the Bacula build directory using the Sparse option +# then restore it. +# +cwd=`pwd` +scripts/copy-test-confs +rm -rf /tmp/TestVolume001 /tmp/bacula-restores +echo "${cwd}/build" >/tmp/file-list +bin/bacula stop +bin/drop_sqlite_tables +bin/make_sqlite_tables +bin/bacula start +bin/console -c bin/console.conf <>test.out + echo " " +else + echo " ===== sparse-test Bacula source OK ===== " + echo " ===== sparse-test OK ===== " >>test.out +fi +rm -rf /tmp/bacula-restores diff --git a/regress/tests/test0 b/regress/tests/test0 new file mode 100755 index 0000000000..8a6da1bf99 --- /dev/null +++ b/regress/tests/test0 @@ -0,0 +1,2 @@ +#!/bin/sh +echo " " >test.out diff --git a/regress/tests/two-jobs-test b/regress/tests/two-jobs-test new file mode 100755 index 0000000000..b64b781356 --- /dev/null +++ b/regress/tests/two-jobs-test @@ -0,0 +1,57 @@ +#!/bin/sh +# +# Run a simple backup of the Bacula build directory using the compressed option +# then backup a second time and finally restore it +# +cwd=`pwd` +scripts/copy-test-confs +rm -rf /tmp/TestVolume001 /tmp/bacula-restores +echo "${cwd}/build" >/tmp/file-list +bin/bacula stop +bin/drop_sqlite_tables +bin/make_sqlite_tables +bin/bacula start +bin/console -c bin/console.conf <>test.out + echo " " +else + echo " ===== two-jobs-test Bacula source OK ===== " + echo " ===== two-jobs-test OK ===== " >>test.out +fi +rm -rf /tmp/bacula-restores