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

[Bacula-devel] regression tests: test daemon start first


hi

if build fails and not all daemons can start or there is an db error, it doesn't make much sense to run all tests an wait for timeout or status failed.

so i created a new test "pretest" as CTEST_CUSTOM_PRE_TEST which checks if bacula-fd,sd,dir are running and a simple bconsole command doesn't fail. if something fails, it exits with 1.

also i added a return statement to function run_bacula, so that test scripts can know about the bconsole termination status.

for me ctest returns 8 for status code "pretest failed, submission successfull".

patches for trunk and branch-2.4 attached. nightly-experimental-pretest.trunk.patch applies also to branch-2.4.

attention: new executable file tests/pretest

- Thomas
Index: scripts/functions
===================================================================
--- scripts/functions	(revision 7128)
+++ scripts/functions	(working copy)
@@ -98,9 +98,11 @@
      bin/bacula-ctl-fd start
      bin/bacula-ctl-dir start
      cat tmp/bconcmds | bin/bconsole -c bin/bconsole.conf
+     return $?
    else
      bin/bacula start 2>&1 >/dev/null
      cat tmp/bconcmds | bin/bconsole -c bin/bconsole.conf  2>&1 >/dev/null
+     return $?
    fi
 }
 
Index: CTestCustom.cmake
===================================================================
--- CTestCustom.cmake	(revision 7128)
+++ CTestCustom.cmake	(working copy)
@@ -1,3 +1,4 @@
+
 SET(CTEST_CUSTOM_ERROR_EXCEPTION
   ${CTEST_CUSTOM_ERROR_EXCEPTION}
   "ERROR: *database \".*\" already exists"
@@ -10,3 +11,5 @@
 SET(CTEST_CUSTOM_MAXIMUM_PASSED_TEST_OUTPUT_SIZE 10000)
 SET(CTEST_CUSTOM_MAXIMUM_FAILED_TEST_OUTPUT_SIZE 1048576)
 SET (CTEST_NIGHTLY_START_TIME "23:00:00 CET")
+
+SET(CTEST_CUSTOM_PRE_TEST tests/pretest)
Index: tests/pretest
===================================================================
--- tests/pretest	(revision 0)
+++ tests/pretest	(revision 0)
@@ -0,0 +1,46 @@
+#!/bin/sh
+#
+#  Test if daemons start
+#
+
+TestName="pretest"
+JobName=backup
+error=0
+
+. scripts/functions
+
+copy_test_confs
+
+
+cat <<END_OF_DATA >${cwd}/tmp/bconcmds
+messages
+quit
+END_OF_DATA
+
+start_test
+
+if ! run_bacula
+then
+	echo "error: bconsole error"
+	error=1
+fi
+
+for i in bacula-fd bacula-sd bacula-dir
+do
+	if ! ps -C $i >/dev/null
+	then
+		echo "error: $i not running"
+		error=1
+	fi
+		
+done
+
+stop_bacula
+
+export dstat=0
+export bstat=$error
+export rstat=0
+
+end_test
+
+exit 1 

Property changes on: tests/pretest
___________________________________________________________________
Name: svn:executable
   + *

Index: scripts/functions
===================================================================
--- scripts/functions	(revision 7128)
+++ scripts/functions	(working copy)
@@ -98,9 +98,11 @@
      bin/bacula-ctl-fd start
      bin/bacula-ctl-dir start
      cat tmp/bconcmds | bin/bconsole -c bin/bconsole.conf
+     return $?
    else
      bin/bacula start 2>&1 >/dev/null
      cat tmp/bconcmds | bin/bconsole -c bin/bconsole.conf  2>&1 >/dev/null
+     return $?
    fi
 }
 
Index: CTestCustom.cmake
===================================================================
--- CTestCustom.cmake	(revision 7128)
+++ CTestCustom.cmake	(working copy)
@@ -9,3 +9,5 @@
 
 SET(CTEST_CUSTOM_MAXIMUM_PASSED_TEST_OUTPUT_SIZE 10000)
 SET(CTEST_CUSTOM_MAXIMUM_FAILED_TEST_OUTPUT_SIZE 1048576)
