]> git.sur5r.net Git - bacula/bacula/blob - regress/tests/four-jobs-tape
Update
[bacula/bacula] / regress / tests / four-jobs-tape
1 #!/bin/sh
2 #
3 # Run a simple backup of the Bacula build directory using the compressed option
4 #   then backup four times, each with incremental then finally restore.
5 #   It should require at least 4 different bsrs.
6 #
7 debug=0
8 if test "$debug" -eq 1 ; then
9   out="tee"
10 else
11   out="output"
12 fi
13 cwd=`pwd`
14 scripts/copy-tape-confs
15 scripts/cleanup-tape
16 echo "${cwd}/build" >/tmp/file-list
17
18 echo " "
19 echo " "
20 echo " === Starting four-jobs-tape at `date +%R:%S` ==="
21 echo " === Starting four-jobs-tape at `date +%R:%S` ===" >>working/log
22 echo " "
23
24 cat <<END_OF_DATA >tmp/bconcmds
25 @$out /dev/null
26 estimate job=NightlySave listing
27 estimate job=NightlySave listing
28 estimate job=NightlySave listing
29 messages
30 @$out tmp/log1.out
31 label storage=DDS-4 volume=TestVolume001 slot=0 pool=Default
32 run job=NightlySave yes
33 wait
34 messages
35 quit
36 END_OF_DATA
37 if test "$debug" -eq 1 ; then
38   bin/bacula start
39   cat tmp/bconcmds | bin/bconsole -c bin/bconsole.conf
40 else
41   bin/bacula start 2>&1 >/dev/null
42   cat tmp/bconcmds | bin/bconsole -c bin/bconsole.conf  2>&1 >/dev/null
43 fi
44
45 scripts/check_for_zombie_jobs storage=DDS-4
46 echo "Backup 1 done"
47 # make some files for the incremental to pick up
48 touch ${cwd}/build/src/dird/*.c ${cwd}/build/src/dird/*.o
49 touch ${cwd}/build/src/lib/*.c ${cwd}/build/src/lib/*.o
50    
51 #
52 # run a second job
53 #
54 cat <<END_OF_DATA >tmp/bconcmds
55 @$out /dev/null
56 messages
57 @$out tmp/log1.out
58 run job=NightlySave level=Incremental yes
59 wait
60 messages
61 quit
62 END_OF_DATA
63 if test "$debug" -eq 1 ; then
64   bin/bacula start
65   cat tmp/bconcmds | bin/bconsole -c bin/bconsole.conf
66 else
67   bin/bacula start 2>&1 >/dev/null
68   cat tmp/bconcmds | bin/bconsole -c bin/bconsole.conf  2>&1 >/dev/null
69 fi
70
71 scripts/check_for_zombie_jobs storage=DDS-4
72 echo "Backup 2 done"
73 touch ${cwd}/build/src/dird/*.c
74 touch ${cwd}/build/src/lib/*.c ${cwd}/build/src/lib/*.o
75 #
76 # run a third job
77 #
78 cat <<END_OF_DATA >tmp/bconcmds
79 @$out /dev/null
80 messages
81 @$out tmp/log1.out
82 run job=NightlySave level=Incremental yes
83 wait
84 messages
85 quit
86 END_OF_DATA
87 if test "$debug" -eq 1 ; then
88   bin/bacula start
89   cat tmp/bconcmds | bin/bconsole -c bin/bconsole.conf
90 else
91   bin/bacula start 2>&1 >/dev/null
92   cat tmp/bconcmds | bin/bconsole -c bin/bconsole.conf  2>&1 >/dev/null
93 fi
94
95 scripts/check_for_zombie_jobs storage=DDS-4
96 echo "Backup 3 done"
97 # make some files for the incremental to pick up
98 touch ${cwd}/build/src/lib/*.c ${cwd}/build/src/lib/*.o
99 #
100 # run a fourth job
101 #
102 cat <<END_OF_DATA >tmp/bconcmds
103 @$out /dev/null
104 messages
105 @$out tmp/log1.out
106 run job=NightlySave level=Incremental yes
107 wait
108 messages
109 quit
110 END_OF_DATA
111 if test "$debug" -eq 1 ; then
112   bin/bacula start
113   cat tmp/bconcmds | bin/bconsole -c bin/bconsole.conf
114 else
115   bin/bacula start 2>&1 >/dev/null
116   cat tmp/bconcmds | bin/bconsole -c bin/bconsole.conf  2>&1 >/dev/null
117 fi
118
119 scripts/check_for_zombie_jobs storage=DDS-4
120 echo "Backup 4 done"
121
122 # now do several restores to ensure we cleanup between jobs
123 #
124 cat <<END_OF_DATA >tmp/bconcmds
125 @$out /dev/null
126 restore where=${cwd}/tmp/bacula-restores select all done
127 yes
128 wait
129 restore where=${cwd}/tmp/bacula-restores select all done
130 yes
131 wait
132 @$out tmp/log2.out
133 @#
134 @# now unmount the tape and start two restores
135 @#  at the same time
136 @#
137 unmount storage=DDS-4
138 restore where=${cwd}/tmp/bacula-restores select all done
139 yes
140 restore where=${cwd}/tmp/bacula-restores select
141 unmark *
142 mark *
143 done
144 yes
145 mount storage=DDS-4
146 wait
147 messages
148 @$out
149 quit
150 END_OF_DATA
151 if test "$debug" -eq 1 ; then
152   bin/bacula start
153   cat tmp/bconcmds | bin/bconsole -c bin/bconsole.conf
154 else
155   bin/bacula start 2>&1 >/dev/null
156   cat tmp/bconcmds | bin/bconsole -c bin/bconsole.conf  2>&1 >/dev/null
157 fi
158
159 bin/bacula stop 2>&1 >/dev/null
160 grep "^  Termination: *Backup OK" tmp/log1.out 2>&1 >/dev/null
161 bstat=$?
162 grep "^  Termination: *Restore OK" tmp/log2.out 2>&1 >/dev/null
163 rstat=$?
164 diff -r build tmp/bacula-restores${cwd}/build 2>&1 >/dev/null
165 if [ $? != 0 -o $bstat != 0 -o $rstat != 0 ] ; then
166    echo " "
167    echo " "
168    echo "  !!!!! four-jobs-tape Bacula source failed!!! !!!!! "
169    echo "  !!!!! four-jobs-tape failed!!! !!!!! " >>test.out
170    echo " "
171 else
172    echo "  ===== four-jobs-tape Bacula source OK ===== "
173    echo "  ===== four-jobs-tape OK ===== " >>test.out
174    scripts/cleanup
175 fi