From: Kern Sibbald Date: Thu, 6 Sep 2007 16:50:58 +0000 (+0000) Subject: Restructure regress configuration X-Git-Tag: Release-7.0.0~5730 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=ec31394d480e5b00320556edc72ad3e4232c8db4;p=bacula%2Fbacula Restructure regress configuration git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@5480 91ce42f0-d328-0410-95d8-f526ca767f89 --- diff --git a/regress/Makefile b/regress/Makefile new file mode 100644 index 0000000000..d33f78c0cf --- /dev/null +++ b/regress/Makefile @@ -0,0 +1,69 @@ +# +# Makefile for Bacula regression testing +# +# Before running, you must create a file named config containing +# the configuration parameters. Create it by doing: +# +# cp prototype.conf config +# +# Then edit config and set the value for what are appropriate for you. +# + +first_rule: all + +all: + +setup: bacula sed + +# +# Some machines cannot handle the sticky bit and other garbage that +# is in weird-files, so we load and run it only on Linux machines. +# +bacula: all + @rm -rf bin build weird-files tmp + @rm -f w.tar.gz w.tar + @cp weird-files.tar.gz w.tar.gz + @-gunzip w.tar.gz + @-tar xf w.tar + @rm -f w.tar.gz w.tar + @rm -rf tmp working + mkdir tmp working + echo "Doing: scripts/setup" + scripts/setup + +sed: + echo "Doing: scripts/do_sed" + scripts/do_sed + +# Run all non-root userid tests +test: + ./all-non-root-tests + +# run all file and tape tests +full_test: + ./all-tape-and-file-tests + +# These tests require you to run as root +root_test: + ./all-root-tests + +clean: + scripts/cleanup + rm -f /tmp/file-list + rm -fr tmp/* working/* + rm -f test.out + rm -f diff + rm -f 1 2 3 scripts/1 scripts/2 scripts/3 tests/1 tests/2 tests/3 + find . -name .#* -exec rm -rf {} \; + +# Reset our userid after running as root +reset: + chown -R ${USER}:${USER} . tmp working + scripts/cleanup + rm -f /tmp/file-list tmp/file-list + rm -f tmp/* working/* + +distclean: clean + rm -rf bin build weird-files weird-files weird-files2 tmp working + rm -f scripts/*.conf + diff --git a/regress/Makefile.in b/regress/Makefile.in deleted file mode 100644 index 6d8c2505ed..0000000000 --- a/regress/Makefile.in +++ /dev/null @@ -1,74 +0,0 @@ -# -# 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 -# -# - -# suck in user's configuration -@CONFIG@ - -first_rule: all - -all: - -setup: bacula sed - -# -# Some machines cannot handle the sticky bit and other garbage that -# is in weird-files, so we load and run it only on Linux machines. -# -bacula: all - @rm -rf bin build weird-files tmp - @rm -f w.tar.gz w.tar - @cp weird-files.tar.gz w.tar.gz - @-gunzip w.tar.gz - @-tar xf w.tar - @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} - -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} - -# Run all non-root userid tests -test: - ./all-non-root-tests - -# run all file and tape tests -full_test: - ./all-tape-and-file-tests - -# These tests require you to run as root -root_test: - ./all-root-tests - -clean: - scripts/cleanup - rm -f /tmp/file-list - rm -fr tmp/* working/* - rm -f test.out - rm -f diff - rm -f 1 2 3 scripts/1 scripts/2 scripts/3 tests/1 tests/2 tests/3 - find . -name .#* -exec rm -rf {} \; - -# Reset our userid after running as root -reset: - chown -R ${USER}:${USER} . tmp working - scripts/cleanup - rm -f /tmp/file-list tmp/file-list - rm -f tmp/* working/* - -distclean: clean - rm -rf bin build weird-files weird-files weird-files2 tmp working - rm -f scripts/*.conf - 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