3 # Copyright (C) 2000-2015 Kern Sibbald
4 # License: BSD 2-Clause; see file LICENSE-FOSS
6 # Script to setup running Bacula regression tests
11 echo "Bad exit code giving up"
19 if [ ! -d ${BACULA_SOURCE} ] ; then
20 echo "The BACULA_SOURCE environment variable must be a Bacula release directory, but is not."
25 MAKEOPTS=${MAKEOPT:-"-j3"}
28 # we build and setup binaries to the $cwd/bin directory not $bin
31 echo "Copying source from ${BACULA_SOURCE}"
32 cp -rp ${BACULA_SOURCE} build
34 which git >/dev/null 2>/dev/null
36 git show HEAD | grep -m 1 commit | awk '{print $2}' > build/git-version
38 echo "Git not found." >build/git-version
41 # In default bacula-dir.conf.in, change default file
42 # to backup to be build directory
43 echo "s%File = @sbindir@%File = @BUILD_DIR@%g" >tmp/t$$
44 sed -f tmp/t$$ build/src/dird/bacula-dir.conf.in >tmp/o$$
45 cp tmp/o$$ build/src/dird/bacula-dir.conf.in
47 # Now turn on DEVELOPER for regression testing
48 echo "s%^.*define DEVELOPER 1.*$%#define DEVELOPER 1%g" >tmp/t$$
49 sed -f tmp/t$$ build/src/version.h >tmp/o$$
50 cp tmp/o$$ build/src/version.h
53 # remove unneeded directories
54 rm -rf build/txt build/src/testprogs
55 sed -f tmp/sed_tmp scripts/regress-config.in >scripts/regress-config
56 chmod 755 scripts/regress-config
57 cp scripts/regress-config build
59 rm -f Makefile config.*
60 # Run Bacula configuration, make, install
61 ./regress-config ${cwd}
63 # Cleanup any build in source
68 if [ a${KEEP_SOURCE} = a ]; then
69 rm -rf examples patches
71 # eliminate non-essential directories to reduce
72 # size. Otherwise regress run too long
73 rm -rf src/win32 examples patches
75 # get all tools -- especially testls
85 echo "Running database creation scripts"
86 ./create_bacula_database
89 ./grant_bacula_privileges
91 # Start and stop Bacula to ensure conf files are OK
95 # Save Bacula default conf files for later use
97 cp -f bin/*.conf scripts