]> git.sur5r.net Git - bacula/bacula/blobdiff - regress/scripts/functions
update configure
[bacula/bacula] / regress / scripts / functions
index fa7d6f01106b922064d9265cd1bc9f699320d65a..7395361cd503be1368fffabb39aedf8b0f8b7a6f 100644 (file)
@@ -26,7 +26,10 @@ start_test()
    echo " === Starting $TestName at `date +%R:%S` ==="
    echo " === Starting $TestName at `date +%R:%S` ===" >> ${working}/log
    echo " "
+   export TestName
    export zstat
+   export estat
+   estat=0
    zstat=0
    bstat=0
    rstat=0
@@ -107,6 +110,10 @@ set_debug()
 
 print_debug()
 {
+   echo $* | grep ERROR > /dev/null
+   if test $? -eq 0; then
+     echo $* >> $tmp/err.log
+   fi
    if test "$debug" -eq 1 ; then
      echo $*
    fi
@@ -119,7 +126,7 @@ check_files_written()
     FILES=`awk '/FD Files Written:/ { last=$4 } END { print last }' $LOG`
 
     if [ "$NB" != "$FILES" ]; then
-        print_debug "Expect $NB files, get $FILES"
+        print_debug "ERROR: Expect $NB files, get $FILES"
         bstat=2
     fi
 }
@@ -157,14 +164,15 @@ run_bacula()
 {
    debug_wait
    zstat=0
+   estat=0
    if test "$debug" -eq 1 ; then
-     ${scripts}/bacula-ctl-sd start
-     ${scripts}/bacula-ctl-fd start $1
-     ${scripts}/bacula-ctl-dir start
+     ${scripts}/bacula-ctl-sd start -m
+     ${scripts}/bacula-ctl-fd start -m $1
+     ${scripts}/bacula-ctl-dir start -m
      cat ${tmp}/bconcmds | ${bin}/bconsole -c ${conf}/bconsole.conf
      return $?
    else
-     ${bin}/bacula start >/dev/null 2>&1
+     ${scripts}/bacula start >/dev/null 2>&1
      cat ${tmp}/bconcmds | ${bin}/bconsole -c ${conf}/bconsole.conf >/dev/null 2>&1
      return $?
    fi
@@ -183,9 +191,9 @@ run_bconsole()
 run_btape()
 {
    if test "$debug" -eq 1 ; then
-     cat ${tmp}/bconcmds | ${bin}/btape -c ${conf}/bacula-sd.conf DDS-4 | tee ${tmp}/log1.out
+     cat ${tmp}/bconcmds | ${bin}/btape -c ${conf}/bacula-sd.conf tape | tee ${tmp}/log1.out
    else
-     cat ${tmp}/bconcmds | ${bin}/btape -c ${conf}/bacula-sd.conf DDS-4 >${tmp}/log1.out 2>&1
+     cat ${tmp}/bconcmds | ${bin}/btape -c ${conf}/bacula-sd.conf tape >${tmp}/log1.out 2>&1
    fi
 }
 
@@ -216,7 +224,11 @@ bscan_libdbi()
 
 stop_bacula()
 {
-   ${bin}/bacula stop 2>&1 >/dev/null
+   if test "$debug" -eq 1 ; then
+      ${scripts}/bacula stop
+   else
+      ${scripts}/bacula stop 2>&1 >/dev/null
+   fi
 }
 
 check_for_zombie_jobs()
@@ -233,10 +245,10 @@ change_jobname()
       oldname=$1
       newname=$2
    fi
-   rm -f ${bin}/1
-   mv ${conf}/bacula-dir.conf ${bin}/1
-   echo "s%${oldname}%${newname}%g" >${tmp}/1
-   sed -f ${tmp}/1 ${bin}/1 >${conf}/bacula-dir.conf
+   rm -f $tmp/1 $tmp/2
+   mv ${conf}/bacula-dir.conf $tmp/1
+   echo "s%${oldname}%${newname}%g" >$tmp/2
+   sed -f $tmp/2 $tmp/1 >$conf/bacula-dir.conf
 #  echo "Job ${oldname} changed to ${newname}"
 }
 
