[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Bacula-devel] configure.in patch and script to test many catalog backend


Hello,

Following, one patch and a script to help run regressions tests with
many databases combinations.


The little patch (trunk code):

 * Add a --with-db-port option
 * Fix a variable substitution on src/dird/bacula-dir.conf.in
 * Add a uncomment when the user chosen --with-dbi. The
bacula-dir.conf uncomment the line about dbi configuration.
   That helps when I ran regress tests :).

Index: autoconf/configure.in
===================================================================
--- autoconf/configure.in	(revisão 7257)
+++ autoconf/configure.in	(cópia de trabalho)
@@ -1253,6 +1253,20 @@
 AC_SUBST(db_password)

 #
+# Pickup a database port
+#
+db_port=" "
+AC_ARG_WITH(db_port,
+    [  --with-db-port=DBPORT            specify a database port
(default null)],
+    [
+        if test "x$withval" != "x" ; then
+	     db_port=$withval
+	fi
+    ]
+)
+AC_SUBST(db_port)
+
+#
 # Handle users and groups for each daemon
 #
 dir_user=
@@ -1405,9 +1419,14 @@
        else
 	 support_batch_insert=yes
       fi])
-   fi
+   fi
+else
+# If dbi was not chosen, let the comment in file
+uncomment_dbi="#"
 fi

+AC_SUBST(uncomment_dbi)
+
 if test $support_batch_insert = yes ; then
    AC_DEFINE(HAVE_BATCH_FILE_INSERT, 1, [Set if DB batch insert code enabled])
 fi
@@ -2463,6 +2482,7 @@
   Statically Linked DIR:      ${support_static_dir}
   Statically Linked CONS:     ${support_static_cons}
   Database type:	      ${db_type}
+  Database port:          ${db_port}
   Database lib: 	      ${DB_LIBS}
   Database name:	      ${db_name}
   Database user:	      ${db_user}
Index: autoconf/bacula-macros/db.m4
===================================================================
--- autoconf/bacula-macros/db.m4	(revisão 7121)
+++ autoconf/bacula-macros/db.m4	(cópia de trabalho)
@@ -104,6 +104,7 @@
      support_dbi=yes
      db_type=DBI
      DB_TYPE=dbi
+     uncomment_dbi=" "

   else
      AC_MSG_RESULT(no)
@@ -115,6 +116,7 @@
 AC_SUBST(SQL_INCLUDE)
 AC_SUBST(SQL_BINDIR)
 AC_SUBST(DBI_DBD_DRIVERDIR)
+AC_SUBST(uncomment_dbi)

 ])

Index: src/dird/bacula-dir.conf.in
===================================================================
--- src/dird/bacula-dir.conf.in	(revisão 7166)
+++ src/dird/bacula-dir.conf.in	(cópia de trabalho)
@@ -232,7 +232,7 @@
 Catalog {
   Name = MyCatalog
 # Uncomment the following line if you want the dbi driver
-# dbdriver = "dbi:mysql"; dbaddress = 127.0.0.1; dbport = 3306
+@uncomment_dbi@ dbdriver = "dbi:@DB_TYPE@"; dbaddress = 127.0.0.1;
dbport = @db_port@
   dbname = @db_name@; user = @db_user@; password = ""
 }


I have made a little script to help tests all combinations of catalog
backend and Bacula. The changes above
permits run the scripts bellow. The idea is run all combinations and
analysing the results of all them, after.

---------------------- cut here ---------------------
#!/bin/sh

# Run tests using differents catalog databases

PWD=`pwd`

CATALOG_MODE="postgresql postgresql-batchinsert postgresql-dbi
postgresql-dbi-batchinsert \
              mysql mysql-batchinsert mysql-dbi mysql-dbi-batchinsert"

for CT in $CATALOG_MODE ; do

   CATALOG=`echo $CT | cut -d"-" -f1`
   DISABLE_BATCH_INSERT=`echo $CT | grep batchinsert`
   WITHOUT_DBI=`echo $CT | grep dbi`

   if test "$DISABLE_BATCH_INSERT" = "" ; then
      ENABLE_BATCH_INSERT="--disable-batch-insert"
   else
      ENABLE_BATCH_INSERT="--enable-batch-insert"
   fi

   if test "$WITHOUT_DBI" = "" ; then

     _WHICHDB="WHICHDB=\"--disable-nls --with-${CATALOG}
${ENABLE_BATCH_INSERT}\""
     _LIBDBI="#LIBDBI"
   else
     if test "$CATALOG" = "mysql" ; then
        DBPORT=3306
     else
        DBPORT=5432
     fi

     _WHICHDB="WHICHDB=\"--disable-nls --with-dbi
--with-dbi-driver=${CATALOG} ${ENABLE_BATCH_INSERT}
--with-db-port=${DBPORT}\""
     _LIBDBI="LIBDBI=\"dbdriver = dbi:${CATALOG}; dbaddress =
127.0.0.1; dbport = ${DBPORT}\""

   fi

   _SITE_NAME="SITE_NAME=joaohf-bacula-${CT}"

   # subustitute config values
   cp -a ${PWD}/config ${PWD}/config.tmp

   mkdir -p tmp

   echo "/^SITE_NAME/c $_SITE_NAME" >> tmp/config_sed
   echo "/^WHICHDB/c $_WHICHDB"  >> tmp/config_sed
   echo "/^#LIBDBI/c $_LIBDBI" >> tmp/config_sed
   echo "/^LIBDBI/c $_LIBDBI" >> tmp/config_sed

   sed -f tmp/config_sed ${PWD}/config.tmp > ${PWD}/config
   rm tmp/config_sed

   make setup
   ./experimental-disk
   echo "  ==== Submiting ${_SITE_NAME} ====" >> test.out
done
------------------------ cut here --------------------------------




Thanks


-- 
-----------------------------------------------------------
João Henrique Freitas - joaohf_at_gmail.com
Campinas-SP-Brasil
BSD051283
LPI 1
http://joaohf.pbwiki.com
http://www.livejournal.com/users/joaohf/
-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
_______________________________________________
Bacula-devel mailing list
Bacula-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.sourceforge.net/lists/listinfo/bacula-devel


This mailing list archive is a service of Copilotco.