From: Kern Sibbald Date: Sun, 25 Sep 2005 18:47:10 +0000 (+0000) Subject: fix bad script tests + add smtp_host + fix tape options X-Git-Tag: Release-1.38.0~102 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=71c408b379b05c89204c014a32781c732309c782;p=bacula%2Fbacula fix bad script tests + add smtp_host + fix tape options git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@2402 91ce42f0-d328-0410-95d8-f526ca767f89 --- diff --git a/regress/Makefile.in b/regress/Makefile.in index 6b23951e2f..d5d82a5053 100644 --- a/regress/Makefile.in +++ b/regress/Makefile.in @@ -32,11 +32,11 @@ bacula: all sed rm -rf tmp working mkdir tmp working echo "Doing: scripts/setup ${BACULA_SOURCE} ${EMAIL} ${WHICHDB} ${TCPWRAPPERS}" - scripts/setup ${BACULA_SOURCE} ${EMAIL} ${WHICHDB} ${TCPWRAPPERS} + scripts/setup ${BACULA_SOURCE} ${EMAIL} ${WHICHDB} ${TCPWRAPPERS} ${SMTP_HOST} sed: - echo "Doing: scripts/do_sed ${EMAIL} ${TAPE_DRIVE} ${AUTOCHANGER} ${AUTOCHANGER_PATH} ${TAPE_DRIVE1}" - scripts/do_sed ${EMAIL} ${TAPE_DRIVE} ${AUTOCHANGER} ${AUTOCHANGER_PATH} ${TAPE_DRIVE1} + echo "Doing: scripts/do_sed ${EMAIL} ${TAPE_DRIVE} ${AUTOCHANGER} ${AUTOCHANGER_PATH} ${TAPE_DRIVE1} ${SMTP_HOST}" + scripts/do_sed ${EMAIL} ${TAPE_DRIVE} ${AUTOCHANGER} ${AUTOCHANGER_PATH} ${TAPE_DRIVE1} ${SMTP_HOST} # Run all non-root userid tests test: diff --git a/regress/kern.conf b/regress/kern.conf index b87dd8e8b5..55d6030c5c 100644 --- a/regress/kern.conf +++ b/regress/kern.conf @@ -1,8 +1,10 @@ # Where to get the source to be tested +# BACULA_SOURCE="${HOME}/bacula/branch-1.36.2" BACULA_SOURCE="${HOME}/bacula/k" # Where to send email !!!!! Change me !!!!!!! EMAIL=kern@sibbald.com +SMTP_HOST="localhost" # Full "default" path where to find sqlite (no quotes!) SQLITE_DIR=${HOME}/bacula/depkgs/sqlite @@ -10,12 +12,14 @@ SQLITE_DIR=${HOME}/bacula/depkgs/sqlite TAPE_DRIVE="/dev/nst0" # if you don't have an autochanger set AUTOCHANGER to /dev/null AUTOCHANGER="/dev/sg0" +# For two drive tests -- set to /dev/null if you do not have it +TAPE_DRIVE1="/dev/nst1" # This must be the path to the autochanger including its name AUTOCHANGER_PATH="/usr/sbin/mtx" # Set your database here -WHICHDB="--with-sqlite=${SQLITE_DIR}" +WHICHDB?="--with-sqlite=${SQLITE_DIR}" #WHICHDB="--with-mysql=${HOME}/mysql" # Set this to "--with-tcp-wrappers" or "--without-tcp-wrappers" diff --git a/regress/prototype.conf b/regress/prototype.conf index 70d931f8ff..28f5d3ee5e 100644 --- a/regress/prototype.conf +++ b/regress/prototype.conf @@ -12,6 +12,7 @@ BACULA_SOURCE= # Where to send email messages # EMAIL= +SMTP_HOST=localhost # Full "default" path where to find sqlite. # This is only used if you do not specify a database override on the @@ -43,4 +44,3 @@ WHICHDB?="--with-sqlite=${SQLITE_DIR}" # Set this to "--with-tcp-wrappers" or "--without-tcp-wrappers" TCPWRAPPERS="--with-tcp-wrappers" - diff --git a/regress/scripts/bacula-dir-win32-tape.conf b/regress/scripts/bacula-dir-win32-tape.conf index 7877b8da3f..b9d3cf2c81 100644 --- a/regress/scripts/bacula-dir-win32-tape.conf +++ b/regress/scripts/bacula-dir-win32-tape.conf @@ -127,7 +127,7 @@ Messages { # Message delivery for daemon messages (no job). Messages { Name = Daemon - mailcommand = "/home/kern/bacula/regress/bin/bsmtp -h @smtp_host@ -f \"\(Bacula\) %r\" -s \"Bacula daemon message\" %r" + mailcommand = "/home/kern/bacula/regress/bin/bsmtp -h localhost -f \"\(Bacula\) %r\" -s \"Bacula daemon message\" %r" mail = kern@sibbald.com = all, !skipped console = all, !skipped, !saved append = "/home/kern/bacula/regress/working/log" = all, !skipped diff --git a/regress/scripts/cleanup-2drive.in b/regress/scripts/cleanup-2drive.in index e0857f7995..b15c3a93f9 100755 --- a/regress/scripts/cleanup-2drive.in +++ b/regress/scripts/cleanup-2drive.in @@ -4,23 +4,23 @@ # scripts/cleanup -if ! test x@autochanger@ = x/dev/null; then +if test ! x@autochanger@ = x/dev/null; then slot=`bin/mtx-changer @autochanger@ loaded 0 @tape_drive1@ 1` echo "Slot $slot in drive 1" - if ! test x$slot = x0 ; then + if test ! x$slot = x0 ; then echo "unload slot $slot in drive 1" bin/mtx-changer @autochanger@ unload $slot @tape_drive1@ 1 fi slot=`bin/mtx-changer @autochanger@ loaded 0 @tape_drive@ 0` echo "Slot $slot in drive 0" - if ! test x$slot = x0 ; then + if test ! x$slot = x0 ; then echo "unload slot $slot in drive 0" bin/mtx-changer @autochanger@ unload $slot @tape_drive@ 0 fi slot=`bin/mtx-changer @autochanger@ loaded 0 @tape_drive1@ 1` - if ! test x$slot = x2; then + if test ! x$slot = x2; then echo "load slot 2 in drive 1" bin/mtx-changer @autochanger@ load 2 @tape_drive1@ 1 fi @@ -32,7 +32,7 @@ if ! test x@autochanger@ = x/dev/null; then slot=`bin/mtx-changer @autochanger@ loaded 0 @tape_drive@ 0` echo "Slot $slot in drive 0" - if ! test x$slot = x1; then + if test ! x$slot = x1; then echo "load slot 1 in drive 0" bin/mtx-changer @autochanger@ load 1 @tape_drive@ 0 fi diff --git a/regress/scripts/cleanup-2tape.in b/regress/scripts/cleanup-2tape.in index 91cbb93288..737fe884e2 100755 --- a/regress/scripts/cleanup-2tape.in +++ b/regress/scripts/cleanup-2tape.in @@ -4,9 +4,9 @@ # scripts/cleanup -if ! test x@autochanger@ = x/dev/null; then +if test ! x@autochanger@ = x/dev/null; then drive=`bin/mtx-changer @autochanger@ loaded` - if ! test x$drive = x2; then + if test ! x$drive = x2; then bin/mtx-changer @autochanger@ unload 0 @tape_drive@ 0 bin/mtx-changer @autochanger@ load 2 @tape_drive@ 0 fi @@ -18,9 +18,9 @@ fi # # If we have an autochanger always load tape in slot 1 # -if ! test x@autochanger@ = x/dev/null; then +if test ! x@autochanger@ = x/dev/null; then drive=`bin/mtx-changer @autochanger@ loaded` - if ! test x$drive = x1; then + if test ! x$drive = x1; then bin/mtx-changer @autochanger@ unload 0 @tape_drive@ 0 bin/mtx-changer @autochanger@ load 1 @tape_drive@ 0 fi diff --git a/regress/scripts/do_sed b/regress/scripts/do_sed index c4effe98f9..2f5791cf81 100755 --- a/regress/scripts/do_sed +++ b/regress/scripts/do_sed @@ -1,11 +1,12 @@ #!/bin/sh # -if test $# != 5 ; then +if test $# != 6 ; then echo "First arg must be email name" echo " and the second must be a tape drive" echo " and the third must be a tape control name or /dev/null" echo " and the fourth must be the full path to the mtx program" echo " and the fifth must be tape drive 1 or /dev/null" + echo " and the sixth must be the smtp or email host" exit 1 fi out="/tmp/sed_tmp" @@ -28,6 +29,7 @@ echo "s%@tmpdir@%${cwd}/tmp%g" >>${out} echo "s%@hostname@%${host}%g" >>${out} echo "s%@changer_path@%${4}%g" >>${out} echo "s%@tape_drive1@%${5}%g" >>${out} +echo "s%@smtp_host@%${6}%g" >>${out} # process .in files with sed script sed -f ${out} ${cwd}/scripts/test-bacula-dir.conf.in >${cwd}/scripts/test-bacula-dir.conf @@ -55,11 +57,11 @@ chmod 777 ${cwd}/bin/mtx-changer # get proper SD tape definitions touch ${cwd}/bin/tape_options -if test x`uname` = xLinux ; then \ - cp -f ${cwd}/scripts/linux_tape_options ${cwd}/bin/tape_options ; \ +if test x`uname` = xLinux ; then + cp -f ${cwd}/scripts/linux_tape_options ${cwd}/bin/tape_options fi -if test x`uname` = xFreeBSD ; then \ - cp -f ${cwd}/scripts/freebsd_tape_options ${cwd}/bin/tape_options ; \ +if test x`uname` = xFreeBSD ; then + cp -f ${cwd}/scripts/freebsd_tape_options ${cwd}/bin/tape_options fi rm -f ${out} diff --git a/regress/scripts/regress-config b/regress/scripts/regress-config index 95c8883892..2fa59ffbcd 100755 --- a/regress/scripts/regress-config +++ b/regress/scripts/regress-config @@ -15,6 +15,7 @@ CFLAGS="-g -O2 -Wall" \ --with-working-dir=$1/working \ --with-dump-email=$2 \ --with-job-email=$2 \ + --with-smtp-host=$5 \ $3 \ --with-baseport=8101 \ $4 diff --git a/regress/scripts/setup b/regress/scripts/setup index 1f8ba1b5d7..66b3634aca 100755 --- a/regress/scripts/setup +++ b/regress/scripts/setup @@ -3,7 +3,7 @@ # Script to setup running Bacula regression tests # cwd=`pwd` -if [ $# != 4 ] ; then +if [ $# != 5 ] ; then echo "Incorrect number of arguments. Got $#. Need:" echo "setup bacula-src email-address --with-DBNAME --with-tcp-wrappers" echo " " @@ -22,7 +22,7 @@ cp scripts/regress-config build cd build rm -f Makefile config.cache # Run Bacula configuration, make, install -./regress-config ${cwd} $2 $3 $4 +./regress-config ${cwd} $2 $3 $4 $5 make make install cp src/tools/testls ../bin diff --git a/regress/tests/differential-test b/regress/tests/differential-test index 916cec507f..3182e98cb7 100755 --- a/regress/tests/differential-test +++ b/regress/tests/differential-test @@ -31,8 +31,8 @@ cat <tmp/bconcmds @$out /dev/null messages @$out tmp/log1.out -label storage=File volume=TestVolume001 label storage=File volume=TestVolume002 +label storage=File volume=TestVolume001 run job=CompressedTest yes wait messages @@ -56,7 +56,7 @@ cat <tmp/bconcmds messages @$out tmp/log1.out @# Force differential on the second Volume -update volume=TestVolume001 VolStatus=Used +update volume=TestVolume002 VolStatus=Used run level=differential job=CompressedTest yes wait messages diff --git a/regress/tests/two-vol-test b/regress/tests/two-vol-test index ddf0931803..876b8fa011 100755 --- a/regress/tests/two-vol-test +++ b/regress/tests/two-vol-test @@ -3,6 +3,13 @@ # Run a simple backup of the Bacula build directory but # split the archive into two volumes # +debug=0 +if test "$debug" -eq 1 ; then + out="tee" +else + out="output" +fi + cwd=`pwd` scripts/copy-test-confs scripts/cleanup @@ -14,30 +21,36 @@ echo " === Starting two-vol-test at `date +%R:%S` ===" echo " === Starting two-vol-test at `date +%R:%S` ===" >working/log echo " " -bin/bacula start 2>&1 >/dev/null -# bin/bacula start -bin/bconsole -c bin/bconsole.conf <&1 >/dev/null -#bin/bconsole -c bin/bconsole.conf <tmp/bconcmds +@$out /dev/null messages -@output tmp/log1.out -label storage=File1 volume=TestVolume001 +@$out tmp/log1.out label storage=File1 volume=TestVolume002 -update Volume=TestVolume001 MaxVolBytes=3000000 +label storage=File1 volume=TestVolume001 +update Volume=TestVolume002 MaxVolBytes=3000000 run job=NightlySave storage=File1 yes wait messages @# @# now do a restore @# -@output tmp/log2.out +@$out tmp/log2.out restore where=${cwd}/tmp/bacula-restores select all storage=File1 done yes wait messages -@output +@$out quit END_OF_DATA + +if test "$debug" -eq 1 ; then + bin/bacula start + cat tmp/bconcmds | bin/bconsole -c bin/bconsole.conf +else + bin/bacula start 2>&1 >/dev/null + cat tmp/bconcmds | bin/bconsole -c bin/bconsole.conf 2>&1 >/dev/null +fi + scripts/check_for_zombie_jobs storage=File1 bin/bacula stop 2>&1 >/dev/null grep "^ Termination: *Backup OK" tmp/log1.out 2>&1 >/dev/null