]> git.sur5r.net Git - bacula/bacula/blob - regress/win32/tests/runscript-test
Copy trunk regress into Branch
[bacula/bacula] / regress / win32 / tests / runscript-test
1 #!/bin/sh
2 #
3 #  Test if Bacula can automatically create a Volume label.
4 #
5
6 TestName="runscript-test"
7
8 . scripts/functions
9 set_debug 0
10 copy_test_confs
11
12 rm -f bin/bacula-dir.conf
13 /bin/cp -f scripts/bacula-dir.conf.testrunscript bin/bacula-dir.conf
14
15 echo "${cwd}/build" >${cwd}/tmp/file-list
16
17 start_test
18
19 cat <<END_OF_DATA >${cwd}/tmp/bconcmds
20 @output /dev/null
21 messages
22 label volume=TestVolume001
23 @#setdebug level=100 storage=File
24 @output ${cwd}/tmp/log.RUN2.out
25 run job=RUN_FD_WARNING yes
26 wait
27 @sleep 5
28 messages
29 run job=RUN_ALL_OK yes
30 wait
31 @sleep 5
32 messages
33 run job=RUN_FD_FAILED yes
34 wait
35 @sleep 5
36 messages
37 run job=RUN_DIR_FAILED yes
38 wait
39 @sleep 5
40 messages
41 st dir
42 quit
43 END_OF_DATA
44
45
46 bin/bacula start
47 cat ${cwd}/tmp/bconcmds | bin/bconsole -c bin/bconsole.conf &> ${cwd}/tmp/log.RUN1.out
48
49 stop_bacula
50
51 if grep -q 'dir: BeforeJob: run command "/bin/echo RunBeforeJob"'          ${cwd}/tmp/log.RUN1.out   &&
52    grep -q 'fd: ClientRunBeforeJob: ClientRunBeforeJob'                    ${cwd}/tmp/log.RUN1.out   &&
53    grep -q 'fd: ClientAfterJob: run command "/bin/echo ClientRunAfterJob'  ${cwd}/tmp/log.RUN1.out   &&
54    grep -q 'dir: AfterJob: run command "/bin/echo RunAfterJob'             ${cwd}/tmp/log.RUN1.out
55 then
56    [ "$debug" -eq 1 ] && echo RUN_ALL_OK ok
57 else
58    echo "RUN_ALL_OK in error"
59    rstat=1
60 fi
61
62 if grep -q 'dir: BeforeJob: run command "/bin/false RUN_DIR_FAILED"' ${cwd}/tmp/log.RUN1.out   &&
63    grep -q 'dir: BeforeJob: RunAfterFailedJob'                       ${cwd}/tmp/log.RUN1.out   &&
64    true # grep -q 'Backup OK -- with warnings'                       ${cwd}/tmp/log.RUN1.out
65 then
66    [ "$debug" -eq 1 ] && echo RUN_DIR_FAILED ok
67 else
68    echo "RUN_DIR_FAILED in error"
69    rstat=1
70 fi
71
72 if grep -q 'fd: ClientBeforeJob: run command "/bin/false RUN_FD_FAILED1"'  ${cwd}/tmp/log.RUN1.out   &&
73    grep -q 'fd: ClientBeforeJob: run command "/bin/false RUN_FD_FAILED2"'  ${cwd}/tmp/log.RUN1.out   &&
74    grep -q 'dir: AfterJob: run command "/bin/echo RunAfterFailedJob"'      ${cwd}/tmp/log.RUN1.out
75 then
76    [ "$debug" -eq 1 ] && echo RUN_FD_FAILED ok
77 else
78    echo "RUN_FD_FAILED in error"
79    rstat=1
80 fi
81
82 if grep -q 'fd: ClientBeforeJob: run command "/bin/false RUN_FD_WARNING"' ${cwd}/tmp/log.RUN1.out   &&
83    grep -q 'Backup OK -- with warnings'                                   ${cwd}/tmp/log.RUN1.out
84 then
85    [ "$debug" -eq 1 ] && echo RUN_FD_WARNING ok
86 else
87    echo "RUN_FD_WARNING in error"
88    rstat=1
89 fi
90