6 TestName="runscript-test"
12 rm -f bin/bacula-dir.conf
13 rm -f ${cwd}/tmp/RUN*log
14 rm -f ${cwd}/tmp/RUN_FD_FAILED
16 touch ${cwd}/tmp/log1.out
17 /bin/cp -f scripts/bacula-dir.conf.testrunscript bin/bacula-dir.conf
19 echo "${cwd}/build/po" >${cwd}/tmp/file-list
23 cat <<END_OF_DATA >${cwd}/tmp/bconcmds
26 label volume=TestVolume001 pool=Scratch
27 setdebug dir level=200
28 @$out ${cwd}/tmp/RUN_FD_WARNING.log
29 run job=RUN_FD_WARNING yes
33 @$out ${cwd}/tmp/RUN_ALL_OK.log
34 run job=RUN_ALL_OK yes
38 @$out ${cwd}/tmp/RUN_FD_FAILED.log
39 run job=RUN_FD_FAILED yes
43 @$out ${cwd}/tmp/RUN_DIR_FAILED.log
44 run job=RUN_DIR_FAILED yes
48 @$out ${cwd}/tmp/RUN_FD_FAILED2.log
49 run job=RUN_FD_FAILED2 yes
53 @$out ${cwd}/tmp/RUN_RESTO.log
54 restore where=${cwd}/tmp/bacula-restores select all done yes
62 check_for_zombie_jobs storage=File
72 grep 'shell command: run BeforeJob "/bin/echo RunBeforeJob"' ${cwd}/tmp/RUN_ALL_OK.log >/dev/null
74 grep 'ClientRunBeforeJob: ClientRunBeforeJob' ${cwd}/tmp/RUN_ALL_OK.log >/dev/null
76 grep 'shell command: run ClientAfterJob "/bin/echo ClientRunAfterJob' ${cwd}/tmp/RUN_ALL_OK.log >/dev/null
78 grep 'shell command: run AfterJob "/bin/echo RunAfterJob' ${cwd}/tmp/RUN_ALL_OK.log >/dev/null
80 grep 'ClientRunBefore1' ${cwd}/tmp/RUN_ALL_OK.log >/dev/null && \
81 grep 'ClientRunBefore2' ${cwd}/tmp/RUN_ALL_OK.log >/dev/null && \
82 grep 'ClientRunBefore3' ${cwd}/tmp/RUN_ALL_OK.log >/dev/null
85 if [ $a = 0 -a $b = 0 -a $c = 0 -a $d = 0 -a $e = 0 ]
87 [ "$debug" = 1 ] && echo RUN_ALL_OK ok
89 echo "RUN_ALL_OK in error"
93 grep 'shell command: run BeforeJob "/bin/false RUN_DIR_FAILED"' ${cwd}/tmp/RUN_DIR_FAILED.log >/dev/null
95 grep 'AfterJob: RunAfterFailedJob' ${cwd}/tmp/RUN_DIR_FAILED.log >/dev/null
97 if [ $a = 0 -a $b = 0 ]
99 [ "$debug" = 1 ] && echo RUN_DIR_FAILED ok
101 echo "RUN_DIR_FAILED in error"
105 grep 'shell command: run ClientBeforeJob "/bin/false RUN_FD_FAILED1"' ${cwd}/tmp/RUN_FD_FAILED.log >/dev/null
107 grep 'shell command: run ClientBeforeJob "/bin/false RUN_FD_FAILED2"' ${cwd}/tmp/RUN_FD_FAILED.log >/dev/null
109 grep 'shell command: run ClientBeforeJob "/bin/false RUN_FD_FAILED3"' ${cwd}/tmp/RUN_FD_FAILED.log >/dev/null
111 grep 'shell command: run AfterJob "/bin/echo RunAfterFailedJob"' ${cwd}/tmp/RUN_FD_FAILED.log >/dev/null
113 grep 'touching' ${cwd}/tmp/RUN_FD_FAILED.log >/dev/null
115 grep '*** Backup Error ***' ${cwd}/tmp/RUN_FD_FAILED.log >/dev/null
117 if [ $a = 0 -a $b = 0 -a $c = 0 -a $d = 0 -a $e = 0 -a $f = 0 ]
119 [ "$debug" = 1 ] && echo RUN_FD_FAILED ok
121 echo "RUN_FD_FAILED in error a=$a b=$b c=$c d=$d e=$e f=$f"
125 grep 'shell command: run ClientBeforeJob "/bin/false RUN_FD_FAILED1"' ${cwd}/tmp/RUN_FD_FAILED2.log >/dev/null
127 grep 'shell command: run ClientBeforeJob "/bin/false RUN_FD_FAILED2"' ${cwd}/tmp/RUN_FD_FAILED2.log >/dev/null
129 grep 'shell command: run ClientBeforeJob "/bin/false RUN_FD_FAILED3"' ${cwd}/tmp/RUN_FD_FAILED2.log >/dev/null
131 grep 'shell command: run AfterJob "/bin/echo RunAfterFailedJob"' ${cwd}/tmp/RUN_FD_FAILED2.log >/dev/null
133 grep '*** Backup Error ***' ${cwd}/tmp/RUN_FD_FAILED2.log >/dev/null
135 grep 'RUN_FD_FAILED4' ${cwd}/tmp/RUN_FD_FAILED2.log >/dev/null
137 if [ $a = 0 -a $b != 0 -a $c = 0 -a $d = 0 -a $e = 0 -a $f != 0 ]
139 [ "$debug" = 1 ] && echo RUN_FD_FAILED ok
141 echo "RUN_FD_FAILED2 in error a=$a b=$b c=$d d=$d e=$e"
145 grep 'shell command: run ClientBeforeJob "/bin/false RUN_FD_WARNING"' ${cwd}/tmp/RUN_FD_WARNING.log >/dev/null
147 grep 'RunAfterFailedJob' ${cwd}/tmp/RUN_FD_WARNING.log >/dev/null
149 grep 'Backup OK -- with warnings' ${cwd}/tmp/RUN_FD_WARNING.log >/dev/null
151 if [ $a = 0 -a $b != 0 -a $c = 0 ]
153 [ "$debug" = 1 ] && echo RUN_FD_WARNING ok
155 echo "RUN_FD_WARNING in error"
159 grep 'ClientBeforeRestore' ${cwd}/tmp/RUN_RESTO.log >/dev/null
161 grep 'ClientAfterRestore' ${cwd}/tmp/RUN_RESTO.log >/dev/null
163 grep 'DirBeforeRestore' ${cwd}/tmp/RUN_RESTO.log >/dev/null
165 grep 'DirAfterRestore' ${cwd}/tmp/RUN_RESTO.log >/dev/null
167 if [ $a = 0 -a $b = 0 -a $c = 0 -a $d = 0 ]
169 [ "$debug" = 1 ] && echo RUN_RESTO ok
171 echo "RUN_RESTO in error"