]> git.sur5r.net Git - bacula/bacula/blob - regress/tests/incremental-test
baculum: Add strip_prefix, add_prefix, add_suffix and regex_where restore options...
[bacula/bacula] / regress / tests / incremental-test
1 #!/bin/sh
2 #
3 # Copyright (C) 2000-2015 Kern Sibbald
4 # License: BSD 2-Clause; see file LICENSE-FOSS
5 #
6
7 #
8 # Run a simple backup of the Bacula build directory then create some           
9 #   new files, do an Incremental and restore those two files.
10 #
11 TestName="incremental-test"
12 JobName=Incremental 
13 . scripts/functions
14
15 ${rscripts}/cleanup
16 ${rscripts}/copy-test-confs
17 echo "${tmpsrc}" >${tmp}/file-list
18 mkdir -p ${tmpsrc}
19 cp -p ${src}/src/dird/*.c ${tmpsrc}
20 cd ${tmp}
21 echo "${tmpsrc}/ficheriro1.txt" >restore-list
22 echo "${tmpsrc}/ficheriro2.txt" >>restore-list
23 cd ${cwd}
24
25 change_jobname CompressedTest $JobName
26 start_test
27
28 cat <<END_OF_DATA >${tmp}/bconcmds
29 @output /dev/null
30 messages
31 @$out ${tmp}/log1.out
32 setdebug level=4 storage=File
33 @#setdebug level=200 client
34 @#setdebug level=100 director
35 label storage=File volume=TestVolume001
36 label storage=File volume=TestVolume002
37 run job=$JobName yes
38 status client
39 wait
40 messages
41 quit
42 END_OF_DATA
43
44 run_bacula
45 check_for_zombie_jobs storage=File
46 #
47 # Now create two new files to be restored later
48 #
49 sleep 1
50 echo "ficheriro1.txt" >${tmpsrc}/ficheriro1.txt
51 cp -f ${tmpsrc}/dird.c ${tmpsrc}/ficheriro2.txt
52
53 cat <<END_OF_DATA >${tmp}/bconcmds
54 @output /dev/null
55 messages
56 @$out ${tmp}/log1.out
57 @# Force Incremental on the second Volume
58 setdebug level=4 storage=File
59 update volume=TestVolume001 VolStatus=Used
60 run level=Differential job=$JobName yes
61 wait
62 messages
63 quit
64 END_OF_DATA
65
66 run_bconsole
67
68 sleep 1
69 touch ${tmpsrc}/ficheriro1.txt
70 touch ${tmpsrc}/ficheriro2.txt
71
72 cat <<END_OF_DATA >${tmp}/bconcmds
73 @output /dev/null
74 messages
75 @$out ${tmp}/log1.out
76 setdebug level=4 storage=File
77 run level=Incremental job=$JobName yes
78 wait
79 messages
80 quit
81 END_OF_DATA
82
83 run_bconsole
84
85 sleep 1
86 cd ${tmpsrc}
87 cp -f ficheriro2.txt 1
88 sed "s%a%b%g" 1 >ficheriro2.txt
89 rm -f 1
90 cd ${cwd}
91 cat <<END_OF_DATA >${tmp}/bconcmds
92 @output /dev/null
93 messages
94 @$out ${tmp}/log1.out
95 setdebug level=4 storage=File
96 run level=Differential job=$JobName yes
97 wait
98 messages
99 quit
100 END_OF_DATA
101
102 run_bconsole
103
104 sleep 1
105 touch ${tmpsrc}/ficheriro1.txt
106 touch ${tmpsrc}/ficheriro2.txt
107 cat <<END_OF_DATA >${tmp}/bconcmds
108 @output /dev/null
109 messages
110 @$out ${tmp}/log1.out
111 setdebug level=4 storage=File
112 run level=Incremental job=$JobName yes
113 wait
114 messages
115 quit
116 END_OF_DATA
117
118 run_bconsole
119
120 sleep 1
121 touch ${tmpsrc}/ficheriro1.txt
122 touch ${tmpsrc}/ficheriro2.txt
123 cat <<END_OF_DATA >${tmp}/bconcmds
124 @output /dev/null
125 messages
126 @$out ${tmp}/log1.out
127 setdebug level=4 storage=File
128 run level=Incremental job=$JobName yes
129 wait
130 messages
131 quit
132 END_OF_DATA
133
134 run_bconsole
135
136 sleep 1
137 touch ${tmpsrc}/ficheriro1.txt
138 touch ${tmpsrc}/ficheriro2.txt
139 cat <<END_OF_DATA >${tmp}/bconcmds
140 @output /dev/null
141 messages
142 @$out ${tmp}/log1.out
143 setdebug level=4 storage=File
144 run level=Incremental job=$JobName yes
145 wait
146 messages
147 quit
148 END_OF_DATA
149
150 run_bconsole
151 sleep 1
152 touch ${tmpsrc}/ficheriro1.txt
153 touch ${tmpsrc}/ficheriro2.txt
154
155 cat <<END_OF_DATA >${tmp}/bconcmds
156 @output /dev/null
157 messages
158 @$out ${tmp}/log1.out
159 setdebug level=4 storage=File
160 run level=Incremental job=$JobName yes
161 wait
162 messages
163 @# 
164 @# now do a restore
165 @#
166 @$out ${tmp}/log2.out
167 setdebug level=10 storage=File
168 restore where=${tmp}/bacula-restores storage=File file=<${tmp}/restore-list
169 yes
170 wait
171 status client
172 status storage=File
173 messages
174 quit
175 END_OF_DATA
176
177 run_bconsole
178 check_for_zombie_jobs storage=File
179 stop_bacula
180
181 check_two_logs
182 #
183 # Delete .c files because we will only restored the txt files
184 #
185 rm -f ${tmpsrc}/*.c
186 check_restore_tmp_build_diff
187 end_test