From 8c5b42f368b0949b8b6d5b0ec96faf065ba5e185 Mon Sep 17 00:00:00 2001 From: Kern Sibbald Date: Thu, 6 Sep 2007 16:50:58 +0000 Subject: [PATCH] Restructure regress configuration git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@5480 91ce42f0-d328-0410-95d8-f526ca767f89 --- regress/{Makefile.in => Makefile} | 25 +++++++----------- regress/README | 12 ++++----- regress/config | 9 ------- regress/prototype.conf | 4 +++ regress/scripts/do_sed | 31 ++++++---------------- regress/scripts/functions | 5 ++-- regress/scripts/regress-config | 43 +++++++++++-------------------- regress/scripts/setup | 16 +++++------- 8 files changed, 50 insertions(+), 95 deletions(-) rename regress/{Makefile.in => Makefile} (64%) delete mode 100755 regress/config diff --git a/regress/Makefile.in b/regress/Makefile similarity index 64% rename from regress/Makefile.in rename to regress/Makefile index 6d8c2505ed..d33f78c0cf 100644 --- a/regress/Makefile.in +++ b/regress/Makefile @@ -1,18 +1,13 @@ # # Makefile for Bacula regression testing # -# Note, Makefile is built from Makefile.in, which you should not really -# need to change, by envoking: -# -# ./config -# e.g. -# -# ./config kern.conf -# +# Before running, you must create a file named config containing +# the configuration parameters. Create it by doing: +# +# cp prototype.conf config # - -# suck in user's configuration -@CONFIG@ +# Then edit config and set the value for what are appropriate for you. +# first_rule: all @@ -33,12 +28,12 @@ bacula: all @rm -f w.tar.gz w.tar @rm -rf tmp working mkdir tmp working - echo "Doing: scripts/setup ${BACULA_SOURCE} ${EMAIL} ${WHICHDB} ${TCPWRAPPERS} ${OPENSSL}" - scripts/setup ${BACULA_SOURCE} ${EMAIL} ${WHICHDB} ${TCPWRAPPERS} ${SMTP_HOST} ${OPENSSL} + echo "Doing: scripts/setup" + scripts/setup sed: - 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} + echo "Doing: scripts/do_sed" + scripts/do_sed # Run all non-root userid tests test: diff --git a/regress/README b/regress/README index 09dbc73bbe..d289c630a3 100644 --- a/regress/README +++ b/regress/README @@ -13,13 +13,12 @@ system uses MySQL, you can use SQLite here. To set it up, create your personal configuration file, by -copying prototype.conf to xxx.conf or simply editing prototype.conf -directly. +copying prototype.conf to config or simply editing prototype.conf +directly then copying it to the file config. -Then edit your conf file and define appropriate values -for the variables that are in that file. If you want to see -a real example, look at kern.conf, but please don't use my -email address! +You must end up with a file named config in the main regress +directory that has all the specifications that correspond to +your system. If you are using SQLite, make sure that depkgs is pre-built if it isn't already: (cd your-depkgs; make sqlite). @@ -38,7 +37,6 @@ SQLite as the database, while my production uses MySQL. Then do: - ./config xxx.conf make setup You run the above one time. This will build a Makefile from diff --git a/regress/config b/regress/config deleted file mode 100755 index 6088502400..0000000000 --- a/regress/config +++ /dev/null @@ -1,9 +0,0 @@ -#/bin/sh -# -# First argument is expected to be a user's configuration file -# -if ! test -f $1 ; then - echo "Arg1 must specify a config file (e.g. prototype.conf)" - exit 1 -fi -sed -e "/@CONFIG@/r $1" -e "s/@CONFIG@//" Makefile.in >Makefile diff --git a/regress/prototype.conf b/regress/prototype.conf index eebf594360..17053a9423 100644 --- a/regress/prototype.conf +++ b/regress/prototype.conf @@ -35,3 +35,7 @@ TCPWRAPPERS="--with-tcp-wrappers" # Bacula configuration options here, such as --disable-batch-insert # OPENSSL="--with-openssl" + +# You may put your real host name here, but localhost is valid also +# and it has the advantage that it works on a non-newtworked machine +HOST="localhost" diff --git a/regress/scripts/do_sed b/regress/scripts/do_sed index ea614601b3..a7f2ac7dc0 100755 --- a/regress/scripts/do_sed +++ b/regress/scripts/do_sed @@ -1,40 +1,25 @@ #!/bin/sh # -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 cwd=`pwd` +. ${cwd}/config mkdir -p ${cwd}/bin out="/tmp/sed_tmp" -HOST="localhost" # Create sed command script echo "s%@sbindir@%${cwd}/bin%g" >${out} echo "s%@scriptdir@%${cwd}/bin%g" >>${out} echo "s%@working_dir@%${cwd}/working%g" >>${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%@autochanger@%${3}%g" >>${out} +echo "s%@job_email@%${EMAIL}%g" >>${out} +echo "s%@tape_drive@%${TAPE_DRIVE}%g" >>${out} +echo "s%@autochanger@%${AUTOCHANGER}%g" >>${out} 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} +echo "s%@changer_path@%${AUTOCHANGER_PATH}%g" >>${out} +echo "s%@tape_drive1@%${TAPE_DRIVE1}%g" >>${out} +echo "s%@smtp_host@%${SMTP_HOST}%g" >>${out} echo "s%@disk_drive@%${cwd}/tmp/disk-changer%g" >>${out} -echo "# " >config.out -echo "# Autochanger conf" >>config.out -echo "# " >>config.out -echo "AUTOCHANGER=\"${3}\"" >>config.out -echo "TAPE_DRIVE1=\"${5}\"" >>config.out - # process .in files with sed script sed -f ${out} ${cwd}/scripts/bacula-dir.conf.errors.in >${cwd}/scripts/bacula-dir.conf.errors @@ -79,7 +64,7 @@ sed s%/tmp%${cwd}/tmp%g /tmp/bac$$ >${cwd}/bin/bacula-sd.conf chmod 777 ${cwd}/scripts/cleanup-*tape ${cwd}/scripts/cleanup-*drive ${cwd}/scripts/prepare-two-tapes rm -f /tmp/bac$$ cp ${cwd}/bin/mtx-changer /tmp/bac$$ -sed "s%^MTX.*$%MTX=${4}%g" /tmp/bac$$ >${cwd}/bin/mtx-changer +sed "s%^MTX.*$%MTX=${AUTOCHANGER_PATH}%g" /tmp/bac$$ >${cwd}/bin/mtx-changer chmod 777 ${cwd}/bin/mtx-changer # get proper SD tape definitions diff --git a/regress/scripts/functions b/regress/scripts/functions index 4791db9c7a..910b57fe04 100644 --- a/regress/scripts/functions +++ b/regress/scripts/functions @@ -177,6 +177,5 @@ else set_debug 0 fi -# Source the second drive variables -touch ${cwd}/config.out -. ${cwd}/config.out +# Source the configuration variables +. ${cwd}/config diff --git a/regress/scripts/regress-config b/regress/scripts/regress-config index f68ea08fb6..3d288c83f7 100755 --- a/regress/scripts/regress-config +++ b/regress/scripts/regress-config @@ -3,39 +3,26 @@ # This is the configuration script for regression testing # -if test "x${CONFIG_SHELL}" != "x"; then - CONFIG_SHELL=/bin/sh -fi +. ${1}/config -# Handle Solaris compiler (possibly some others) -VERSION="`cc --version | head -1 | awk '{ print $2 }' 2> /dev/null`" - -if [ -n "${VERSION}" -a "${VERSION}" = "(GCC)" ]; then - OPTIMIZE="-O2" - WARNINGS="-Wall" -else - OPTIMIZE="-O" - WARNINGS="-v" -fi - -CFLAGS="-g ${OPTIMIZE} ${WARNINGS}" \ +CFLAGS="-g -O2 -Wall" \ ./configure \ - --sbindir=$1/bin \ - --sysconfdir=$1/bin \ - --mandir=$1/bin \ - --with-pid-dir=$1/working \ - --with-subsys-dir=$1/working \ + --sbindir=${1}/bin \ + --sysconfdir=${1}/bin \ + --mandir=${1}/bin \ + --with-pid-dir=${1}/working \ + --with-subsys-dir=${1}/working \ --enable-smartalloc \ --disable-readline \ - --with-working-dir=$1/working \ - --with-dump-email=$2 \ - --with-job-email=$2 \ - --with-smtp-host=$5 \ + --with-working-dir=${1}/working \ + --with-dump-email=${EMAIL} \ + --with-job-email=${EMAIL} \ + --with-smtp-host=${SMTP_HOST} \ --with-db-name=regress \ --with-db-user=regress \ - $3 \ - --with-baseport=8101 \ - $4 \ - $6 + ${OPENSSL} \ + ${TCPWRAPPERS} \ + ${WHICHDB} \ + --with-baseport=8101 exit 0 diff --git a/regress/scripts/setup b/regress/scripts/setup index 9b592f6664..67a2c9a780 100755 --- a/regress/scripts/setup +++ b/regress/scripts/setup @@ -11,27 +11,23 @@ check_exit_code() fi } +. ./config + cwd=`pwd` -if [ $# != 6 ] ; then - echo "Incorrect number of arguments. Got $#. Need:" - echo "setup bacula-src email-address --with-DBNAME --with-tcp-wrappers" - echo " " - exit 1 -fi -if [ ! -d $1 ] ; then +if [ ! -d ${BACULA_SOURCE} ] ; then echo "Arg 1 must be a Bacula release directory." echo " " exit 1 fi rm -rf build bin # Copy new source -echo "Copying source from $1" -cp -rp $1 build +echo "Copying source from ${BACULA_SOURCE}" +cp -rp ${BACULA_SOURCE} build cp scripts/regress-config build cd build rm -f Makefile config.cache # Run Bacula configuration, make, install -./regress-config ${cwd} $2 $3 $4 $5 $6 +./regress-config ${cwd} check_exit_code # Cleanup any win32 build in source cd src/win32 -- 2.39.5