#
# Script to setup running Bacula regression tests
#
+
+check_exit_code()
+{
+ if [ $? != 0 ] ; then
+ echo "Bad exit code giving up"
+ exit 1
+ fi
+}
+
+. ./config
+
cwd=`pwd`
-if [ $# != 3 ] ; then
- echo "Incorrect number of arguments. Need:"
- echo "setup bacula-src depkgs email-address"
- echo " "
- exit 1
-fi
-if [ ! -d $1 ] ; then
- echo "Arg 1 must be a Bacula release directory."
- echo " "
- exit 1
-fi
-if [ ! -d $2 ] ; then
- cd ..
- cwd=`pwd`
- echo "The regression scripts require DEPKGS as arg 2 but not found!"
+if [ ! -d ${BACULA_SOURCE} ] ; then
+ echo "The BACULA_SOURCE environment variable must be a Bacula release directory, but is not."
echo " "
exit 1
fi
+
+# we build and setup binaries to the $cwd/bin directory not $bin
rm -rf build bin
# Copy new source
-cp -rp $1 build
+echo "Copying source from ${BACULA_SOURCE}"
+cp -rp ${BACULA_SOURCE} build
+cd build
+rm -rf txt src/testprogs
+cd ..
+check_exit_code
+scripts/create_sed
+sed -f tmp/sed_tmp scripts/regress-config.in >scripts/regress-config
+chmod 755 scripts/regress-config
cp scripts/regress-config build
cd build
rm -f Makefile config.cache
# Run Bacula configuration, make, install
-./regress-config ${cwd} $2 $3
-make
+./regress-config ${cwd}
+check_exit_code
+# Cleanup any build in source
+make clean
+make -j3
+check_exit_code
make install
+check_exit_code
+# eliminate non-essential directories to reduce
+# size. Otherwise regress run too long
+rm -rf src/win32 examples patches
cp src/tools/testls ../bin
+check_exit_code
-cd ..
+cd ${cwd}
bin/bacula stop
+
+mkdir -p working
cd bin
-#./create_bacula_database
+echo "Running database creation scripts"
+./create_bacula_database
./drop_bacula_tables
./make_bacula_tables
./grant_bacula_privileges
-cd ..
+cd ${cwd}
# Start and stop Bacula to ensure conf files are OK
bin/bacula start
bin/bacula stop