]> git.sur5r.net Git - bacula/bacula/blob - regress/tests/runscript-test
6deb7e266aa800938fb50b7a8c08495b3017985e
[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.RUN1.out
25 run job=RUN_ALL_OK yes
26 wait
27 @sleep 5
28 messages
29 run job=RUN_FD_WARNING 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 run_bacula
46 stop_bacula
47
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
52 then
53    [ "$debug" -eq 1 ] && echo RUN_ALL_OK ok
54 else
55    echo "RUN_ALL_OK in error"
56    rstat=1
57 fi
58
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
62 then
63    [ "$debug" -eq 1 ] && echo RUN_DIR_FAILED ok
64 else
65    echo "RUN_DIR_FAILED in error"
66    rstat=1
67 fi
68
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
72 then
73    [ "$debug" -eq 1 ] && echo RUN_FD_FAILED ok
74 else
75    echo "RUN_FD_FAILED in error"
76    rstat=1
77 fi
78
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
81 then
82    [ "$debug" -eq 1 ] && echo RUN_FD_WARNING ok
83 else
84    echo "RUN_FD_WARNING in error"
85    rstat=1
86 fi
87