]> git.sur5r.net Git - bacula/bacula/blob - regress/tests/maxtime-test
Copy trunk regress into Branch
[bacula/bacula] / regress / tests / maxtime-test
1 #!/bin/sh
2 #
3 #  Test RunScript
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 bin/bacula start
46 cat ${cwd}/tmp/bconcmds | bin/bconsole -c bin/bconsole.conf > /dev/null
47 stop_bacula
48
49 rm ${cwd}/tmp/fifo ${cwd}/tmp/fifo2 ${cwd}/tmp/fifo3
50
51 export dstat=0
52 export bstat=0
53 export rstat=0
54
55 if grep -e 'RUN_MAXWAITTIME.* Fatal error: Max wait time exceeded. Job canceled.' ${cwd}/tmp/RUN_MAXTIME.log >/dev/null 2>&1
56 then
57     [ "$debug" = 1 ] && echo MAXWAITTIME ok
58 else
59    echo "MAXWAITTIME in error"
60    rstat=1
61 fi
62
63 if grep -e 'RUN_MAXSTARTDELAY.* Fatal error: Job canceled because max start delay time exceeded.' ${cwd}/tmp/RUN_MAXTIME.log &&
64   ! grep -e 'NEVER start this' ${cwd}/tmp/RUN_MAXTIME.log >/dev/null 2>&1
65 then
66     [ "$debug" = 1 ] && echo MAXSTARTDELAY ok
67 else
68    echo "MAXSTARTDELAY in error"
69    rstat=1
70 fi
71
72 if grep -e 'RUN_MAXRUNTIME.* Fatal error: Max run time exceeded. Job canceled.' ${cwd}/tmp/RUN_MAXTIME.log >/dev/null 2>&1
73 then
74     [ "$debug" = 1 ] && echo MAXRUNTIME ok
75 else
76    echo "MAXRUNTIME in error"
77    rstat=1
78 fi
79
80 end_test