xref: /freebsd/crypto/openssh/regress/ssh-com-sftp.sh (revision 02e9120893770924227138ba49df1edb3896112a)
1#	$OpenBSD: ssh-com-sftp.sh,v 1.7 2013/05/17 04:29:14 dtucker Exp $
2#	Placed in the Public Domain.
3
4tid="basic sftp put/get with ssh.com server"
5
6SFTPCMDFILE=${OBJ}/batch
7
8cat >$SFTPCMDFILE <<EOF
9version
10get $DATA ${COPY}.1
11put $DATA ${COPY}.2
12EOF
13
14BUFFERSIZE="5 1000 32000 64000"
15REQUESTS="1 2 10"
16
17#TEST_COMBASE=/path/to/ssh/com/binaries
18if [ "X${TEST_COMBASE}" = "X" ]; then
19	fatal '$TEST_COMBASE is not set'
20fi
21
22VERSIONS="
23	2.0.10
24	2.0.12
25	2.0.13
26	2.1.0
27	2.2.0
28	2.3.0
29	2.3.1
30	2.4.0
31	3.0.0
32	3.1.0
33	3.2.0
34	3.2.2
35	3.2.3
36	3.2.5
37	3.2.9
38	3.2.9.1
39	3.3.0"
40
41# go for it
42for v in ${VERSIONS}; do
43	server=${TEST_COMBASE}/${v}/sftp-server2
44	if [ ! -x ${server} ]; then
45		continue
46	fi
47	verbose "sftp-server $v"
48	for B in ${BUFFERSIZE}; do
49		for R in ${REQUESTS}; do
50			verbose "test $tid: buffer_size $B num_requests $R"
51			rm -f ${COPY}.1 ${COPY}.2
52			${SFTP} -D ${server} -B $B -R $R -b $SFTPCMDFILE \
53			> /dev/null 2>&1
54			r=$?
55			if [ $r -ne 0 ]; then
56				fail "sftp failed with $r"
57			else
58				cmp $DATA ${COPY}.1 || fail "corrupted copy after get"
59				cmp $DATA ${COPY}.2 || fail "corrupted copy after put"
60			fi
61		done
62	done
63done
64rm -f ${COPY}.1 ${COPY}.2
65rm -f $SFTPCMDFILE
66