]> git.sur5r.net Git - bacula/bacula/blob - regress/scripts/setup
Force DEVELOPER on during regression setup
[bacula/bacula] / regress / scripts / setup
1 #!/bin/sh
2 #
3 # Script to setup running Bacula regression tests
4 #
5
6 check_exit_code()
7 {
8    if [ $? != 0 ] ; then
9       echo "Bad exit code giving up"
10       exit 1 
11    fi
12 }
13
14 . ./config
15
16 cwd=`pwd`
17 if [ ! -d ${BACULA_SOURCE} ] ; then
18    echo "The BACULA_SOURCE environment variable must be a Bacula release directory, but is not."
19    echo " "
20    exit 1
21 fi
22
23 MAKEOPTS=${MAKEOPT:-"-j3"}
24
25
26 # we build and setup binaries to the $cwd/bin directory not $bin
27 rm -rf build bin
28 # Copy new source
29 echo "Copying source from ${BACULA_SOURCE}"
30 cp -rp ${BACULA_SOURCE} build
31 which git >/dev/null 2>/dev/null
32 if [ $? = 0 ] ; then
33   git show HEAD | grep -m 1 commit | awk '{print $2}' > build/git-version
34 else
35   echo "Git not found." >build/git-version
36 fi
37 scripts/create_sed
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
43
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
48
49 rm -f tmp/t$$ tmp/o$$
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
55 cd build
56 rm -f Makefile config.*
57 # Run Bacula configuration, make, install
58 ./regress-config ${cwd}
59 check_exit_code
60 # Cleanup any build in source
61 make clean
62 make ${MAKEOPT}
63 check_exit_code
64 make install
65 if [ a${KEEP_SOURCE} = a ]; then
66    rm -rf examples patches
67    check_exit_code
68    # eliminate non-essential directories to reduce
69    #   size.  Otherwise regress run too long
70    rm -rf src/win32 examples patches
71 fi
72 # get all tools -- especially testls
73 cd src/tools
74 make installall
75 check_exit_code
76
77 cd ${cwd}
78 bin/bacula stop
79
80 mkdir -p working
81 cd bin
82 echo "Running database creation scripts"
83 ./create_bacula_database
84 ./drop_bacula_tables
85 ./make_bacula_tables
86 ./grant_bacula_privileges
87 cd ${cwd}
88 # Start and stop Bacula to ensure conf files are OK
89 bin/bacula start
90 bin/bacula stop
91 #
92 # Save Bacula default conf files for later use
93 #
94 cp -f bin/*.conf scripts