6 TestName="runscript-test"
12 rm -f bin/bacula-dir.conf
14 rm -f tmp/RUN_FD_FAILED
17 /bin/cp -f scripts/bacula-dir.conf.testrunscript bin/bacula-dir.conf
19 echo "${cwd}/build/po" >/tmp/file-list
23 cat <<END_OF_DATA >tmp/bconcmds
26 label volume=TestVolume001
27 @$out tmp/RUN_FD_WARNING.log
28 run job=RUN_FD_WARNING yes
32 @$out tmp/RUN_ALL_OK.log
33 run job=RUN_ALL_OK yes
37 @$out tmp/RUN_FD_FAILED.log
38 run job=RUN_FD_FAILED yes
42 @$out tmp/RUN_DIR_FAILED.log
43 run job=RUN_DIR_FAILED yes
47 @$out tmp/RUN_FD_FAILED2.log
48 run job=RUN_FD_FAILED2 yes
56 check_for_zombie_jobs storage=File
66 grep 'dir: BeforeJob: run command "/bin/echo RunBeforeJob"' tmp/RUN_ALL_OK.log >/dev/null 2>&1
68 grep 'fd: ClientRunBeforeJob: ClientRunBeforeJob' tmp/RUN_ALL_OK.log >/dev/null 2>&1
70 grep 'fd: ClientAfterJob: run command "/bin/echo ClientRunAfterJob' tmp/RUN_ALL_OK.log >/dev/null 2>&1
72 grep 'dir: AfterJob: run command "/bin/echo RunAfterJob' tmp/RUN_ALL_OK.log >/dev/null 2>&1
74 if [ $a = 0 -a $b = 0 -a $c = 0 -a $d = 0 ]
76 [ "$debug" = 1 ] && echo RUN_ALL_OK ok
78 echo "RUN_ALL_OK in error"
82 grep 'dir: BeforeJob: run command "/bin/false RUN_DIR_FAILED"' tmp/RUN_DIR_FAILED.log >/dev/null 2>&1
84 grep 'dir: AfterJob: RunAfterFailedJob' tmp/RUN_DIR_FAILED.log >/dev/null 2>&1
86 if [ $a = 0 -a $b = 0 ]
88 [ "$debug" = 1 ] && echo RUN_DIR_FAILED ok
90 echo "RUN_DIR_FAILED in error"
94 grep 'fd: ClientBeforeJob: run command "/bin/false RUN_FD_FAILED1"' tmp/RUN_FD_FAILED.log >/dev/null 2>&1
96 grep 'fd: ClientBeforeJob: run command "/bin/false RUN_FD_FAILED2"' tmp/RUN_FD_FAILED.log >/dev/null 2>&1
98 grep 'dir: AfterJob: run command "/bin/echo RunAfterFailedJob"' tmp/RUN_FD_FAILED.log >/dev/null 2>&1
100 #grep 'touching' tmp/RUN_FD_FAILED.log >/dev/null 2>&1
101 test -f tmp/RUN_FD_FAILED
103 grep '*** Backup Error ***' tmp/RUN_FD_FAILED.log >/dev/null 2>&1
105 if [ $a = 0 -a $b = 0 -a $c = 0 -a $d = 0 -a $e = 0 ]
107 [ "$debug" = 1 ] && echo RUN_FD_FAILED ok
109 echo "RUN_FD_FAILED in error"
113 grep 'fd: ClientBeforeJob: run command "/bin/false RUN_FD_FAILED1"' tmp/RUN_FD_FAILED2.log >/dev/null 2>&1
115 grep 'fd: ClientBeforeJob: run command "/bin/false RUN_FD_FAILED2"' tmp/RUN_FD_FAILED2.log >/dev/null 2>&1
117 grep 'fd: ClientBeforeJob: run command "/bin/false RUN_FD_FAILED3"' tmp/RUN_FD_FAILED2.log >/dev/null 2>&1
119 grep 'dir: AfterJob: run command "/bin/echo RunAfterFailedJob"' tmp/RUN_FD_FAILED2.log >/dev/null 2>&1
121 grep '*** Backup Error ***' tmp/RUN_FD_FAILED2.log >/dev/null 2>&1
123 if [ $a = 0 -a $b != 0 -a $c = 0 -a $d = 0 -a $e = 0 ]
125 [ "$debug" = 1 ] && echo RUN_FD_FAILED ok
127 echo "RUN_FD_FAILED2 in error"
131 grep 'fd: ClientBeforeJob: run command "/bin/false RUN_FD_WARNING"' tmp/RUN_FD_WARNING.log >/dev/null 2>&1
133 grep 'RunAfterFailedJob' tmp/RUN_FD_WARNING.log >/dev/null 2>&1
135 grep 'Backup OK -- with warnings' tmp/RUN_FD_WARNING.log >/dev/null 2>&1
137 if [ $a = 0 -a $b != 0 -a $c = 0 ]
139 [ "$debug" = 1 ] && echo RUN_FD_WARNING ok
141 echo "RUN_FD_WARNING in error"