]> git.sur5r.net Git - bacula/bacula/blob - regress/tests/bug-897
ebl Tweak to get bug 897 reproductible
[bacula/bacula] / regress / tests / bug-897
1 #!/bin/sh
2 #
3 #  Test bug 897
4 #
5
6 TestName="bug-897"
7 JobName=backup
8
9 . scripts/functions
10 copy_test_confs
11
12 rm -f bin/bacula-dir.conf
13 rm -f tmp/RUN*log
14 rm -f ${cwd}/tmp/fifo
15 rm -f /tmp/RUN_BUG_897
16 rm -f /tmp/RUN_FD_FAILED
17
18 /bin/cp -f scripts/bacula-dir.conf.testrunscript bin/bacula-dir.conf
19
20 echo "${cwd}/build/po" >/tmp/file-list
21 echo "${cwd}/tmp/fifo" >> /tmp/file-list
22 mkfifo "${cwd}/tmp/fifo"
23
24 # use this to be able to cancel a running job
25 (
26   cat > ${cwd}/tmp/fifo < /dev/zero
27   cat > ${cwd}/tmp/fifo < /dev/zero
28 ) &
29
30 start_test
31
32 cat <<END_OF_DATA >tmp/bconcmds
33 @$out /dev/null
34 messages
35 label volume=TestVolume001
36 @$out tmp/RUN_FD_FAILED.log
37 run job=RUN_FD_FAILED yes
38 wait
39 messages
40 @sleep 1
41 @$out tmp/RUN_BUG_897.log
42 run job=BUG_897 yes
43 @sleep 2
44 cancel
45 yes
46 wait
47 messages
48 st dir
49 quit
50 END_OF_DATA
51
52 run_bacula
53 check_for_zombie_jobs storage=File
54 stop_bacula
55
56 dstat=0
57 bstat=0
58 rstat=0
59 export dstat
60 export bstat
61 export rstat
62
63 grep 'fd: ClientBeforeJob: run command "/bin/false RUN_FD_FAILED1"' tmp/RUN_FD_FAILED.log >/dev/null 2>&1
64 a=$?
65 grep 'fd: ClientBeforeJob: run command "/bin/false RUN_FD_FAILED2"' tmp/RUN_FD_FAILED.log >/dev/null 2>&1
66 b=$?
67 grep 'dir: AfterJob: run command "/bin/echo RunAfterFailedJob"' tmp/RUN_FD_FAILED.log >/dev/null 2>&1
68 c=$?
69 grep 'touching' tmp/RUN_FD_FAILED.log >/dev/null 2>&1
70 d=$?
71 grep '*** Backup Error ***' tmp/RUN_FD_FAILED.log >/dev/null 2>&1
72 e=$?
73 if [ $a = 0 -a $b = 0 -a $c = 0 -a $d = 0 -a $e = 0 ]
74 then
75    [ "$debug" = 1 ] && echo RUN_FD_FAILED ok
76 else
77    echo "RUN_FD_FAILED in error"
78    rstat=1
79 fi
80 if test -f /tmp/RUN_FD_FAILED
81 then
82     echo "The /tmp/RUN_FD_FAILED have been created, but nothing could be found"
83     echo "in the log"
84 fi
85
86
87 grep 'touching' tmp/RUN_BUG_897.log >/dev/null 2>&1
88 d=$?
89 if [ $d = 0 ]
90 then
91    [ "$debug" = 1 ] && echo RUN_FD_FAILED ok
92 else
93    echo "RUN_BUG_897 in error"
94    rstat=1
95 fi
96 if test -f /tmp/RUN_BUG_897
97 then
98     echo "The /tmp/RUN_BUG_897 have been created, but nothing could be found"
99     echo "in the log"
100 fi
101
102
103
104 end_test