xref: /freebsd/crypto/openssh/regress/sftp.sh (revision 911f0260390e18cf85f3dbf2c719b593efdc1e3c)
1#	$OpenBSD: sftp.sh,v 1.6 2017/10/30 21:59:43 djm Exp $
2#	Placed in the Public Domain.
3
4tid="basic sftp put/get"
5
6SFTPCMDFILE=${OBJ}/batch
7cat >$SFTPCMDFILE <<EOF
8version
9get $DATA ${COPY}.1
10put $DATA ${COPY}.2
11EOF
12
13BUFFERSIZE="5 1000 32000 64000"
14REQUESTS="1 2 10"
15
16for B in ${BUFFERSIZE}; do
17	for R in ${REQUESTS}; do
18                verbose "test $tid: buffer_size $B num_requests $R"
19		rm -f ${COPY}.1 ${COPY}.2
20		${SFTP} -D ${SFTPSERVER} -B $B -R $R -b $SFTPCMDFILE \
21		> /dev/null 2>&1
22		r=$?
23		if [ $r -ne 0 ]; then
24			fail "sftp failed with $r"
25		else
26			cmp $DATA ${COPY}.1 || fail "corrupted copy after get"
27			cmp $DATA ${COPY}.2 || fail "corrupted copy after put"
28		fi
29	done
30done
31rm -f ${COPY}.1 ${COPY}.2
32rm -f $SFTPCMDFILE
33