]> git.sur5r.net Git - bacula/bacula/blob - regress/startover_libdbi.sh
baculum: Tweak getting bacula config boolean value
[bacula/bacula] / regress / startover_libdbi.sh
1 #!/bin/sh
2 #
3 # Copyright (C) 2000-2015 Kern Sibbald
4 # License: BSD 2-Clause; see file LICENSE-FOSS
5 #
6 # Run tests using differents catalog databases
7
8 PWD=`pwd`
9
10 CATALOG_MODE="mysql-dbi mysql-dbi-batchinsert"
11 #"postgresql postgresql-batchinsert postgresql-dbi postgresql-dbi-batchinsert \
12 #              mysql mysql-batchinsert mysql-dbi mysql-dbi-batchinsert"
13
14 for CT in $CATALOG_MODE ; do
15
16    CATALOG=`echo $CT | cut -d"-" -f1`
17    DISABLE_BATCH_INSERT=`echo $CT | grep batchinsert`
18    WITHOUT_DBI=`echo $CT | grep dbi`
19
20    if test "$DISABLE_BATCH_INSERT" = "" ; then
21       ENABLE_BATCH_INSERT="--disable-batch-insert"
22    else
23       ENABLE_BATCH_INSERT="--enable-batch-insert"
24    fi
25
26    if test "$WITHOUT_DBI" = "" ; then
27
28      _WHICHDB="WHICHDB=\"--with-${CATALOG}\""
29      _OPENSSL="OPENSSL=\"--with-openssll --disable-nls ${ENABLE_BATCH_INSERT}\""
30      _LIBDBI="#LIBDBI"
31    else 
32       if test "$CATALOG" = "mysql" ; then
33          DBPORT=3306
34       elif test "$CATALOG" = "postgresql" ; then
35          DBPORT=5432
36       elif test "$CATALOG" = "sqlite" ; then
37          DBPORT=0
38       elif test "$CATALOG" = "sqlite3" ; then
39          DBPORT=0
40       fi
41
42       _WHICHDB="WHICHDB=\"--with-dbi\""
43       _OPENSSL="OPENSSL=\"--with-openssl --disable-nls ${ENABLE_BATCH_INSERT} --with-dbi-driver=${CATALOG} --with-db-port=${DBPORT}\""
44       _LIBDBI="LIBDBI=\"dbdriver = dbi:${CATALOG}; dbaddress = 127.0.0.1; dbport = ${DBPORT}\""
45    fi
46
47    _SITE_NAME="SITE_NAME=joaohf-bacula-${CT}"   
48    
49    # substitute config values
50    cp -a ${PWD}/config ${PWD}/config.tmp
51
52    mkdir -p tmp
53
54    echo "/^SITE_NAME/c $_SITE_NAME" >> tmp/config_sed
55    echo "/^WHICHDB/c $_WHICHDB"  >> tmp/config_sed
56    echo "/^OPENSSL/c $_OPENSSL" >> tmp/config_sed
57    echo "/^#LIBDBI/c $_LIBDBI" >> tmp/config_sed
58    echo "/^LIBDBI/c $_LIBDBI" >> tmp/config_sed
59
60    sed -f tmp/config_sed ${PWD}/config.tmp > ${PWD}/config
61    rm tmp/config_sed
62
63    make setup
64    echo " ==== Starting ${_SITE_NAME} ====" >> test.out
65    
66    if test x"$1" = "xctest" ; then
67       ./experimental-disk
68    else 
69       ./all-disk-tests
70    fi
71    echo " ==== Submiting ${_SITE_NAME} ====" >> test.out
72 done