@@ -272,6 +284,7 @@ check_two_logs()
 check_restore_diff()
 {
    if test "$debug" -eq 1 ; then
+      $rscripts/diff.pl -s ${src} -d ${tmp}/bacula-restores${src}
       diff -ur ${src} ${tmp}/bacula-restores${src}
    else 
       diff -ur ${src} ${tmp}/bacula-restores${src} 2>&1 >/dev/null
@@ -282,6 +295,7 @@ check_restore_diff()
 check_restore_bin_diff()
 {
    if test "$debug" -eq 1 ; then
+      $rscripts/diff.pl -s ${bin} -d ${tmp}/bacula-restores${bin}
       diff -ur ${bin} ${tmp}/bacula-restores${bin}
    else 
       diff -ur ${bin} ${tmp}/bacula-restores${bin} 2>&1 >/dev/null
@@ -293,6 +307,7 @@ check_restore_bin_diff()
 check_restore_tmp_build_diff()
 {
    if test "$debug" -eq 1 ; then
+      $rscripts/diff.pl -s ${tmpsrc} -d ${tmp}/bacula-restores${tmpsrc}
       diff -ur ${tmpsrc} ${tmp}/bacula-restores${tmpsrc}
    else
       diff -ur ${tmpsrc} ${tmp}/bacula-restores${tmpsrc} 2>&1 >/dev/null
@@ -300,8 +315,32 @@ check_restore_tmp_build_diff()
    dstat=$?
 }
 
+# bstat is backup error
+# dstat is diff difference
+# estat is special error status (shown by print_debug message)
+# rstat is restore status
+# zstat is zombie job(s)
+#
 end_test()
 {
+   if [ x$notracedump != xyes ]; then 
+      cat ${working}/bacula.*.traceback 2>/dev/null
+      cp -f  ${working}/bacula.*.traceback ${dumps} 2>/dev/null
+      cat ${working}/*.bactrace 2>/dev/null
+      cp -f ${working}/*.bactrace ${dumps} 2>/dev/null
+   fi
+   if [ -f $tmp/err.log ]; then
+      cat $tmp/err.log
+   fi
+   if [ $estat != 0 ] ; then
+      echo " "
+      echo "  !!!!! $TestName failed!!! `date +%R:%S` !!!!! "
+      echo "   Status: estat=$estat zombie=$zstat backup=$bstat restore=$rstat diff=$dstat"
+      echo "  !!!!! $TestName failed!!! `date +%R:%S` !!!!! " >>test.out
+      echo "   Status: estat=$estat zombie=$zstat backup=$bstat restore=$rstat diff=$dstat" >>test.out
+      echo " "
+      exit 1
+   fi
    if [ $zstat != 0 ] ; then
       echo " "
       echo "  !!!!! $TestName failed!!! `date +%R:%S` !!!!! "
@@ -327,6 +366,8 @@ end_test()
       fi
       echo "   Status: backup=$bstat restore=$rstat diff=$dstat"
       echo "   Status: backup=$bstat restore=$rstat diff=$dstat" >>test.out
+      echo "   Test owner of $SITE_NAME is $EMAIL"
+      echo "   Test owner of $SITE_NAME is $EMAIL" >>test.out
       echo " "
       exit 1
    else
@@ -353,11 +394,22 @@ copy_test_confs()
 disable_pluguins()
 {
    for i in ${conf}/bacula-fd.conf; do
-      sed 's/Plugin/#Plugin/i' $i > $tmp/1
+      sed 's/Plugin/#Plugin/' $i > $tmp/1
       cp -f $tmp/1 $i
    done
 }
 
+update_win32()
+{
+   if [ -d $cwd/build/src/win32/release32   \
+     -a -d $cwd/build/src/win32/release64 ] \
+   || [ -d $cwd/release32 -a -d $cwd/release64 ]
+   then
+       echo -ne "Try to upgrade the FileDaemon:\t"
+       wget -qO - "$WIN32_ADDR:8091/install"
+   fi
+}
+
 debug_wait()
 {
   if test "x${REGRESS_WAIT}" = "x1"; then
@@ -463,13 +515,14 @@ db_name=${db_name:-"regress"}
 db_user=${db_user:-"regress"}
 db_password=${db_password:-""}
 working=${working:-"$cwd/working"}
+dumps=${dumps:-"$cwd/dumps"}
 bin=${bin:-"$cwd/bin"}
 
 # Bacula scripts
-scripts=${scripts:-"$bin"}
+scripts=${scripts:-"$cwd/bin"}
 
 # Bacula conf files
-conf=${conf:-"$bin"}
+conf=${conf:-"$cwd/bin"}
 
 # Regress scripts
 rscripts=${rscripts:-"$cwd/scripts"}
@@ -486,12 +539,17 @@ tmpsrc=${tmpsrc:-"$cwd/tmp/build"}
 export bin
 export conf
 export working
+export dumps
 export scripts
 export rscripts
 export tmp
 export src
 export tmpsrc
 
+bperl="perl -Mscripts::functions"
+export bperl
+
+mkdir -p ${tmp}
 touch ${tmp}/dir.out ${tmp}/fd.out ${tmp}/sd.out
 
 CLIENT=${HOST}-fd