]> git.sur5r.net Git - bacula/bacula/blob - regress/regress/win32/tests/runscript-test
7da23df4850146857da249b5525099e04ddd31e4
[bacula/bacula] / regress / 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 1
24 @#setdebug level=100 storage=File
25 @output ${cwd}/tmp/log.RUN2.out
26 run job=RUN_FD_WARNING yes
27 wait
28 @sleep 5
29 messages
30 run job=RUN_ALL_OK yes
31 wait
32 @sleep 5
33 messages
34 run job=RUN_FD_FAILED yes
35 wait
36 @sleep 5
37 messages
38 run job=RUN_DIR_FAILED yes
39 wait
40 @sleep 5
41 messages
42 st dir
43 quit
44 END_OF_DATA
45
46
47 bin/bacula start
48 cat ${cwd}/tmp/bconcmds | bin/bconsole -c bin/bconsole.conf &> ${cwd}/tmp/log.RUN1.out
49
50 stop_bacula
51
52 if grep -q 'dir: BeforeJob: run command "/bin/echo RunBeforeJob"'          ${cwd}/tmp/log.RUN1.out   &&
53    grep -q 'fd: ClientRunBeforeJob: ClientRunBeforeJob'                    ${cwd}/tmp/log.RUN1.out   &&
54    grep -q 'fd: ClientAfterJob: run command "/bin/echo ClientRunAfterJob'  ${cwd}/tmp/log.RUN1.out   &&
55    grep -q 'dir: AfterJob: run command "/bin/echo RunAfterJob'             ${cwd}/tmp/log.RUN1.out
56 then
57    [ "$debug" -eq 1 ] && echo RUN_ALL_OK ok
58 else
59    echo "RUN_ALL_OK in error"
60    rstat=1
61 fi
62
63 if grep -q 'dir: BeforeJob: run command "/bin/false RUN_DIR_FAILED"' ${cwd}/tmp/log.RUN1.out   &&
64    grep -q 'dir: BeforeJob: RunAfterFailedJob'                       ${cwd}/tmp/log.RUN1.out   &&
65    true # grep -q 'Backup OK -- with warnings'                       ${cwd}/tmp/log.RUN1.out
66 then
67    [ "$debug" -eq 1 ] && echo RUN_DIR_FAILED ok
68 else
69    echo "RUN_DIR_FAILED in error"
70    rstat=1
71 fi
72
73 if grep -q 'fd: ClientBeforeJob: run command "/bin/false RUN_FD_FAILED1"'  ${cwd}/tmp/log.RUN1.out   &&
74    grep -q 'fd: ClientBeforeJob: run command "/bin/false RUN_FD_FAILED2"'  ${cwd}/tmp/log.RUN1.out   &&
75    grep -q 'dir: AfterJob: run command "/bin/echo RunAfterFailedJob"'      ${cwd}/tmp/log.RUN1.out
76 then
77    [ "$debug" -eq 1 ] && echo RUN_FD_FAILED ok
78 else
79    echo "RUN_FD_FAILED in error"
80    rstat=1
81 fi
82
83 if grep -q 'fd: ClientBeforeJob: run command "/bin/false RUN_FD_WARNING"' ${cwd}/tmp/log.RUN1.out   &&
84    grep -q 'Backup OK -- with warnings'                                   ${cwd}/tmp/log.RUN1.out
85 then
86    [ "$debug" -eq 1 ] && echo RUN_FD_WARNING ok
87 else
88    echo "RUN_FD_WARNING in error"
89    rstat=1
90 fi
91