3 # Test if Bacula can automatically create a Volume label.
6 TestName="runscript-test"
12 rm -f bin/bacula-dir.conf
13 /bin/cp -f scripts/bacula-dir.conf.testrunscript bin/bacula-dir.conf
15 echo "${cwd}/build" >/tmp/file-list
19 cat <<END_OF_DATA >tmp/bconcmds
22 label volume=TestVolume001
23 @#setdebug level=100 storage=File
24 @output tmp/log.RUN1.out
25 run job=RUN_ALL_OK yes
29 run job=RUN_FD_WARNING yes
33 run job=RUN_FD_FAILED yes
37 run job=RUN_DIR_FAILED yes
48 if grep -q 'dir: BeforeJob: run command "/bin/echo RunBeforeJob"' tmp/log.RUN1.out &&
49 grep -q 'fd: ClientRunBeforeJob: ClientRunBeforeJob' tmp/log.RUN1.out &&
50 grep -q 'fd: ClientAfterJob: run command "/bin/echo ClientRunAfterJob' tmp/log.RUN1.out &&
51 grep -q 'dir: AfterJob: run command "/bin/echo RunAfterJob' tmp/log.RUN1.out
53 [ "$debug" -eq 1 ] && echo RUN_ALL_OK ok
55 echo "RUN_ALL_OK in error"
59 if grep -q 'dir: BeforeJob: run command "/bin/false RUN_DIR_FAILED"' tmp/log.RUN1.out &&
60 grep -q 'dir: BeforeJob: RunAfterFailedJob' tmp/log.RUN1.out &&
61 true # grep -q 'Backup OK -- with warnings' tmp/log.RUN1.out
63 [ "$debug" -eq 1 ] && echo RUN_DIR_FAILED ok
65 echo "RUN_DIR_FAILED in error"
69 if grep -q 'fd: ClientBeforeJob: run command "/bin/false RUN_FD_FAILED1"' tmp/log.RUN1.out &&
70 grep -q 'fd: ClientBeforeJob: run command "/bin/false RUN_FD_FAILED2"' tmp/log.RUN1.out &&
71 grep -q 'dir: AfterJob: run command "/bin/echo RunAfterFailedJob"' tmp/log.RUN1.out
73 [ "$debug" -eq 1 ] && echo RUN_FD_FAILED ok
75 echo "RUN_FD_FAILED in error"
79 if grep -q 'fd: ClientBeforeJob: run command "/bin/false RUN_FD_WARNING"' tmp/log.RUN1.out &&
80 grep -q 'Backup OK -- with warnings' tmp/log.RUN1.out
82 [ "$debug" -eq 1 ] && echo RUN_FD_WARNING ok
84 echo "RUN_FD_WARNING in error"