]> git.sur5r.net Git - bacula/bacula/blob - regress/tests/accurate-test
ebl typo
[bacula/bacula] / regress / tests / accurate-test
1 #!/bin/sh
2 #
3 # Run a accurate backup of the Bacula build directory
4 #   then restore it.
5 #
6 TestName="accurate-test"
7 JobName=backup
8 . scripts/functions
9 scripts/cleanup
10
11 copy_test_confs
12 /bin/cp -f scripts/bacula-dir.conf.accurate bin/bacula-dir.conf
13 sed -i s/all,/all,saved,/ bin/bacula-fd.conf
14
15 change_jobname Client1 $JobName
16
17 # cleanup
18 rm -rf ${cwd}/build/accurate.new
19 rm -rf ${cwd}/build/accurate
20
21
22 # add extra files
23 mkdir ${cwd}/build/accurate
24 echo "test test" > ${cwd}/build/accurate/xxx
25 echo "test test" > ${cwd}/build/accurate/yyy
26 echo "test test" > ${cwd}/build/accurate/zzz
27 echo ${cwd}/build > ${cwd}/tmp/file-list
28
29 start_test
30
31 cat <<END_OF_DATA >${cwd}/tmp/bconcmds
32 @output /dev/null
33 messages
34 label volume=TestVolume001 storage=File pool=Default
35 messages
36 END_OF_DATA
37
38 run_bacula
39
40 cat <<END_OF_DATA >${cwd}/tmp/bconcmds
41 @$out ${cwd}/tmp/log1.out
42 run job=$JobName yes
43 wait
44 messages
45 @# 
46 @# now do a restore
47 @#
48 @$out ${cwd}/tmp/log2.out  
49 restore fileset=FS_TESTJOB where=${cwd}/tmp/bacula-restores select all done
50 yes
51 wait
52 messages
53 @$out
54 quit
55 END_OF_DATA
56
57 ################################################################
58 # First :  We just run full and restore to compare if all is ok
59 ################################################################
60
61 run_bconsole
62 check_for_zombie_jobs storage=File
63
64 check_two_logs
65 check_restore_diff
66
67 rm -rf ${cwd}/tmp/bacula-restores
68
69 ################################################################
70 # Now do a second backup after making few changes
71 ################################################################
72 rm ${cwd}/build/accurate/xxx  # delete a file
73
74 run_bconsole
75 check_for_zombie_jobs storage=File
76
77 check_two_logs
78 check_restore_diff
79
80 rm -rf ${cwd}/tmp/bacula-restores
81
82 ################################################################
83 # Now do a third backup after making few changes
84 ################################################################
85
86 # some files will have disappear, others have their old mtime/ctime
87 mv ${cwd}/build/accurate ${cwd}/build/accurate.new
88
89 run_bconsole
90 check_for_zombie_jobs storage=File
91
92 check_two_logs
93 check_restore_diff
94
95 rm -rf ${cwd}/tmp/bacula-restores
96
97 ################################################################
98 # Now do an other test in differential mode
99 ################################################################
100
101 cat <<END_OF_DATA >${cwd}/tmp/bconcmds
102 @$out ${cwd}/tmp/log1.out
103 run job=$JobName level=differential yes
104 wait
105 messages
106 @# 
107 @# now do a restore
108 @#
109 @$out ${cwd}/tmp/log2.out  
110 restore fileset=FS_TESTJOB where=${cwd}/tmp/bacula-restores select all done
111 yes
112 wait
113 messages
114 @$out
115 quit
116 END_OF_DATA
117
118 run_bconsole
119 check_for_zombie_jobs storage=File
120
121 check_two_logs
122 check_restore_diff
123
124 rm -rf ${cwd}/tmp/bacula-restores
125
126 ################################################################
127 # Now do an other test in differential mode + incremental
128 ################################################################
129
130 # make some changes
131 mv ${cwd}/build/accurate.new ${cwd}/build/accurate
132
133 cat <<END_OF_DATA >${cwd}/tmp/bconcmds
134 @$out ${cwd}/tmp/log1.out
135 run job=$JobName yes
136 wait
137 messages
138 @# 
139 @# now do a restore
140 @#
141 @$out ${cwd}/tmp/log2.out  
142 restore fileset=FS_TESTJOB where=${cwd}/tmp/bacula-restores select all done
143 yes
144 wait
145 messages
146 @$out
147 quit
148 END_OF_DATA
149
150 run_bconsole
151 check_for_zombie_jobs storage=File
152
153 check_two_logs
154 check_restore_diff
155
156 rm -rf ${cwd}/tmp/bacula-restores
157
158
159 ################################################################
160 # Now do a test with other attributes (owner, gid, rights)
161 ################################################################
162
163 cat <<END_OF_DATA >${cwd}/tmp/bconcmds
164 @$out ${cwd}/tmp/log1.out
165 run job=backup_advance yes
166 wait
167 messages
168 @# 
169 @# now do a restore
170 @#
171 @$out ${cwd}/tmp/log2.out  
172 restore fileset=FS_TESTJOB_ADVANCE where=${cwd}/tmp/bacula-restores select all done
173 yes
174 wait
175 messages
176 @$out
177 quit
178 END_OF_DATA
179
180 run_bconsole
181 check_for_zombie_jobs storage=File
182
183 check_two_logs
184 check_restore_diff
185
186 rm -rf ${cwd}/tmp/bacula-restores
187
188
189 ################################################################
190 # Use the p option for verify
191 ################################################################
192
193 chmod 400 ${cwd}/build/accurate/yyy
194
195 cat <<END_OF_DATA >${cwd}/tmp/bconcmds
196 @$out ${cwd}/tmp/log1.out
197 run job=backup_advance yes
198 wait
199 messages
200 @# 
201 @# now do a restore
202 @#
203 @$out ${cwd}/tmp/log2.out  
204 restore fileset=FS_TESTJOB_ADVANCE where=${cwd}/tmp/bacula-restores select all done
205 yes
206 wait
207 messages
208 @$out
209 quit
210 END_OF_DATA
211
212 run_bconsole
213 check_for_zombie_jobs storage=File
214
215 check_two_logs
216 check_restore_diff
217
218 rm -rf ${cwd}/tmp/bacula-restores
219
220 if ! grep 'st_mode  differ' tmp/log1.out > /dev/null
221 then
222     bstat=2
223 fi
224
225 stop_bacula
226 end_test