6 TestName="runscript-test"
12 rm -f bin/bacula-dir.conf
14 /bin/cp -f scripts/bacula-dir.conf.testrunscript bin/bacula-dir.conf
16 echo "${cwd}/build/po" >/tmp/file-list
20 cat <<END_OF_DATA >tmp/bconcmds
23 label volume=TestVolume001
24 @$out tmp/RUN_FD_WARNING.log
25 run job=RUN_FD_WARNING yes
29 @$out tmp/RUN_ALL_OK.log
30 run job=RUN_ALL_OK yes
34 @$out tmp/RUN_FD_FAILED.log
35 run job=RUN_FD_FAILED yes
39 @$out tmp/RUN_DIR_FAILED.log
40 run job=RUN_DIR_FAILED yes
44 @$out tmp/RUN_FD_FAILED2.log
45 run job=RUN_FD_FAILED2 yes
53 check_for_zombie_jobs storage=File
63 grep 'dir: BeforeJob: run command "/bin/echo RunBeforeJob"' tmp/RUN_ALL_OK.log >/dev/null 2>&1
65 grep 'fd: ClientRunBeforeJob: ClientRunBeforeJob' tmp/RUN_ALL_OK.log >/dev/null 2>&1
67 grep 'fd: ClientAfterJob: run command "/bin/echo ClientRunAfterJob' tmp/RUN_ALL_OK.log >/dev/null 2>&1
69 grep 'dir: AfterJob: run command "/bin/echo RunAfterJob' tmp/RUN_ALL_OK.log >/dev/null 2>&1
71 if [ $a = 0 -a $b = 0 -a $c = 0 -a $d = 0 ]
73 [ "$debug" = 1 ] && echo RUN_ALL_OK ok
75 echo "RUN_ALL_OK in error"
79 grep 'dir: BeforeJob: run command "/bin/false RUN_DIR_FAILED"' tmp/RUN_DIR_FAILED.log >/dev/null 2>&1
81 grep 'dir: AfterJob: RunAfterFailedJob' tmp/RUN_DIR_FAILED.log >/dev/null 2>&1
83 if [ $a = 0 -a $b = 0 ]
85 [ "$debug" = 1 ] && echo RUN_DIR_FAILED ok
87 echo "RUN_DIR_FAILED in error"
91 grep 'fd: ClientBeforeJob: run command "/bin/false RUN_FD_FAILED1"' tmp/RUN_FD_FAILED.log >/dev/null 2>&1
93 grep 'fd: ClientBeforeJob: run command "/bin/false RUN_FD_FAILED2"' tmp/RUN_FD_FAILED.log >/dev/null 2>&1
95 grep 'dir: AfterJob: run command "/bin/echo RunAfterFailedJob"' tmp/RUN_FD_FAILED.log >/dev/null 2>&1
97 grep 'touching' tmp/RUN_FD_FAILED.log >/dev/null 2>&1
99 grep '*** Backup Error ***' tmp/RUN_FD_FAILED.log >/dev/null 2>&1
101 if [ $a = 0 -a $b = 0 -a $c = 0 -a $d = 0 -a $e = 0 ]
103 [ "$debug" = 1 ] && echo RUN_FD_FAILED ok
105 echo "RUN_FD_FAILED in error"
109 grep 'fd: ClientBeforeJob: run command "/bin/false RUN_FD_FAILED1"' tmp/RUN_FD_FAILED2.log >/dev/null 2>&1
111 grep 'fd: ClientBeforeJob: run command "/bin/false RUN_FD_FAILED2"' tmp/RUN_FD_FAILED2.log >/dev/null 2>&1
113 grep 'fd: ClientBeforeJob: run command "/bin/false RUN_FD_FAILED3"' tmp/RUN_FD_FAILED2.log >/dev/null 2>&1
115 grep 'dir: AfterJob: run command "/bin/echo RunAfterFailedJob"' tmp/RUN_FD_FAILED2.log >/dev/null 2>&1
117 grep '*** Backup Error ***' tmp/RUN_FD_FAILED2.log >/dev/null 2>&1
119 if [ $a = 0 -a $b != 0 -a $c = 0 -a $d = 0 -a $e = 0 ]
121 [ "$debug" = 1 ] && echo RUN_FD_FAILED ok
123 echo "RUN_FD_FAILED2 in error"
127 grep 'fd: ClientBeforeJob: run command "/bin/false RUN_FD_WARNING"' tmp/RUN_FD_WARNING.log >/dev/null 2>&1
129 grep 'RunAfterFailedJob' tmp/RUN_FD_WARNING.log >/dev/null 2>&1
131 grep 'Backup OK -- with warnings' tmp/RUN_FD_WARNING.log >/dev/null 2>&1
133 if [ $a = 0 -a $b != 0 -a $c = 0 ]
135 [ "$debug" = 1 ] && echo RUN_FD_WARNING ok
137 echo "RUN_FD_WARNING in error"