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