]> git.sur5r.net Git - bacula/bacula/blob - regress/tests/bug-897
regress: fix delete-test
[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 ${cwd}/tmp/RUN*log
14 rm -f ${cwd}/tmp/fifo
15 rm -f ${cwd}/tmp/RUN_BUG_897
16 rm -f ${cwd}/tmp/RUN_FD_FAILED
17
18 /bin/cp -f scripts/bacula-dir.conf.testrunscript bin/bacula-dir.conf
19
20 echo "${cwd}/build/po" >${cwd}/tmp/file-list
21 echo "${cwd}/tmp/fifo" >> ${cwd}/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 >${cwd}/tmp/bconcmds
33 @$out /dev/null
34 messages
35 label volume=TestVolume001
36 @$out ${cwd}/tmp/RUN_FD_FAILED.log
37 run job=RUN_FD_FAILED yes
38 wait
39 messages
40 @sleep 1
41 @$out ${cwd}/tmp/RUN_BUG_897.log
42 setdebug level=200 client=$CLIENT
43 run job=BUG_897 yes
44 @sleep 2
45 cancel
46 yes
47 wait
48 messages
49 st dir
50 quit
51 END_OF_DATA
52
53 run_bacula
54 check_for_zombie_jobs storage=File
55 stop_bacula
56
57 dstat=0
58 bstat=0
59 rstat=0
60 export dstat
61 export bstat
62 export rstat
63
64 grep 'fd: ClientBeforeJob: run command "/bin/false RUN_FD_FAILED1"' ${cwd}/tmp/RUN_FD_FAILED.log >/dev/null 2>&1
65 a=$?
66 grep 'fd: ClientBeforeJob: run command "/bin/false RUN_FD_FAILED2"' ${cwd}/tmp/RUN_FD_FAILED.log >/dev/null 2>&1
67 b=$?
68 grep 'dir: AfterJob: run command "/bin/echo RunAfterFailedJob"' ${cwd}/tmp/RUN_FD_FAILED.log >/dev/null 2>&1
69 c=$?
70 grep 'touching' ${cwd}/tmp/RUN_FD_FAILED.log >/dev/null 2>&1
71 d=$?
72 grep '*** Backup Error ***' ${cwd}/tmp/RUN_FD_FAILED.log >/dev/null 2>&1
73 e=$?
74 if [ $a = 0 -a $b = 0 -a $c = 0 -a $d = 0 -a $e = 0 ]
75 then
76    [ "$debug" = 1 ] && echo RUN_FD_FAILED ok
77 else
78    echo "RUN_FD_FAILED in error"
79    rstat=1
80 fi
81 if test -f ${cwd}/tmp/RUN_FD_FAILED
82 then
83     echo "The ${cwd}/tmp/RUN_FD_FAILED have been created, but nothing could be found"
84     echo "in the log"
85 fi
86
87
88 grep 'touching' ${cwd}/tmp/RUN_BUG_897.log >/dev/null 2>&1
89 d=$?
90 if [ $d = 0 ]
91 then
92    [ "$debug" = 1 ] && echo RUN_FD_FAILED ok
93 else
94    echo "RUN_BUG_897 in error"
95    rstat=1
96 fi
97 if test -f ${cwd}/tmp/RUN_BUG_897
98 then
99     echo "The ${cwd}/tmp/RUN_BUG_897 have been created, but nothing could be found"
100     echo "in the log"
101 fi
102
103
104
105 end_test