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