blob: f84fa6f4e22ac213b7d2faaff4cd2e33399f0d1e [file] [log] [blame]
Darren Tuckered6b0c52009-10-07 10:43:57 +11001# $OpenBSD: sftp.sh,v 1.3 2009/08/13 01:11:55 djm Exp $
Damien Miller38cd4352002-05-01 13:17:33 +10002# Placed in the Public Domain.
3
4tid="basic sftp put/get"
5
Darren Tuckerf2412542003-09-04 14:56:49 +10006DATA=/bin/ls${EXEEXT}
Damien Miller38cd4352002-05-01 13:17:33 +10007COPY=${OBJ}/copy
8
Darren Tuckere15b0dd2003-09-04 15:00:55 +10009SFTPCMDFILE=${OBJ}/batch
10cat >$SFTPCMDFILE <<EOF
11version
12get $DATA ${COPY}.1
13put $DATA ${COPY}.2
14EOF
15
Damien Miller38cd4352002-05-01 13:17:33 +100016BUFFERSIZE="5 1000 32000 64000"
17REQUESTS="1 2 10"
18
19for B in ${BUFFERSIZE}; do
20 for R in ${REQUESTS}; do
21 verbose "test $tid: buffer_size $B num_requests $R"
Darren Tuckered6b0c52009-10-07 10:43:57 +110022 rm -f ${COPY}.1 ${COPY}.2
23 ${SFTP} -D ${SFTPSERVER} -B $B -R $R -b $SFTPCMDFILE \
Darren Tuckere15b0dd2003-09-04 15:00:55 +100024 > /dev/null 2>&1
Damien Miller38cd4352002-05-01 13:17:33 +100025 r=$?
26 if [ $r -ne 0 ]; then
27 fail "sftp failed with $r"
Darren Tuckere15b0dd2003-09-04 15:00:55 +100028 else
29 cmp $DATA ${COPY}.1 || fail "corrupted copy after get"
30 cmp $DATA ${COPY}.2 || fail "corrupted copy after put"
Damien Miller38cd4352002-05-01 13:17:33 +100031 fi
Damien Miller38cd4352002-05-01 13:17:33 +100032 done
33done
Darren Tuckere15b0dd2003-09-04 15:00:55 +100034rm -f ${COPY}.1 ${COPY}.2
35rm -f $SFTPCMDFILE