]> git.sur5r.net Git - bacula/bacula/blob - regress/tests/runscript-test
ebl add runscript regression script (not yet works well)
[bacula/bacula] / regress / 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" >/tmp/file-list
16
17 start_test
18
19 cat <<END_OF_DATA >tmp/bconcmds
20 @output /dev/null
21 messages
22 label volume=TestVolume001
23 @#setdebug level=100 storage=File
24 @output tmp/log.RUN_ALL_OK.out
25 run job=RUN_ALL_OK yes
26 wait
27 @sleep 5
28 messages
29 @output tmp/log.RUN_DIR_FAILED.out
30 run job=RUN_DIR_FAILED yes
31 wait
32 @sleep 5
33 messages
34 @output tmp/log.RUN_FD_FAILED.out
35 run job=RUN_FD_FAILED yes
36 wait
37 @sleep 5
38 messages
39 @output tmp/log.RUN_FD_WARNING.out
40 run job=RUN_FD_WARNING yes
41 wait
42 @sleep 5
43 messages
44 st dir
45 quit
46 END_OF_DATA
47
48 run_bacula
49 stop_bacula
50
51 if grep -q 'dir: BeforeJob: run command "/bin/echo RunBeforeJob"'          tmp/log.RUN_ALL_OK.out   &&
52    grep -q 'fd: ClientRunBeforeJob: ClientRunBeforeJob'                    tmp/log.RUN_ALL_OK.out   &&
53    grep -q 'fd: ClientAfterJob: run command "/bin/echo ClientRunAfterJob'  tmp/log.RUN_ALL_OK.out   &&
54    grep -q 'dir: AfterJob: run command "/bin/echo RunAfterJob'             tmp/log.RUN_ALL_OK.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"'          tmp/log.RUN_DIR_FAILED.out   &&
63    grep -q 'dir: BeforeJob: RunAfterFailedJob'                 tmp/log.RUN_DIR_FAILED.out   &&
64    true # grep -q 'Backup OK -- with warnings'                        tmp/log.RUN_DIR_FAILED.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"'            tmp/log.RUN_FD_FAILED.out   &&
73    grep -q 'fd: ClientBeforeJob: run command "/bin/false 2"'          tmp/log.RUN_FD_FAILED.out   &&
74    grep -q 'dir: AfterJob: run command "/bin/echo RunAfterFailedJob"' tmp/log.RUN_FD_FAILED.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"'      tmp/log.RUN_FD_WARNING.out   &&
83    grep -q 'Backup OK -- with warnings'                         tmp/log.RUN_FD_WARNING.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