]> git.sur5r.net Git - bacula/bacula/blob - regress/tests/maxtime-test
ebl Solaris fix
[bacula/bacula] / regress / tests / maxtime-test
1 #!/bin/sh
2 #
3 #  Test MaxWaitTime, MaxRunTime and MaxStartDelay
4 #
5
6 TestName="maxtime-test"
7 JobName=backup
8
9 . scripts/functions
10
11 copy_test_confs
12
13 rm -f bin/bacula-dir.conf
14 rm -f ${cwd}/tmp/RUN*log
15 /bin/cp -f scripts/bacula-dir.conf.maxtime bin/bacula-dir.conf
16 WHEN=`date '+%Y-%m-%d %H:%M:%S'`
17
18 echo "${cwd}/build/po" >${cwd}/tmp/file-list
19
20 start_test
21
22 cat <<END_OF_DATA >${cwd}/tmp/bconcmds
23 @$out /dev/null
24 messages
25 label volume=TestVolume001 pool=PoolA
26 @$out ${cwd}/tmp/RUN_MAXTIME.log
27 @# no media => have to wait
28 run job=RUN_MAXWAITTIME pool=Default yes
29 @sleep 2
30 @# storage is used by RUN_MAXWAITTIME => have to wait
31 run job=RUN_MAXSTARTDELAY pool=PoolA when="$WHEN" yes
32 wait
33 messages
34 run job=RUN_MAXRUNTIME pool=PoolA yes
35 wait
36 messages
37 st dir
38 quit
39 END_OF_DATA
40
41 (mkfifo ${cwd}/tmp/fifo 
42  mkfifo ${cwd}/tmp/fifo2
43  mkfifo ${cwd}/tmp/fifo3) 2> /dev/null
44
45 run_bacula
46
47 rm ${cwd}/tmp/fifo ${cwd}/tmp/fifo2 ${cwd}/tmp/fifo3
48
49 export dstat=0
50 export bstat=0
51 export rstat=0
52
53 grep -e '1: Fatal error: Max wait time exceeded. Job canceled.' ${cwd}/tmp/RUN_MAXTIME.log >/dev/null
54 if [ $? -eq 0 ]
55 then
56     [ "$debug" = 1 ] && echo MAXWAITTIME ok
57 else
58    echo "MAXWAITTIME in error"
59    bstat=1
60 fi
61
62 grep -e '2: Fatal error: Job canceled because max start delay time exceeded.' ${cwd}/tmp/RUN_MAXTIME.log > /dev/null
63 f=$?
64
65 grep -e 'NEVER start this' ${cwd}/tmp/RUN_MAXTIME.log >/dev/null
66 s=$?
67
68 if [ $f -eq 0 -a $s -ne 0 ]
69 then
70     [ "$debug" = 1 ] && echo MAXSTARTDELAY ok
71 else
72    echo "MAXSTARTDELAY in error"
73    bstat=1
74 fi
75
76 grep -e '3: Fatal error: Max run time exceeded. Job canceled.' ${cwd}/tmp/RUN_MAXTIME.log >/dev/null 
77 if [ $? -eq 0 ]
78 then
79     [ "$debug" = 1 ] && echo MAXRUNTIME ok
80 else
81    echo "MAXRUNTIME in error"
82    bstat=1
83 fi
84
85 end_test