+
+SET(CTEST_CUSTOM_PRE_TEST tests/pretest)
Index: tests/pretest
===================================================================
--- tests/pretest	(revision 0)
+++ tests/pretest	(revision 0)
@@ -0,0 +1,46 @@
+#!/bin/sh
+#
+#  Test if daemons start
+#
+
+TestName="pretest"
+JobName=backup
+error=0
+
+. scripts/functions
+
+copy_test_confs
+
+
+cat <<END_OF_DATA >${cwd}/tmp/bconcmds
+messages
+quit
+END_OF_DATA
+
+start_test
+
+if ! run_bacula
+then
+	echo "error: bconsole error"
+	error=1
+fi
+
+for i in bacula-fd bacula-sd bacula-dir
+do
+	if ! ps -C $i >/dev/null
+	then
+		echo "error: $i not running"
+		error=1
+	fi
+		
+done
+
+stop_bacula
+
+export dstat=0
+export bstat=$error
+export rstat=0
+
+end_test
+
+exit 1 

Property changes on: tests/pretest
___________________________________________________________________
Name: svn:executable
   + *

Index: experimental-all
===================================================================
--- experimental-all	(revision 7128)
+++ experimental-all	(working copy)
@@ -15,7 +15,7 @@
 rtn=$?
 i=0
 while [ $i -le 5 ]; do
-   if [ $rtn = 0 ] ; then
+   if [ $rtn = 0 ] || [ "$rtn" = "8" ]; then
       break;
    fi
    echo "Submit failed, waiting 5 mins"
Index: experimental-disk
===================================================================
--- experimental-disk	(revision 7128)
+++ experimental-disk	(working copy)
@@ -15,7 +15,7 @@
 rtn=$?
 i=0
 while [ $i -le 5 ]; do
-   if [ $rtn = 0 ] ; then
+   if [ $rtn = 0 ] || [ "$rtn" = "8" ]; then
       break;
    fi
    echo "Submit failed, waiting 5 mins"
Index: experimental-disk-and-tape
===================================================================
--- experimental-disk-and-tape	(revision 7128)
+++ experimental-disk-and-tape	(working copy)
@@ -15,7 +15,7 @@
 rtn=$?
 i=0
 while [ $i -le 5 ]; do
-   if [ $rtn = 0 ] ; then
+   if [ $rtn = 0 ] || [ "$rtn" = "8" ] ; then
       break;
    fi
    echo "Submit failed, waiting 5 mins"
Index: experimental-tape
===================================================================
--- experimental-tape	(revision 7128)
+++ experimental-tape	(working copy)
@@ -15,7 +15,7 @@
 rtn=$?
 i=0
 while [ $i -le 5 ]; do
-   if [ $rtn = 0 ] ; then
+   if [ $rtn = 0 ] || [ "$rtn" = "8" ] ; then
       break;
    fi
    echo "Submit failed, waiting 5 mins"
Index: nightly-all
===================================================================
--- nightly-all	(revision 7128)
+++ nightly-all	(working copy)
@@ -15,7 +15,7 @@
 rtn=$?
 i=0
 while [ $i -le 5 ]; do
-   if [ $rtn = 0 ] ; then
+   if [ $rtn = 0 ] || [ "$rtn" = "8" ] ; then
       break;
    fi
    echo "Submit failed, waiting 5 mins"
Index: nightly-disk
===================================================================
--- nightly-disk	(revision 7128)
+++ nightly-disk	(working copy)
@@ -15,7 +15,7 @@
 rtn=$?
 i=0
 while [ $i -le 5 ]; do
-   if [ $rtn = 0 ] ; then
+   if [ $rtn = 0 ] || [ "$rtn" = "8" ]; then
       break;
    fi
    echo "Submit failed, waiting 5 mins"
Index: nightly-disk-and-tape
===================================================================
--- nightly-disk-and-tape	(revision 7128)
+++ nightly-disk-and-tape	(working copy)
@@ -15,7 +15,7 @@
 rtn=$?
 i=0
 while [ $i -le 5 ]; do
-   if [ $rtn = 0 ] ; then
+   if [ $rtn = 0 ] || [ "$rtn" = "8" ] ; then
       break;
    fi
    echo "Submit failed, waiting 5 mins"
Index: nightly-tape
===================================================================
--- nightly-tape	(revision 7128)
+++ nightly-tape	(working copy)
@@ -15,7 +15,7 @@
 rtn=$?
 i=0
 while [ $i -le 5 ]; do
-   if [ $rtn = 0 ] ; then
+   if [ $rtn = 0 ] || [ "$rtn" = "8" ]; then
       break;
    fi
    echo "Submit failed, waiting 5 mins"
-------------------------------------------------------------------------
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.