#!/bin/ksh 5B# # Copyright (C) 2000-2015 Kern Sibbald # License: BSD 2-Clause; see file LICENSE-FOSS # # Small wrapper script for doing Bacula regression # You will undoubtedly need to edit this to make it # work on your configuration # # # Set this if you need to post via a proxy # #http_proxy="http://proxy.planets.elm.net:3128" #export http_proxy # # Set this to the regression area where a git clone is put. # BACULA_REGRESS_HOME="/bacula_regress" export BACULA_REGRESS_HOME # # Directory where regress config templates are stored per db type. # CONFIG_DIR="/root/configs" # # Lets use the SUN compiler # #CC="/usr/bin/cc" #CXX="/usr/bin/CC" #CFLAGS="-fast" #CXXFLAGS="-fast" # #export CC CXX CFLAGS CXXFLAGS # # Regression script to run # REGRESSION_SCRIPT="./nightly-disk" run_regression() { screen -S bacula_regression -d -m ${REGRESSION_SCRIPT} while [ 1 ] do count=`screen -list 2>/dev/null | grep -c bacula_regression` if [ ${count} -lt 1 ]; then break fi sleep 60 done } run_sqlite3_regression() { # # Run regression using sqlite3 # if [ -f ${CONFIG_DIR}/config.sqlite3 ]; then ln -sf ${CONFIG_DIR}/config.sqlite3 config if [ $? = 0 ]; then run_regression fi fi } run_postgresql_regression() { # # Run regression using postgresql # if [ -f ${CONFIG_DIR}/config.postgresql ]; then ln -sf ${CONFIG_DIR}/config.postgresql config if [ $? = 0 ]; then run_regression fi fi } run_mysql_regression() { # # Run regression using mysql # if [ -f ${CONFIG_DIR}/config.mysql ]; then ln -sf ${CONFIG_DIR}/config.mysql config if [ $? = 0 ]; then run_regression fi fi } usage() { echo "Usage: $0 " echo "Where action is :" echo " all - run sqlite3, postgresql and mysql regressions." echo " sqlite3 - run sqlite3 regressions." echo " postgresql - run postgresql regressions." echo " mysql - run mysql regressions." } main() { if [ $# -lt 1 ]; then usage exit 1 fi . /etc/profile cd ${BACULA_REGRESS_HOME}/regress || exit 1 case $1 in all) run_sqlite3_regression run_postgresql_regression run_mysql_regression ;; sqlite3) run_sqlite3_regression ;; postgresql) run_postgresql_regression ;; mysql) run_mysql_regression ;; *) usage exit 1 ;; esac exit 0 } main $*