]> git.sur5r.net Git - bacula/bacula/blob - regress/tests/maxruntime-test
Make out of freespace non-fatal for removable devices -- i.e. behaves like tape
[bacula/bacula] / regress / tests / maxruntime-test
1 #!/bin/sh
2 #
3 # Copyright (C) 2000-2015 Kern Sibbald
4 # License: BSD 2-Clause; see file LICENSE-FOSS
5 #
6
7 #
8 #  Test MaxRunTime
9 #  Note: this test doesn't really do anything yet. It is used in helping
10 #    to duplicate bug #1268, but so far not successful ...
11 #
12
13 TestName="maxruntime-test"
14 JobName=backup
15
16 . scripts/functions
17
18 copy_test_confs
19
20 rm -f ${cwd}/tmp/RUN*log
21 cp -f ${cwd}/scripts/bacula-dir.conf.maxruntime ${cwd}/bin/bacula-dir.conf
22 WHEN=`date '+%Y-%m-%d %H:%M:%S'`
23
24 echo "${cwd}/build" >${cwd}/tmp/file-list
25
26 start_test
27
28 cat <<END_OF_DATA >${cwd}/tmp/bconcmds
29 @$out ${cwd}/tmp/log1.out
30 messages
31 label volume=TestVolume001 pool=PoolA
32 label volume=TestVolume002 pool=Default
33 mount
34 wait
35 messages
36 setdebug level=60 dir
37 run job=RUN_MAXRUNTIME pool=PoolA yes
38 run job=RUN_MAXRUNTIME fileset=FS_TESTJOB pool=PoolA yes
39 wait
40 messages
41 st dir
42 quit
43 END_OF_DATA
44
45 (mkfifo ${cwd}/tmp/fifo 
46  mkfifo ${cwd}/tmp/fifo2
47  mkfifo ${cwd}/tmp/fifo3) 2> /dev/null
48
49 run_bacula
50 check_for_zombie_jobs storage=File
51 stop_bacula
52
53 rm -f ${cwd}/tmp/fifo ${cwd}/tmp/fifo2 ${cwd}/tmp/fifo3
54
55 dstat=0
56 bstat=0
57 rstat=0
58 touch ${cwd}/tmp/log2.out
59
60 grep -e ': Fatal error: Max run time exceeded. Job canceled.' ${cwd}/tmp/log1.out >/dev/null 
61 if [ $? -eq 0 ]
62 then
63     [ "$debug" = 1 ] && echo MAXRUNTIME ok
64 else
65    echo "MAXRUNTIME in error"
66    bstat=1
67 fi
68
69 nb=`grep -e ': Fatal error: Max run time exceeded. Job canceled.' ${cwd}/tmp/log1.out | wc -l`
70 if [ $nb -eq 1 ]
71 then
72     [ "$debug" = 1 ] && echo MAXRUNTIME ok
73 else
74    echo "MAXRUNTIME in error, should not cancel the second job"
75    bstat=1
76 fi
77
78 end_test