]> git.sur5r.net Git - bacula/bacula/blobdiff - regress/tests/maxtime-test
Make verify job log same as other logs -- fixes bug #2328
[bacula/bacula] / regress / tests / maxtime-test
index 65bd59a1e1f61f7883cac1991b825533c660ef93..1e375e844f25778ee8204b8532b7bcc11bc42213 100755 (executable)
@@ -1,4 +1,9 @@
 #!/bin/sh
+#
+# Copyright (C) 2000-2015 Kern Sibbald
+# License: BSD 2-Clause; see file LICENSE-FOSS
+#
+
 #
 #  Test MaxWaitTime, MaxRunTime and MaxStartDelay
 #
@@ -10,31 +15,45 @@ JobName=backup
 
 copy_test_confs
 
-rm -f bin/bacula-dir.conf
 rm -f ${cwd}/tmp/RUN*log
-/bin/cp -f scripts/bacula-dir.conf.maxtime bin/bacula-dir.conf
-WHEN=$(date '+%Y-%m-%d %H:%M:%S')
+cp -f ${cwd}/scripts/bacula-dir.conf.maxtime ${cwd}/bin/bacula-dir.conf
+WHEN=`date '+%Y-%m-%d %H:%M:%S'`
 
 echo "${cwd}/build/po" >${cwd}/tmp/file-list
 
 start_test
 
 cat <<END_OF_DATA >${cwd}/tmp/bconcmds
-@$out /dev/null
+@output /dev/null
 messages
+@$out ${cwd}/tmp/log1.out
 label volume=TestVolume001 pool=PoolA
 @$out ${cwd}/tmp/RUN_MAXTIME.log
 @# no media => have to wait
-run job=RUN_MAXWAITTIME pool=Default yes
+@# JobId 1
+run job=RUN_MAXWAITTIME comment="Should fail" pool=Default yes
 @sleep 2
 @# storage is used by RUN_MAXWAITTIME => have to wait
-run job=RUN_MAXSTARTDELAY pool=PoolA when="$WHEN" yes
+@# JobId 2
+run job=RUN_MAXSTARTDELAY comment="Should fail" pool=PoolA when="$WHEN" yes
+@sleep 2
+@# storage is used by the first MAXWAITTIME, but should work
+@# JobId 3
+run job=RUN_MAXWAITTIME comment="Should work" pool=PoolA yes
+@sleep 60
+label volume=TestVolume002 pool=Default
+mount
+@sleep 2
+mount
 wait
 messages
-run job=RUN_MAXRUNTIME pool=PoolA yes
+@# JobId 4
+run job=RUN_MAXRUNTIME comment="Should fail" pool=PoolA yes
 wait
 messages
-st dir
+status dir
+status client
+@sleep 2
 quit
 END_OF_DATA
 
@@ -43,12 +62,15 @@ END_OF_DATA
  mkfifo ${cwd}/tmp/fifo3) 2> /dev/null
 
 run_bacula
+check_for_zombie_jobs storage=File
+stop_bacula
 
-rm ${cwd}/tmp/fifo ${cwd}/tmp/fifo2 ${cwd}/tmp/fifo3
+rm -f ${cwd}/tmp/fifo ${cwd}/tmp/fifo2 ${cwd}/tmp/fifo3
 
-export dstat=0
-export bstat=0
-export rstat=0
+dstat=0
+bstat=0
+rstat=0
+touch ${cwd}/tmp/log2.out
 
 grep -e '1: Fatal error: Max wait time exceeded. Job canceled.' ${cwd}/tmp/RUN_MAXTIME.log >/dev/null
 if [ $? -eq 0 ]
@@ -70,16 +92,28 @@ then
     [ "$debug" = 1 ] && echo MAXSTARTDELAY ok
 else
    echo "MAXSTARTDELAY in error"
-   bstat=1
+   bstat=2
 fi
 
-grep -e '3: Fatal error: Max run time exceeded. Job canceled.' ${cwd}/tmp/RUN_MAXTIME.log >/dev/null 
+grep -e '4: Fatal error: Max run time exceeded. Job canceled.' ${cwd}/tmp/RUN_MAXTIME.log >/dev/null 
 if [ $? -eq 0 ]
 then
     [ "$debug" = 1 ] && echo MAXRUNTIME ok
 else
    echo "MAXRUNTIME in error"
-   bstat=1
+   echo "${cwd}/tmp/RUN_MAXTIME.log"
+   cat ${cwd}/tmp/RUN_MAXTIME.log
+   bstat=3
 fi
 
+grep -e 'Termination: *Backup OK' ${cwd}/tmp/RUN_MAXTIME.log >/dev/null
+if [ $? -eq 0 ]
+then
+    [ "$debug" = 1 ] && echo MAXRUNTIME2 ok
+else
+   echo "MAXRUNTIME2 in error"
+   bstat=4
+fi
+
+
 end_test