From 7f12b27408ab878d9dd8223aca910c413731301a Mon Sep 17 00:00:00 2001 From: Kern Sibbald Date: Mon, 5 May 2003 10:31:48 +0000 Subject: [PATCH] Clean up scripts git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@492 91ce42f0-d328-0410-95d8-f526ca767f89 --- regress/README | 32 ++++++++++++++++++------- regress/all-root-tests | 8 +++++++ regress/all-tests | 12 ++-------- regress/scripts/do_sed | 1 + regress/scripts/regress-config | 6 ++--- regress/scripts/setup | 16 ++++++++----- regress/scripts/test-bacula-dir.conf.in | 21 ++++++++++++---- regress/tests/backup-bacula-test | 2 +- regress/tests/compressed-test | 2 +- regress/tests/dev-test-root | 6 ++--- regress/tests/etc-test-root | 8 +++---- regress/tests/lib-test-root | 8 +++---- regress/tests/sparse-compressed-test | 2 +- regress/tests/sparse-test | 2 +- regress/tests/two-jobs-test | 2 +- regress/tests/verify-vol-test | 9 +++---- 16 files changed, 86 insertions(+), 51 deletions(-) create mode 100755 regress/all-root-tests diff --git a/regress/README b/regress/README index e9ebb627dd..fb6547d156 100644 --- a/regress/README +++ b/regress/README @@ -2,19 +2,32 @@ Kern Sibbald April 2003 -This is Bacula's regression script directory. +This is Bacula's regression script directory. At this time +(May 2003), it is still in development, so all the tests are +not complete. 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. +!!!!!!!!!! IMPORTANT !!!!!!!! +Second, edit the EMAIL address in the Makefile to be your +email address and not mine or I will get LOTS of unwanted +email! + +Third, edit the DEPKGS path in the Makefile to point to the +depkgs directory. + +Fourth, make sure that depkgs is pre-built if it isn't +already: (cd your-depkgs; make sqlite). Then do: make setup -You run the above one time. +You run the above one time. This will copy the Bacula +source, configure, build it, and configure all the scripts +and conf files. If you change your source, you will need +to redo this command. 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 @@ -32,6 +45,7 @@ compressed-test sparse-compressed-test two-jobs-test wierd-files-test +verify-vol-test The tests expect you to execute them from the main regress directory! @@ -40,14 +54,15 @@ You can run them individually as: tests/two-jobs-test -or all tests: +or all non-root tests (my normal testing under my account) + + ./all-non-root-tests + +or all tests (I only run these before a production release): 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: @@ -55,3 +70,4 @@ to do: make reset this cleans up any files that may be created with root permissions. + diff --git a/regress/all-root-tests b/regress/all-root-tests new file mode 100755 index 0000000000..723289b571 --- /dev/null +++ b/regress/all-root-tests @@ -0,0 +1,8 @@ +#!/bin/sh +# +# Run all root tests +# +tests/dev-test-root +tests/etc-test-root +tests/lib-test-root +cat test.out diff --git a/regress/all-tests b/regress/all-tests index d8b5d1a053..8ab0e6be9d 100755 --- a/regress/all-tests +++ b/regress/all-tests @@ -2,14 +2,6 @@ # # 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 +./all-non-root-tests +./all-root-tests cat test.out diff --git a/regress/scripts/do_sed b/regress/scripts/do_sed index 61ea5fcb39..d063b45624 100755 --- a/regress/scripts/do_sed +++ b/regress/scripts/do_sed @@ -7,6 +7,7 @@ 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} +echo "s%@job_email@%${1}%g">>${out} # process .in files with sed script sed -f ${out} ${cwd}/scripts/test-bacula-dir.conf.in >${cwd}/scripts/test-bacula-dir.conf diff --git a/regress/scripts/regress-config b/regress/scripts/regress-config index 2e95818317..1d4737c1fc 100755 --- a/regress/scripts/regress-config +++ b/regress/scripts/regress-config @@ -10,10 +10,10 @@ CFLAGS="-g -O2 -Wall" \ --with-pid-dir=$1/bin/working \ --with-subsys-dir=$1/bin/working \ --enable-smartalloc \ - --with-sqlite=$1/../depkgs/sqlite \ + --with-sqlite=$2 \ --with-working-dir=$1/bin/working \ - --with-dump-email=kern+ok@sibbald.com \ - --with-job-email=kern+ok@sibbald.com \ + --with-dump-email=$3 \ + --with-job-email=$3 \ --with-baseport=8101 exit 0 diff --git a/regress/scripts/setup b/regress/scripts/setup index 242291e865..48d71231d3 100755 --- a/regress/scripts/setup +++ b/regress/scripts/setup @@ -3,8 +3,9 @@ # Script to setup running Bacula regression tests # cwd=`pwd` -if [ $# != 1 ] ; then - echo "Arg 1 must be a Bacula release directory." +if [ $# != 3 ] ; then + echo "Incorrect number of arguments. Need:" + echo "setup bacula-src depkgs email-address" echo " " exit 1 fi @@ -13,18 +14,21 @@ if [ ! -d $1 ] ; then echo " " exit 1 fi -if [ ! -d ../depkgs ] ; then +if [ ! -d $2 ] ; then cd .. cwd=`pwd` - echo "The regression scripts require ${cwd}/depkgs but not found!" + echo "The regression scripts require DEPKGS as arg 2 but not found!" echo " " exit 1 fi rm -rf build bin +# Copy new source cp -rp $1 build cp scripts/regress-config build cd build -./regress-config ${cwd} +rm -f Makefile config.cache +# Run Bacula configuration, make, install +./regress-config ${cwd} $2 $3 make make install cp src/tools/testls ../bin @@ -34,10 +38,10 @@ bin/bacula stop bin/create_sqlite_database bin/drop_sqlite_tables bin/make_sqlite_tables +# Start and stop Bacula to ensure conf files are OK bin/bacula start bin/bacula stop # # Save Bacula default conf files for later use # cp -f bin/*.conf scripts -scripts/do_sed diff --git a/regress/scripts/test-bacula-dir.conf.in b/regress/scripts/test-bacula-dir.conf.in index 3fee9d8476..6dc0d244dc 100644 --- a/regress/scripts/test-bacula-dir.conf.in +++ b/regress/scripts/test-bacula-dir.conf.in @@ -234,10 +234,10 @@ Catalog { # and to the console Messages { Name = Standard - mailcommand = "@sbindir@/smtp -h localhost -f \"\(Bacula\) %r\" -s \"Bacula: %t %e of %c %l\" %r" - operatorcommand = "@sbindir@/smtp -h localhost -f \"\(Bacula\) %r\" -s \"Bacula: Intervention needed for %j\" %r" - MailOnError = kern+ok@sibbald.com = all - operator = kern+ok@sibbald.com = mount + mailcommand = "@sbindir@/smtp -h localhost -f \"\(Bacula Regression\) %r\" -s \"Bacula: %t %e of %c %l\" %r" + operatorcommand = "@sbindir@/smtp -h localhost -f \"\(Bacula Regression\) %r\" -s \"Bacula: Intervention needed for %j\" %r" + MailOnError = @job_email@ = all + operator = @job_email@ = mount console = all, !skipped # # WARNING! the following will create a file that you must cycle from @@ -246,6 +246,19 @@ Messages { # append = "@working_dir@/log" = all, !skipped } + +Messages { + Name = NoEmail + mailcommand = "@sbindir@/smtp -h localhost -f \"\(Bacula Regression\) %r\" -s \"Bacula: %t %e of %c %l\" %r" + console = all, !skipped +# +# WARNING! the following will create a file that you must cycle from +# time to time as it will grow indefinitely. However, it will +# also keep all your messages if the scroll off the console. +# + append = "@working_dir@/log" = all, !skipped +} + # Default pool definition Pool { diff --git a/regress/tests/backup-bacula-test b/regress/tests/backup-bacula-test index a1f6507305..a8039eebd0 100755 --- a/regress/tests/backup-bacula-test +++ b/regress/tests/backup-bacula-test @@ -51,5 +51,5 @@ if [ $? != 0 ] ; then else echo " ===== Backup Bacula Test OK ===== " echo " ===== Backup Bacula Test OK ===== " >>test.out + rm -rf /tmp/bacula-restores /tmp/TestVolume001 fi -rm -rf /tmp/bacula-restores diff --git a/regress/tests/compressed-test b/regress/tests/compressed-test index f41d915f66..c7c4034935 100755 --- a/regress/tests/compressed-test +++ b/regress/tests/compressed-test @@ -50,5 +50,5 @@ if [ $? != 0 ] ; then else echo " ===== compressed-test Bacula source OK ===== " echo " ===== compressed-test OK ===== " >>test.out + rm -rf /tmp/bacula-restores /tmp/TestVolume001 fi -rm -rf /tmp/bacula-restores diff --git a/regress/tests/dev-test-root b/regress/tests/dev-test-root index 99db4b6b4a..23d3fddf8c 100755 --- a/regress/tests/dev-test-root +++ b/regress/tests/dev-test-root @@ -48,9 +48,9 @@ quit END_OF_DATA bin/bacula stop cd / -${cwd}/bin/testls -e ${cwd}/scripts/exclude-etc-test dev >/tmp/original +${cwd}/bin/testls -e ${cwd}/scripts/exclude-etc-test dev >${cwd}/tmp/original cd /tmp/bacula-restores -${cwd}/bin/testls -e ${cwd}/scripts/exclude-etc-test dev >/tmp/restored +${cwd}/bin/testls -e ${cwd}/scripts/exclude-etc-test dev >${cwd}/tmp/restored diff /tmp/original /tmp/restored if [ $? != 0 ] ; then echo " " @@ -61,6 +61,6 @@ if [ $? != 0 ] ; then else echo " ===== dev test OK ===== " echo " ===== dev test OK ===== " >>test.out - rm -rf /tmp/bacula-restores /tmp/original /tmp/restored + rm -rf /tmp/bacula-restores ${cwd}/tmp/original ${cwd}/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 index b8ab1ac2ff..c7adb3b52a 100755 --- a/regress/tests/etc-test-root +++ b/regress/tests/etc-test-root @@ -48,10 +48,10 @@ quit END_OF_DATA bin/bacula stop cd / -${cwd}/bin/testls -e ${cwd}/scripts/exclude-etc-test etc >/tmp/original +${cwd}/bin/testls -e ${cwd}/scripts/exclude-etc-test etc >${cwd}/tmp/original cd /tmp/bacula-restores -${cwd}/bin/testls -e ${cwd}/scripts/exclude-etc-test etc >/tmp/restored -diff /tmp/original /tmp/restored +${cwd}/bin/testls -e ${cwd}/scripts/exclude-etc-test etc >${cwd}/tmp/restored +diff ${cwd}/tmp/original ${cwd}/tmp/restored if [ $? != 0 ] ; then echo " " echo " " @@ -61,6 +61,6 @@ if [ $? != 0 ] ; then else echo " ===== Test4 /etc OK ===== " echo " ===== Test4 OK ===== " >>test.out - rm -rf /tmp/bacula-restores /tmp/original /tmp/restored + rm -rf /tmp/bacula-restores ${cwd}/tmp/original ${cwd}/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 index b069eace79..c0d9b2b994 100755 --- a/regress/tests/lib-test-root +++ b/regress/tests/lib-test-root @@ -48,10 +48,10 @@ quit END_OF_DATA bin/bacula stop cd / -${cwd}/bin/testls -e ${cwd}/scripts/exclude-lib-test lib >/tmp/original +${cwd}/bin/testls -e ${cwd}/scripts/exclude-lib-test lib >${cwd}/tmp/original cd /tmp/bacula-restores -${cwd}/bin/testls -e ${cwd}/scripts/exclude-lib-test lib >/tmp/restored -diff /tmp/original /tmp/restored +${cwd}/bin/testls -e ${cwd}/scripts/exclude-lib-test lib >${cwd}/tmp/restored +diff ${cwd}/tmp/original ${cwd}/tmp/restored if [ $? != 0 ] ; then echo " " echo " " @@ -61,6 +61,6 @@ if [ $? != 0 ] ; then else echo " ===== Test5 /lib OK ===== " echo " ===== Test5 OK ===== " >>test.out - rm -rf /tmp/bacula-restores /tmp/original /tmp/restored + rm -rf /tmp/bacula-restores ${cwd}/tmp/original ${cwd}/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 index b0e6f89b6d..0ec78a4873 100755 --- a/regress/tests/sparse-compressed-test +++ b/regress/tests/sparse-compressed-test @@ -51,5 +51,5 @@ if [ $? != 0 ] ; then else echo " ===== sparse-compressed-test Bacula source OK ===== " echo " ===== sparse-compressed-test OK ===== " >>test.out + rm -rf /tmp/bacula-restores /tmp/TestVolume001 fi -rm -rf /tmp/bacula-restores diff --git a/regress/tests/sparse-test b/regress/tests/sparse-test index 443c4440f4..9d536dc2f7 100755 --- a/regress/tests/sparse-test +++ b/regress/tests/sparse-test @@ -50,5 +50,5 @@ if [ $? != 0 ] ; then else echo " ===== sparse-test Bacula source OK ===== " echo " ===== sparse-test OK ===== " >>test.out + rm -rf /tmp/bacula-restores /tmp/TestVolume001 fi -rm -rf /tmp/bacula-restores diff --git a/regress/tests/two-jobs-test b/regress/tests/two-jobs-test index df56983ba4..374d988337 100755 --- a/regress/tests/two-jobs-test +++ b/regress/tests/two-jobs-test @@ -59,5 +59,5 @@ if [ $? != 0 ] ; then else echo " ===== two-jobs-test Bacula source OK ===== " echo " ===== two-jobs-test OK ===== " >>test.out + rm -rf /tmp/bacula-restores /tmp/TestVolume001 fi -rm -rf /tmp/bacula-restores diff --git a/regress/tests/verify-vol-test b/regress/tests/verify-vol-test index 036a669f38..5d39ab13e2 100755 --- a/regress/tests/verify-vol-test +++ b/regress/tests/verify-vol-test @@ -6,6 +6,7 @@ cwd=`pwd` scripts/copy-test-confs rm -rf /tmp/TestVolume001 /tmp/bacula-restores +rm -f tmp/original bin/bacula stop 2>&1 >/dev/null bin/drop_sqlite_tables bin/make_sqlite_tables @@ -32,14 +33,14 @@ messages run job=VerifyVolume yes wait -@tee /tmp/original +@tee ${cwd}/tmp/original messages @output quit END_OF_DATA sleep 2 bin/bacula stop -grep "Termination: *Verify OK" /tmp/original 2>&1 >/dev/null +grep "Termination: *Verify OK" ${cwd}/tmp/original 2>&1 >/dev/null if [ $? != 0 ] ; then echo " " echo " " @@ -49,6 +50,6 @@ if [ $? != 0 ] ; then else echo " ===== Verify Volume Test OK ===== " echo " ===== Verify Volume Test OK ===== " >>test.out + rm -rf /tmp/bacula-restores /tmp/TestVolume001 + rm -f ${cwd}/tmp/original fi -rm -rf /tmp/bacula-restores -rm -f /tmp/original -- 2.39.5