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.RUN2.out
25 run job=RUN_FD_WARNING yes
29 run job=RUN_ALL_OK yes
33 run job=RUN_FD_FAILED yes
37 run job=RUN_DIR_FAILED yes
47 cat tmp/bconcmds | bin/bconsole -c bin/bconsole.conf &> tmp/log.RUN1.out
51 if grep -q 'dir: BeforeJob: run command "/bin/echo RunBeforeJob"' tmp/log.RUN1.out &&
52 grep -q 'fd: ClientRunBeforeJob: ClientRunBeforeJob' tmp/log.RUN1.out &&
53 grep -q 'fd: ClientAfterJob: run command "/bin/echo ClientRunAfterJob' tmp/log.RUN1.out &&
54 grep -q 'dir: AfterJob: run command "/bin/echo RunAfterJob' tmp/log.RUN1.out
56 [ "$debug" -eq 1 ] && echo RUN_ALL_OK ok
58 echo "RUN_ALL_OK in error"
62 if grep -q 'dir: BeforeJob: run command "/bin/false RUN_DIR_FAILED"' tmp/log.RUN1.out &&
63 grep -q 'dir: BeforeJob: RunAfterFailedJob' tmp/log.RUN1.out &&
64 true # grep -q 'Backup OK -- with warnings' tmp/log.RUN1.out
66 [ "$debug" -eq 1 ] && echo RUN_DIR_FAILED ok
68 echo "RUN_DIR_FAILED in error"
72 if grep -q 'fd: ClientBeforeJob: run command "/bin/false RUN_FD_FAILED1"' tmp/log.RUN1.out &&
73 grep -q 'fd: ClientBeforeJob: run command "/bin/false RUN_FD_FAILED2"' tmp/log.RUN1.out &&
74 grep -q 'dir: AfterJob: run command "/bin/echo RunAfterFailedJob"' tmp/log.RUN1.out
76 [ "$debug" -eq 1 ] && echo RUN_FD_FAILED ok
78 echo "RUN_FD_FAILED in error"
82 if grep -q 'fd: ClientBeforeJob: run command "/bin/false RUN_FD_WARNING"' tmp/log.RUN1.out &&
83 grep -q 'Backup OK -- with warnings' tmp/log.RUN1.out
85 [ "$debug" -eq 1 ] && echo RUN_FD_WARNING ok
87 echo "RUN_FD_WARNING in error"