]> git.sur5r.net Git - bacula/bacula/blobdiff - regress/tests/runscript-test
Add more debug
[bacula/bacula] / regress / tests / runscript-test
index b9c8e5475900e45b2d41b9b771980ea1ac1f2a3b..f4c3658e3994a10974bd48e6fa37956df939818c 100755 (executable)
@@ -10,38 +10,41 @@ JobName=backup
 copy_test_confs
 
 rm -f bin/bacula-dir.conf
-rm -f tmp/RUN*log
+rm -f ${cwd}/tmp/RUN*log
+rm -f ${cwd}/tmp/RUN_FD_FAILED
+
+touch ${cwd}/tmp/log1.out
 /bin/cp -f scripts/bacula-dir.conf.testrunscript bin/bacula-dir.conf
 
-echo "${cwd}/build/po" >/tmp/file-list
+echo "${cwd}/build/po" >${cwd}/tmp/file-list
 
 start_test
 
-cat <<END_OF_DATA >tmp/bconcmds
+cat <<END_OF_DATA >${cwd}/tmp/bconcmds
 @$out /dev/null
 messages
 label volume=TestVolume001
-@$out tmp/RUN_FD_WARNING.log
+@$out ${cwd}/tmp/RUN_FD_WARNING.log
 run job=RUN_FD_WARNING yes
 wait
 messages
 @sleep 1
-@$out tmp/RUN_ALL_OK.log
+@$out ${cwd}/tmp/RUN_ALL_OK.log
 run job=RUN_ALL_OK yes
 wait
 messages
 @sleep 1
-@$out tmp/RUN_FD_FAILED.log
+@$out ${cwd}/tmp/RUN_FD_FAILED.log
 run job=RUN_FD_FAILED yes
 wait
 messages
 @sleep 1
-@$out tmp/RUN_DIR_FAILED.log
+@$out ${cwd}/tmp/RUN_DIR_FAILED.log
 run job=RUN_DIR_FAILED yes
 wait
 messages
 @sleep 1
-@$out tmp/RUN_FD_FAILED2.log
+@$out ${cwd}/tmp/RUN_FD_FAILED2.log
 run job=RUN_FD_FAILED2 yes
 wait
 messages
@@ -49,9 +52,8 @@ st dir
 quit
 END_OF_DATA
 
-
-bin/bacula start
-cat tmp/bconcmds | bin/bconsole -c bin/bconsole.conf > /dev/null
+run_bacula
+check_for_zombie_jobs storage=File
 stop_bacula
 
 dstat=0
@@ -61,10 +63,15 @@ export dstat
 export bstat
 export rstat
 
-if grep -q 'dir: BeforeJob: run command "/bin/echo RunBeforeJob"'          tmp/RUN_ALL_OK.log   &&
-   grep -q 'fd: ClientRunBeforeJob: ClientRunBeforeJob'                    tmp/RUN_ALL_OK.log   &&
-   grep -q 'fd: ClientAfterJob: run command "/bin/echo ClientRunAfterJob'  tmp/RUN_ALL_OK.log   &&
-   grep -q 'dir: AfterJob: run command "/bin/echo RunAfterJob'             tmp/RUN_ALL_OK.log
+grep 'BeforeJob: run command "/bin/echo RunBeforeJob"' ${cwd}/tmp/RUN_ALL_OK.log >/dev/null 2>&1 
+a=$?
+grep 'ClientRunBeforeJob: ClientRunBeforeJob' ${cwd}/tmp/RUN_ALL_OK.log >/dev/null 2>&1
+b=$?
+grep 'ClientAfterJob: run command "/bin/echo ClientRunAfterJob' ${cwd}/tmp/RUN_ALL_OK.log >/dev/null 2>&1
+c=$?
+grep 'AfterJob: run command "/bin/echo RunAfterJob' ${cwd}/tmp/RUN_ALL_OK.log >/dev/null 2>&1
+d=$?
+if [ $a = 0 -a $b = 0 -a $c = 0 -a $d = 0 ]
 then
    [ "$debug" = 1 ] && echo RUN_ALL_OK ok
 else
@@ -72,9 +79,11 @@ else
    rstat=1
 fi
 
-if grep -q 'dir: BeforeJob: run command "/bin/false RUN_DIR_FAILED"' tmp/RUN_DIR_FAILED.log   &&
-   grep -q 'dir: AfterJob: RunAfterFailedJob'                        tmp/RUN_DIR_FAILED.log   &&
-   true #   grep -q 'Backup OK -- with warnings'                              tmp/RUN_DIR_FAILED.log
+grep 'BeforeJob: run command "/bin/false RUN_DIR_FAILED"' ${cwd}/tmp/RUN_DIR_FAILED.log >/dev/null 2>&1
+a=$?
+grep 'AfterJob: RunAfterFailedJob' ${cwd}/tmp/RUN_DIR_FAILED.log >/dev/null 2>&1
+b=$?
+if [ $a = 0 -a $b = 0 ]
 then
    [ "$debug" = 1 ] && echo RUN_DIR_FAILED ok
 else
