3 # Script to setup running Bacula regression tests
9 echo "Bad exit code giving up"
17 if [ ! -d ${BACULA_SOURCE} ] ; then
18 echo "The BACULA_SOURCE environment variable must be a Bacula release directory, but is not."
23 MAKEOPTS=${MAKEOPT:-"-j3"}
26 # we build and setup binaries to the $cwd/bin directory not $bin
29 echo "Copying source from ${BACULA_SOURCE}"
30 cp -rp ${BACULA_SOURCE} build
31 which git >/dev/null 2>/dev/null
33 git show HEAD | grep -m 1 commit | awk '{print $2}' > build/git-version
35 echo "Git not found." >build/git-version
38 # In default bacula-dir.conf.in, change default file
39 # to backup to be build directory
40 echo "s%File = @sbindir@%File = @BUILD_DIR@%g" >tmp/t$$
41 sed -f tmp/t$$ build/src/dird/bacula-dir.conf.in >tmp/o$$
42 cp tmp/o$$ build/src/dird/bacula-dir.conf.in
44 # Now turn on DEVELOPER for regression testing
45 echo "s%^.*define DEVELOPER 1.*$%#define DEVELOPER 1%g" >tmp/t$$
46 sed -f tmp/t$$ build/src/version.h >tmp/o$$
47 cp tmp/o$$ build/src/version.h
50 # remove unneeded directories
51 rm -rf build/txt build/src/testprogs
52 sed -f tmp/sed_tmp scripts/regress-config.in >scripts/regress-config
53 chmod 755 scripts/regress-config
54 cp scripts/regress-config build
56 rm -f Makefile config.*
57 # Run Bacula configuration, make, install
58 ./regress-config ${cwd}
60 # Cleanup any build in source
65 if [ a${KEEP_SOURCE} = a ]; then
66 rm -rf examples patches
68 # eliminate non-essential directories to reduce
69 # size. Otherwise regress run too long
70 rm -rf src/win32 examples patches
72 # get all tools -- especially testls
82 echo "Running database creation scripts"
83 ./create_bacula_database
86 ./grant_bacula_privileges
88 # Start and stop Bacula to ensure conf files are OK
92 # Save Bacula default conf files for later use
94 cp -f bin/*.conf scripts