]> git.sur5r.net Git - bacula/bacula/blob - regress/tests/bvfs-test
Fix spooldata, accurate and ingnoreduplicate run argument
[bacula/bacula] / regress / tests / bvfs-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 # test the bvfs interface
6 #
7 TestName="bvfs-test"
8 JobName=Incremental 
9 . scripts/functions
10
11 ${rscripts}/cleanup
12 ${rscripts}/copy-test-confs
13 echo "${tmpsrc}" >${tmp}/file-list
14 echo "${cwd}/build" >> ${tmp}/file-list
15
16 mkdir -p ${tmpsrc}
17 cp -p ${src}/src/dird/*.c ${tmpsrc}
18 cd ${tmp}
19 echo "${tmpsrc}/ficheriro1.txt" >restore-list
20 echo "${tmpsrc}/ficheriro2.txt" >>restore-list
21 cd ${cwd}
22
23 change_jobname CompressedTest $JobName
24 start_test
25
26 cat <<END_OF_DATA >${tmp}/bconcmds
27 @$out /dev/null
28 messages
29 @$out ${tmp}/log1.out
30 label storage=File volume=TestVolume001
31 label storage=File volume=TestVolume002
32 run job=$JobName yes
33 wait
34 messages
35 quit
36 END_OF_DATA
37
38 run_bacula
39 check_for_zombie_jobs storage=File
40 #
41 # Now create two new files to be restored later
42 #
43 sleep 1
44 echo "ficheriro1.txt" >${tmpsrc}/ficheriro1.txt
45 cp -f ${tmpsrc}/dird.c ${tmpsrc}/ficheriro2.txt
46
47 cat <<END_OF_DATA >${tmp}/bconcmds
48 @$out /dev/null
49 messages
50 @$out ${tmp}/log1.out
51 @# Force Incremental on the second Volume
52 update volume=TestVolume001 VolStatus=Used
53 run level=Differential job=$JobName yes
54 wait
55 messages
56 quit
57 END_OF_DATA
58
59 run_bconsole
60
61 sleep 1
62 touch ${tmpsrc}/ficheriro1.txt
63 touch ${tmpsrc}/ficheriro2.txt
64
65 cat <<END_OF_DATA >${tmp}/bconcmds
66 @$out /dev/null
67 messages
68 @$out ${tmp}/log1.out
69 run level=Incremental job=$JobName yes
70 wait
71 messages
72 quit
73 END_OF_DATA
74
75 run_bconsole
76
77 sleep 1
78 cd ${tmpsrc}
79 cp -f ficheriro2.txt 1
80 sed "s%a%b%g" 1 >ficheriro2.txt
81 rm -f 1
82 cd ${cwd}
83 cat <<END_OF_DATA >${tmp}/bconcmds
84 @$out /dev/null
85 messages
86 @$out ${tmp}/log1.out
87 run level=Differential job=$JobName yes
88 wait
89 messages
90 quit
91 END_OF_DATA
92
93 run_bconsole
94
95 sleep 1
96 touch ${tmpsrc}/ficheriro1.txt
97 touch ${tmpsrc}/ficheriro2.txt
98 cat <<END_OF_DATA >${tmp}/bconcmds
99 @$out /dev/null
100 messages
101 @$out ${tmp}/log1.out
102 run level=Incremental job=$JobName yes
103 wait
104 messages
105 quit
106 END_OF_DATA
107
108 run_bconsole
109
110 sleep 1
111 touch ${tmpsrc}/ficheriro1.txt
112 touch ${tmpsrc}/ficheriro2.txt
113 cat <<END_OF_DATA >${tmp}/bconcmds
114 @$out /dev/null
115 messages
116 @$out ${tmp}/log1.out
117 run level=Incremental job=$JobName yes
118 wait
119 messages
120 quit
121 END_OF_DATA
122
123 run_bconsole
124
125 sleep 1
126 touch ${tmpsrc}/ficheriro1.txt
127 touch ${tmpsrc}/ficheriro2.txt
128 cat <<END_OF_DATA >${tmp}/bconcmds
129 @$out /dev/null
130 messages
131 @$out ${tmp}/log1.out
132 run level=Incremental job=$JobName yes
133 wait
134 messages
135 quit
136 END_OF_DATA
137
138 run_bconsole
139 sleep 1
140 touch ${tmpsrc}/ficheriro1.txt
141 touch ${tmpsrc}/ficheriro2.txt
142
143 cat <<END_OF_DATA >${tmp}/bconcmds
144 @$out /dev/null
145 messages
146 @$out ${tmp}/log1.out
147 run level=Incremental job=$JobName yes
148 wait
149 messages
150 @# 
151 @# now do a restore
152 @#
153 @$out ${tmp}/log2.out
154 setdebug level=10 storage=File
155 restore where=${tmp}/bacula-restores storage=File file=<${tmp}/restore-list
156 yes
157 wait
158 status storage=File
159 messages
160 @$out ${tmp}/log3.out
161 setdebug level=10 director
162 .bvfs_update
163 sql
164 SELECT HasCache FROM Job WHERE Type='B';
165
166 .bvfs_lsdir path=${tmpsrc}/ jobid=1,2,3,4,5,6,7,8
167 .bvfs_lsfile path=${tmpsrc}/ jobid=1,2,3,4,5,6,7,8
168 quit
169 END_OF_DATA
170
171 run_bconsole
172 check_for_zombie_jobs storage=File
173 stop_bacula
174
175 check_two_logs
176 #
177 # Delete .c files because we will only restored the txt files
178 #
179 rm -f ${tmpsrc}/*.c
180 check_restore_tmp_build_diff
181
182 ${cwd}/build/src/tools/bvfs_test -T  -p ${tmpsrc} -j 1,2,3,4,5,6,7,8 \
183     -w "$working" -n "$db_name" -u "$db_user" -P "$db_password"
184
185 ${cwd}/build/src/tools/bvfs_test  -p ${cwd}/build/ -j 1,2,3,4,5,6,7,8    \
186     -w "$working" -n "$db_name" -u "$db_user" -P "$db_password" 
187
188 ${cwd}/build/src/tools/bvfs_test  -p ${tmpsrc} -j 1,2,3,4,5,6,7,8    \
189     -w "$working" -n "$db_name" -u "$db_user" -P "$db_password" \
190     -f ficheriro1.txt -c ${HOST}-fd
191
192 end_test