@@ -82,10 +91,17 @@ else
    rstat=1
 fi
 
-if grep -q 'fd: ClientBeforeJob: run command "/bin/false RUN_FD_FAILED1"'  tmp/RUN_FD_FAILED.log   &&
-   grep -q 'fd: ClientBeforeJob: run command "/bin/false RUN_FD_FAILED2"'  tmp/RUN_FD_FAILED.log   &&
-   grep -q 'dir: AfterJob: run command "/bin/echo RunAfterFailedJob"'      tmp/RUN_FD_FAILED.log   &&
-   grep -q '*** Backup Error ***'                                          tmp/RUN_FD_FAILED.log
+grep 'ClientBeforeJob: run command "/bin/false RUN_FD_FAILED1"' ${cwd}/tmp/RUN_FD_FAILED.log >/dev/null 2>&1
+a=$?
+grep 'ClientBeforeJob: run command "/bin/false RUN_FD_FAILED2"' ${cwd}/tmp/RUN_FD_FAILED.log >/dev/null 2>&1
+b=$?
+grep 'AfterJob: run command "/bin/echo RunAfterFailedJob"' ${cwd}/tmp/RUN_FD_FAILED.log >/dev/null 2>&1
+c=$?
+grep 'touching' ${cwd}/tmp/RUN_FD_FAILED.log >/dev/null 2>&1
+d=$?
+grep '*** Backup Error ***' ${cwd}/tmp/RUN_FD_FAILED.log >/dev/null 2>&1
+e=$?
+if [ $a = 0 -a $b = 0 -a $c = 0 -a $d = 0 -a $e = 0 ]
 then
    [ "$debug" = 1 ] && echo RUN_FD_FAILED ok
 else
@@ -93,12 +109,17 @@ else
    rstat=1
 fi
 
-if grep -q 'fd: ClientBeforeJob: run command "/bin/false RUN_FD_FAILED1"'   tmp/RUN_FD_FAILED2.log &&
-   ! grep -q 'fd: ClientBeforeJob: run command "/bin/false RUN_FD_FAILED2"' tmp/RUN_FD_FAILED2.log &&
-   grep -q 'fd: ClientBeforeJob: run command "/bin/false RUN_FD_FAILED3"'   tmp/RUN_FD_FAILED2.log &&
-   grep -q 'dir: AfterJob: run command "/bin/echo RunAfterFailedJob"'       tmp/RUN_FD_FAILED2.log &&
-   grep -q '*** Backup Error ***'                                           tmp/RUN_FD_FAILED2.log
-
+grep 'ClientBeforeJob: run command "/bin/false RUN_FD_FAILED1"' ${cwd}/tmp/RUN_FD_FAILED2.log >/dev/null 2>&1
+a=$?
+grep 'ClientBeforeJob: run command "/bin/false RUN_FD_FAILED2"' ${cwd}/tmp/RUN_FD_FAILED2.log >/dev/null 2>&1
+b=$?
+grep 'ClientBeforeJob: run command "/bin/false RUN_FD_FAILED3"' ${cwd}/tmp/RUN_FD_FAILED2.log >/dev/null 2>&1
+c=$?
+grep 'AfterJob: run command "/bin/echo RunAfterFailedJob"' ${cwd}/tmp/RUN_FD_FAILED2.log >/dev/null 2>&1
+d=$?
+grep  '*** Backup Error ***' ${cwd}/tmp/RUN_FD_FAILED2.log >/dev/null 2>&1
+e=$?
+if [ $a = 0 -a $b != 0 -a $c = 0 -a $d = 0 -a $e = 0 ]
 then
    [ "$debug" = 1 ] && echo RUN_FD_FAILED ok
 else
@@ -106,9 +127,13 @@ else
    rstat=1
 fi
 
-if grep -q 'fd: ClientBeforeJob: run command "/bin/false RUN_FD_WARNING"' tmp/RUN_FD_WARNING.log   &&
-   ! grep -q 'RunAfterFailedJob'                                          tmp/RUN_FD_WARNING.log   &&
-   grep -q 'Backup OK -- with warnings'                                   tmp/RUN_FD_WARNING.log
+grep 'ClientBeforeJob: run command "/bin/false RUN_FD_WARNING"' ${cwd}/tmp/RUN_FD_WARNING.log >/dev/null 2>&1
+a=$?
+grep 'RunAfterFailedJob' ${cwd}/tmp/RUN_FD_WARNING.log >/dev/null 2>&1
+b=$?
+grep 'Backup OK -- with warnings' ${cwd}/tmp/RUN_FD_WARNING.log >/dev/null 2>&1
+c=$?
+if [ $a = 0 -a $b != 0 -a $c = 0 ]
 then
    [ "$debug" = 1 ] && echo RUN_FD_WARNING ok
 else