root / test / import-export_unittest.bash @ 20571a26
History | View | Annotate | Download (9.2 kB)
1 | 2d76b580 | Michael Hanselmann | #!/bin/bash |
---|---|---|---|
2 | 2d76b580 | Michael Hanselmann | # |
3 | 2d76b580 | Michael Hanselmann | |
4 | 2d76b580 | Michael Hanselmann | # Copyright (C) 2010 Google Inc. |
5 | 2d76b580 | Michael Hanselmann | # |
6 | 2d76b580 | Michael Hanselmann | # This program is free software; you can redistribute it and/or modify |
7 | 2d76b580 | Michael Hanselmann | # it under the terms of the GNU General Public License as published by |
8 | 2d76b580 | Michael Hanselmann | # the Free Software Foundation; either version 2 of the License, or |
9 | 2d76b580 | Michael Hanselmann | # (at your option) any later version. |
10 | 2d76b580 | Michael Hanselmann | # |
11 | 2d76b580 | Michael Hanselmann | # This program is distributed in the hope that it will be useful, but |
12 | 2d76b580 | Michael Hanselmann | # WITHOUT ANY WARRANTY; without even the implied warranty of |
13 | 2d76b580 | Michael Hanselmann | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
14 | 2d76b580 | Michael Hanselmann | # General Public License for more details. |
15 | 2d76b580 | Michael Hanselmann | # |
16 | 2d76b580 | Michael Hanselmann | # You should have received a copy of the GNU General Public License |
17 | 2d76b580 | Michael Hanselmann | # along with this program; if not, write to the Free Software |
18 | 2d76b580 | Michael Hanselmann | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA |
19 | 2d76b580 | Michael Hanselmann | # 02110-1301, USA. |
20 | 2d76b580 | Michael Hanselmann | |
21 | 2d76b580 | Michael Hanselmann | set -e |
22 | 2d76b580 | Michael Hanselmann | set -o pipefail |
23 | 2d76b580 | Michael Hanselmann | |
24 | 2d76b580 | Michael Hanselmann | export PYTHON=${PYTHON:=python} |
25 | 2d76b580 | Michael Hanselmann | |
26 | 9d198e6f | Michael Hanselmann | impexpd="$PYTHON daemons/import-export -d" |
27 | 2d76b580 | Michael Hanselmann | |
28 | 2d76b580 | Michael Hanselmann | err() { |
29 | 2d76b580 | Michael Hanselmann | echo "$@" |
30 | 2d76b580 | Michael Hanselmann | echo 'Aborting' |
31 | 9d198e6f | Michael Hanselmann | show_output |
32 | 2d76b580 | Michael Hanselmann | exit 1 |
33 | 2d76b580 | Michael Hanselmann | } |
34 | 2d76b580 | Michael Hanselmann | |
35 | 9d198e6f | Michael Hanselmann | show_output() { |
36 | d6547a1c | Michael Hanselmann | if [[ -s "$gencert_output" ]]; then |
37 | d6547a1c | Michael Hanselmann | echo |
38 | d6547a1c | Michael Hanselmann | echo 'Generating certificates:' |
39 | d6547a1c | Michael Hanselmann | cat $gencert_output |
40 | d6547a1c | Michael Hanselmann | fi |
41 | 9d198e6f | Michael Hanselmann | if [[ -s "$dst_output" ]]; then |
42 | 9d198e6f | Michael Hanselmann | echo |
43 | 9d198e6f | Michael Hanselmann | echo 'Import output:' |
44 | 9d198e6f | Michael Hanselmann | cat $dst_output |
45 | 9d198e6f | Michael Hanselmann | fi |
46 | 9d198e6f | Michael Hanselmann | if [[ -s "$src_output" ]]; then |
47 | 9d198e6f | Michael Hanselmann | echo |
48 | 9d198e6f | Michael Hanselmann | echo 'Export output:' |
49 | 9d198e6f | Michael Hanselmann | cat $src_output |
50 | 9d198e6f | Michael Hanselmann | fi |
51 | 9d198e6f | Michael Hanselmann | } |
52 | 9d198e6f | Michael Hanselmann | |
53 | 2d76b580 | Michael Hanselmann | checkpids() { |
54 | 2d76b580 | Michael Hanselmann | local result=0 |
55 | 2d76b580 | Michael Hanselmann | |
56 | 2d76b580 | Michael Hanselmann | # Unlike combining the "wait" commands using || or &&, this ensures we |
57 | 2d76b580 | Michael Hanselmann | # actually wait for all PIDs. |
58 | 2d76b580 | Michael Hanselmann | for pid in "$@"; do |
59 | 2d76b580 | Michael Hanselmann | if ! wait $pid; then |
60 | 2d76b580 | Michael Hanselmann | result=1 |
61 | 2d76b580 | Michael Hanselmann | fi |
62 | 2d76b580 | Michael Hanselmann | done |
63 | 2d76b580 | Michael Hanselmann | |
64 | 2d76b580 | Michael Hanselmann | return $result |
65 | 2d76b580 | Michael Hanselmann | } |
66 | 2d76b580 | Michael Hanselmann | |
67 | 2d76b580 | Michael Hanselmann | get_testpath() { |
68 | 2d76b580 | Michael Hanselmann | echo "${TOP_SRCDIR:-.}/test" |
69 | 2d76b580 | Michael Hanselmann | } |
70 | 2d76b580 | Michael Hanselmann | |
71 | 2d76b580 | Michael Hanselmann | get_testfile() { |
72 | 2d76b580 | Michael Hanselmann | echo "$(get_testpath)/data/$1" |
73 | 2d76b580 | Michael Hanselmann | } |
74 | 2d76b580 | Michael Hanselmann | |
75 | 53dbf14c | Michael Hanselmann | upto() { |
76 | 53dbf14c | Michael Hanselmann | echo "$(date '+%F %T'):" "$@" '...' |
77 | 53dbf14c | Michael Hanselmann | } |
78 | 53dbf14c | Michael Hanselmann | |
79 | 2d76b580 | Michael Hanselmann | statusdir=$(mktemp -d) |
80 | 2d76b580 | Michael Hanselmann | trap "rm -rf $statusdir" EXIT |
81 | 2d76b580 | Michael Hanselmann | |
82 | d6547a1c | Michael Hanselmann | gencert_output=$statusdir/gencert.output |
83 | d6547a1c | Michael Hanselmann | |
84 | 2d76b580 | Michael Hanselmann | src_statusfile=$statusdir/src.status |
85 | 9d198e6f | Michael Hanselmann | src_output=$statusdir/src.output |
86 | 2d76b580 | Michael Hanselmann | src_x509=$statusdir/src.pem |
87 | 2d76b580 | Michael Hanselmann | |
88 | 2d76b580 | Michael Hanselmann | dst_statusfile=$statusdir/dst.status |
89 | 9d198e6f | Michael Hanselmann | dst_output=$statusdir/dst.output |
90 | 2d76b580 | Michael Hanselmann | dst_x509=$statusdir/dst.pem |
91 | 2d76b580 | Michael Hanselmann | |
92 | 2d76b580 | Michael Hanselmann | other_x509=$statusdir/other.pem |
93 | 2d76b580 | Michael Hanselmann | |
94 | 2d76b580 | Michael Hanselmann | testdata=$statusdir/data1 |
95 | 41a2e7d7 | Michael Hanselmann | largetestdata=$statusdir/data2 |
96 | 2d76b580 | Michael Hanselmann | |
97 | 53dbf14c | Michael Hanselmann | upto 'Command line parameter tests' |
98 | 53dbf14c | Michael Hanselmann | |
99 | 2d76b580 | Michael Hanselmann | $impexpd >/dev/null 2>&1 && |
100 | 2d76b580 | Michael Hanselmann | err "daemon-util succeeded without parameters" |
101 | 2d76b580 | Michael Hanselmann | |
102 | 2d76b580 | Michael Hanselmann | $impexpd foo bar baz moo boo >/dev/null 2>&1 && |
103 | 2d76b580 | Michael Hanselmann | err "daemon-util succeeded with wrong parameters" |
104 | 2d76b580 | Michael Hanselmann | |
105 | 2d76b580 | Michael Hanselmann | $impexpd $src_statusfile >/dev/null 2>&1 && |
106 | 2d76b580 | Michael Hanselmann | err "daemon-util succeeded with insufficient parameters" |
107 | 2d76b580 | Michael Hanselmann | |
108 | 2d76b580 | Michael Hanselmann | $impexpd $src_statusfile invalidmode >/dev/null 2>&1 && |
109 | 2d76b580 | Michael Hanselmann | err "daemon-util succeeded with invalid mode" |
110 | 2d76b580 | Michael Hanselmann | |
111 | 7e3c1da6 | Michael Hanselmann | $impexpd $src_statusfile import --compression=rot13 >/dev/null 2>&1 && |
112 | 7e3c1da6 | Michael Hanselmann | err "daemon-util succeeded with invalid compression" |
113 | 7e3c1da6 | Michael Hanselmann | |
114 | 4dd97aa1 | Michael Hanselmann | upto 'Generate test data' |
115 | 2d76b580 | Michael Hanselmann | cat $(get_testfile proc_drbd8.txt) $(get_testfile cert1.pem) > $testdata |
116 | 2d76b580 | Michael Hanselmann | |
117 | 41a2e7d7 | Michael Hanselmann | # Generate about 7.5 MB of test data |
118 | 41a2e7d7 | Michael Hanselmann | { tmp="$(<$testdata)" |
119 | 41a2e7d7 | Michael Hanselmann | for (( i=0; i < 100; ++i )); do |
120 | 41a2e7d7 | Michael Hanselmann | echo "$tmp $tmp $tmp $tmp $tmp $tmp" |
121 | 41a2e7d7 | Michael Hanselmann | done |
122 | 41a2e7d7 | Michael Hanselmann | dd if=/dev/zero bs=1024 count=4096 2>/dev/null |
123 | 41a2e7d7 | Michael Hanselmann | for (( i=0; i < 100; ++i )); do |
124 | 41a2e7d7 | Michael Hanselmann | echo "$tmp $tmp $tmp $tmp $tmp $tmp" |
125 | 41a2e7d7 | Michael Hanselmann | done |
126 | 41a2e7d7 | Michael Hanselmann | } > $largetestdata |
127 | 41a2e7d7 | Michael Hanselmann | |
128 | 2d76b580 | Michael Hanselmann | impexpd_helper() { |
129 | 2d76b580 | Michael Hanselmann | $PYTHON $(get_testpath)/import-export_unittest-helper "$@" |
130 | 2d76b580 | Michael Hanselmann | } |
131 | 2d76b580 | Michael Hanselmann | |
132 | ca9ec5aa | Michael Hanselmann | start_test() { |
133 | ca9ec5aa | Michael Hanselmann | upto "$@" |
134 | 2d76b580 | Michael Hanselmann | |
135 | ca9ec5aa | Michael Hanselmann | rm -f $src_statusfile $dst_output $dst_statusfile $dst_output |
136 | ca9ec5aa | Michael Hanselmann | rm -f $gencert_output |
137 | 53dbf14c | Michael Hanselmann | |
138 | ca9ec5aa | Michael Hanselmann | imppid= |
139 | ca9ec5aa | Michael Hanselmann | exppid= |
140 | 2d76b580 | Michael Hanselmann | |
141 | ca9ec5aa | Michael Hanselmann | cmd_prefix= |
142 | ca9ec5aa | Michael Hanselmann | cmd_suffix= |
143 | ca9ec5aa | Michael Hanselmann | connect_timeout=30 |
144 | ca9ec5aa | Michael Hanselmann | connect_retries=1 |
145 | ca9ec5aa | Michael Hanselmann | compress=gzip |
146 | 2d76b580 | Michael Hanselmann | } |
147 | 2d76b580 | Michael Hanselmann | |
148 | ca9ec5aa | Michael Hanselmann | wait_import_ready() { |
149 | 2d76b580 | Michael Hanselmann | # Wait for listening port |
150 | ca9ec5aa | Michael Hanselmann | impexpd_helper $dst_statusfile listen-port |
151 | 2d76b580 | Michael Hanselmann | } |
152 | 2d76b580 | Michael Hanselmann | |
153 | ca9ec5aa | Michael Hanselmann | do_export() { |
154 | 2d76b580 | Michael Hanselmann | local port=$1 |
155 | 2d76b580 | Michael Hanselmann | |
156 | 2d76b580 | Michael Hanselmann | $impexpd $src_statusfile export --bind=127.0.0.1 \ |
157 | 2d76b580 | Michael Hanselmann | --host=127.0.0.1 --port=$port \ |
158 | 2d76b580 | Michael Hanselmann | --key=$src_x509 --cert=$src_x509 --ca=$dst_x509 \ |
159 | 9d198e6f | Michael Hanselmann | --cmd-prefix="$cmd_prefix" --cmd-suffix="$cmd_suffix" \ |
160 | 9d198e6f | Michael Hanselmann | --connect-timeout=$connect_timeout \ |
161 | 7e3c1da6 | Michael Hanselmann | --connect-retries=$connect_retries \ |
162 | 7e3c1da6 | Michael Hanselmann | --compress=$compress |
163 | 2d76b580 | Michael Hanselmann | } |
164 | 2d76b580 | Michael Hanselmann | |
165 | 2d76b580 | Michael Hanselmann | do_import() { |
166 | 2d76b580 | Michael Hanselmann | $impexpd $dst_statusfile import --bind=127.0.0.1 \ |
167 | 2d76b580 | Michael Hanselmann | --host=127.0.0.1 \ |
168 | 2d76b580 | Michael Hanselmann | --key=$dst_x509 --cert=$dst_x509 --ca=$src_x509 \ |
169 | 9d198e6f | Michael Hanselmann | --cmd-prefix="$cmd_prefix" --cmd-suffix="$cmd_suffix" \ |
170 | 9d198e6f | Michael Hanselmann | --connect-timeout=$connect_timeout \ |
171 | 7e3c1da6 | Michael Hanselmann | --connect-retries=$connect_retries \ |
172 | 7e3c1da6 | Michael Hanselmann | --compress=$compress |
173 | 2d76b580 | Michael Hanselmann | } |
174 | 2d76b580 | Michael Hanselmann | |
175 | 9d198e6f | Michael Hanselmann | upto 'Generate X509 certificates and keys' |
176 | d6547a1c | Michael Hanselmann | impexpd_helper $src_x509 gencert 2>$gencert_output & srccertpid=$! |
177 | d6547a1c | Michael Hanselmann | impexpd_helper $dst_x509 gencert 2>$gencert_output & dstcertpid=$! |
178 | d6547a1c | Michael Hanselmann | impexpd_helper $other_x509 gencert 2>$gencert_output & othercertpid=$! |
179 | d6547a1c | Michael Hanselmann | checkpids $srccertpid $dstcertpid $othercertpid || \ |
180 | d6547a1c | Michael Hanselmann | err 'Failed to generate certificates' |
181 | 2d76b580 | Michael Hanselmann | |
182 | ca9ec5aa | Michael Hanselmann | start_test 'Normal case' |
183 | 9d198e6f | Michael Hanselmann | do_import > $statusdir/recv1 2>$dst_output & imppid=$! |
184 | ca9ec5aa | Michael Hanselmann | if port=$(wait_import_ready 2>$src_output); then |
185 | ca9ec5aa | Michael Hanselmann | do_export $port < $testdata >>$src_output 2>&1 & exppid=$! |
186 | ca9ec5aa | Michael Hanselmann | fi |
187 | 2d76b580 | Michael Hanselmann | checkpids $exppid $imppid || err 'An error occurred' |
188 | 2d76b580 | Michael Hanselmann | cmp $testdata $statusdir/recv1 || err 'Received data does not match input' |
189 | 2d76b580 | Michael Hanselmann | |
190 | ca9ec5aa | Michael Hanselmann | start_test 'Export using wrong CA' |
191 | 9d198e6f | Michael Hanselmann | # Setting lower timeout to not wait for too long |
192 | 9d198e6f | Michael Hanselmann | connect_timeout=1 do_import &>$dst_output & imppid=$! |
193 | ca9ec5aa | Michael Hanselmann | if port=$(wait_import_ready 2>$src_output); then |
194 | ca9ec5aa | Michael Hanselmann | : | dst_x509=$other_x509 do_export $port >>$src_output 2>&1 & exppid=$! |
195 | ca9ec5aa | Michael Hanselmann | fi |
196 | 2d76b580 | Michael Hanselmann | checkpids $exppid $imppid && err 'Export did not fail when using wrong CA' |
197 | 2d76b580 | Michael Hanselmann | |
198 | ca9ec5aa | Michael Hanselmann | start_test 'Import using wrong CA' |
199 | 9d198e6f | Michael Hanselmann | # Setting lower timeout to not wait for too long |
200 | 9d198e6f | Michael Hanselmann | src_x509=$other_x509 connect_timeout=1 do_import &>$dst_output & imppid=$! |
201 | ca9ec5aa | Michael Hanselmann | if port=$(wait_import_ready 2>$src_output); then |
202 | ca9ec5aa | Michael Hanselmann | : | do_export $port >>$src_output 2>&1 & exppid=$! |
203 | ca9ec5aa | Michael Hanselmann | fi |
204 | 2d76b580 | Michael Hanselmann | checkpids $exppid $imppid && err 'Import did not fail when using wrong CA' |
205 | 2d76b580 | Michael Hanselmann | |
206 | ca9ec5aa | Michael Hanselmann | start_test 'Suffix command on import' |
207 | 9d198e6f | Michael Hanselmann | cmd_suffix="| cksum > $statusdir/recv2" do_import &>$dst_output & imppid=$! |
208 | ca9ec5aa | Michael Hanselmann | if port=$(wait_import_ready 2>$src_output); then |
209 | ca9ec5aa | Michael Hanselmann | do_export $port < $testdata >>$src_output 2>&1 & exppid=$! |
210 | ca9ec5aa | Michael Hanselmann | fi |
211 | 2d76b580 | Michael Hanselmann | checkpids $exppid $imppid || err 'Testing additional commands failed' |
212 | 2d76b580 | Michael Hanselmann | cmp $statusdir/recv2 <(cksum < $testdata) || \ |
213 | 2d76b580 | Michael Hanselmann | err 'Checksum of received data does not match' |
214 | 2d76b580 | Michael Hanselmann | |
215 | ca9ec5aa | Michael Hanselmann | start_test 'Prefix command on export' |
216 | 9d198e6f | Michael Hanselmann | do_import > $statusdir/recv3 2>$dst_output & imppid=$! |
217 | ca9ec5aa | Michael Hanselmann | if port=$(wait_import_ready 2>$src_output); then |
218 | ca9ec5aa | Michael Hanselmann | cmd_prefix='cksum |' do_export $port <$testdata >>$src_output 2>&1 & exppid=$! |
219 | ca9ec5aa | Michael Hanselmann | fi |
220 | 2d76b580 | Michael Hanselmann | checkpids $exppid $imppid || err 'Testing additional commands failed' |
221 | 2d76b580 | Michael Hanselmann | cmp $statusdir/recv3 <(cksum < $testdata) || \ |
222 | 2d76b580 | Michael Hanselmann | err 'Received checksum does not match' |
223 | 2d76b580 | Michael Hanselmann | |
224 | ca9ec5aa | Michael Hanselmann | start_test 'Failing prefix command on export' |
225 | ca9ec5aa | Michael Hanselmann | : | cmd_prefix='exit 1;' do_export 0 &>$src_output & exppid=$! |
226 | 2d76b580 | Michael Hanselmann | checkpids $exppid && err 'Prefix command on export did not fail when it should' |
227 | 2d76b580 | Michael Hanselmann | |
228 | ca9ec5aa | Michael Hanselmann | start_test 'Failing suffix command on export' |
229 | ca9ec5aa | Michael Hanselmann | do_import >&$dst_output & imppid=$! |
230 | ca9ec5aa | Michael Hanselmann | if port=$(wait_import_ready 2>$src_output); then |
231 | ca9ec5aa | Michael Hanselmann | : | cmd_suffix='| exit 1' do_export $port >>$src_output 2>&1 & exppid=$! |
232 | ca9ec5aa | Michael Hanselmann | fi |
233 | 2d76b580 | Michael Hanselmann | checkpids $imppid $exppid && \ |
234 | 2d76b580 | Michael Hanselmann | err 'Suffix command on export did not fail when it should' |
235 | 2d76b580 | Michael Hanselmann | |
236 | ca9ec5aa | Michael Hanselmann | start_test 'Failing prefix command on import' |
237 | 9d198e6f | Michael Hanselmann | cmd_prefix='exit 1;' do_import &>$dst_output & imppid=$! |
238 | 2d76b580 | Michael Hanselmann | checkpids $imppid && err 'Prefix command on import did not fail when it should' |
239 | 2d76b580 | Michael Hanselmann | |
240 | ca9ec5aa | Michael Hanselmann | start_test 'Failing suffix command on import' |
241 | 9d198e6f | Michael Hanselmann | cmd_suffix='| exit 1' do_import &>$dst_output & imppid=$! |
242 | ca9ec5aa | Michael Hanselmann | if port=$(wait_import_ready 2>$src_output); then |
243 | ca9ec5aa | Michael Hanselmann | : | do_export $port >>$src_output 2>&1 & exppid=$! |
244 | ca9ec5aa | Michael Hanselmann | fi |
245 | 2d76b580 | Michael Hanselmann | checkpids $imppid $exppid && \ |
246 | 2d76b580 | Michael Hanselmann | err 'Suffix command on import did not fail when it should' |
247 | 2d76b580 | Michael Hanselmann | |
248 | ca9ec5aa | Michael Hanselmann | start_test 'Listen timeout A' |
249 | 9d198e6f | Michael Hanselmann | # Setting lower timeout to not wait too long (there won't be anything trying to |
250 | 9d198e6f | Michael Hanselmann | # connect) |
251 | 9d198e6f | Michael Hanselmann | connect_timeout=1 do_import &>$dst_output & imppid=$! |
252 | 9d198e6f | Michael Hanselmann | checkpids $imppid && \ |
253 | 9d198e6f | Michael Hanselmann | err 'Listening with timeout did not fail when it should' |
254 | 9d198e6f | Michael Hanselmann | |
255 | ca9ec5aa | Michael Hanselmann | start_test 'Listen timeout B' |
256 | 9d198e6f | Michael Hanselmann | do_import &>$dst_output & imppid=$! |
257 | ca9ec5aa | Michael Hanselmann | if port=$(wait_import_ready 2>$src_output); then |
258 | ca9ec5aa | Michael Hanselmann | { sleep 1; : | do_export $port; } >>$src_output 2>&1 & exppid=$! |
259 | ca9ec5aa | Michael Hanselmann | fi |
260 | 9d198e6f | Michael Hanselmann | checkpids $exppid $imppid || \ |
261 | 9d198e6f | Michael Hanselmann | err 'Listening with timeout failed when it should not' |
262 | 9d198e6f | Michael Hanselmann | |
263 | ca9ec5aa | Michael Hanselmann | start_test 'Connect timeout' |
264 | 4dd97aa1 | Michael Hanselmann | # Setting lower timeout as nothing will be listening on port 0 |
265 | ca9ec5aa | Michael Hanselmann | : | connect_timeout=1 do_export 0 &>$src_output & exppid=$! |
266 | 4dd97aa1 | Michael Hanselmann | checkpids $exppid && err 'Connection did not time out when it should' |
267 | 4dd97aa1 | Michael Hanselmann | |
268 | ca9ec5aa | Michael Hanselmann | start_test 'No compression' |
269 | 7e3c1da6 | Michael Hanselmann | compress=none do_import > $statusdir/recv-nocompr 2>$dst_output & imppid=$! |
270 | ca9ec5aa | Michael Hanselmann | if port=$(wait_import_ready 2>$src_output); then |
271 | ca9ec5aa | Michael Hanselmann | compress=none do_export $port < $testdata >>$src_output 2>&1 & exppid=$! |
272 | ca9ec5aa | Michael Hanselmann | fi |
273 | 7e3c1da6 | Michael Hanselmann | checkpids $exppid $imppid || err 'An error occurred' |
274 | 7e3c1da6 | Michael Hanselmann | cmp $testdata $statusdir/recv-nocompr || \ |
275 | 7e3c1da6 | Michael Hanselmann | err 'Received data does not match input' |
276 | 7e3c1da6 | Michael Hanselmann | |
277 | ca9ec5aa | Michael Hanselmann | start_test 'Compression mismatch A' |
278 | 7e3c1da6 | Michael Hanselmann | compress=none do_import > $statusdir/recv-miscompr 2>$dst_output & imppid=$! |
279 | ca9ec5aa | Michael Hanselmann | if port=$(wait_import_ready 2>$src_output); then |
280 | ca9ec5aa | Michael Hanselmann | compress=gzip do_export $port < $testdata >>$src_output 2>&1 & exppid=$! |
281 | ca9ec5aa | Michael Hanselmann | fi |
282 | 7e3c1da6 | Michael Hanselmann | checkpids $exppid $imppid || err 'An error occurred' |
283 | 7e3c1da6 | Michael Hanselmann | cmp -s $testdata $statusdir/recv-miscompr && \ |
284 | 7e3c1da6 | Michael Hanselmann | err 'Received data matches input when it should not' |
285 | 7e3c1da6 | Michael Hanselmann | |
286 | ca9ec5aa | Michael Hanselmann | start_test 'Compression mismatch B' |
287 | 7e3c1da6 | Michael Hanselmann | compress=gzip do_import > $statusdir/recv-miscompr2 2>$dst_output & imppid=$! |
288 | ca9ec5aa | Michael Hanselmann | if port=$(wait_import_ready 2>$src_output); then |
289 | ca9ec5aa | Michael Hanselmann | compress=none do_export $port < $testdata >>$src_output 2>&1 & exppid=$! |
290 | ca9ec5aa | Michael Hanselmann | fi |
291 | 7e3c1da6 | Michael Hanselmann | checkpids $exppid $imppid && err 'Did not fail when it should' |
292 | 7e3c1da6 | Michael Hanselmann | cmp -s $testdata $statusdir/recv-miscompr2 && \ |
293 | 7e3c1da6 | Michael Hanselmann | err 'Received data matches input when it should not' |
294 | 7e3c1da6 | Michael Hanselmann | |
295 | ca9ec5aa | Michael Hanselmann | start_test 'Large transfer' |
296 | 41a2e7d7 | Michael Hanselmann | do_import > $statusdir/recv-large 2>$dst_output & imppid=$! |
297 | ca9ec5aa | Michael Hanselmann | if port=$(wait_import_ready 2>$src_output); then |
298 | ca9ec5aa | Michael Hanselmann | do_export $port < $largetestdata >>$src_output 2>&1 & exppid=$! |
299 | ca9ec5aa | Michael Hanselmann | fi |
300 | 41a2e7d7 | Michael Hanselmann | checkpids $exppid $imppid || err 'An error occurred' |
301 | 41a2e7d7 | Michael Hanselmann | cmp $largetestdata $statusdir/recv-large || \ |
302 | 41a2e7d7 | Michael Hanselmann | err 'Received data does not match input' |
303 | 41a2e7d7 | Michael Hanselmann | |
304 | 2d76b580 | Michael Hanselmann | exit 0 |