blob: be6f4e0dcc900e0a6f7624d5a2a300e1c658c094 [file] [log] [blame]
Darren Tuckerc8638952009-10-07 10:46:29 +11001# $OpenBSD: ssh-com-sftp.sh,v 1.6 2009/08/20 18:43:07 djm Exp $
Damien Miller38cd4352002-05-01 13:17:33 +10002# Placed in the Public Domain.
3
4tid="basic sftp put/get with ssh.com server"
5
Darren Tuckerc2c42232003-09-04 14:54:39 +10006DATA=/bin/ls${EXEEXT}
Damien Miller38cd4352002-05-01 13:17:33 +10007COPY=${OBJ}/copy
Darren Tuckerbd056092003-09-04 15:26:57 +10008SFTPCMDFILE=${OBJ}/batch
9
10cat >$SFTPCMDFILE <<EOF
11version
12get $DATA ${COPY}.1
13put $DATA ${COPY}.2
14EOF
Damien Miller38cd4352002-05-01 13:17:33 +100015
16BUFFERSIZE="5 1000 32000 64000"
17REQUESTS="1 2 10"
18
19#TEST_COMBASE=/path/to/ssh/com/binaries
20if [ "X${TEST_COMBASE}" = "X" ]; then
21 fatal '$TEST_COMBASE is not set'
22fi
23
24VERSIONS="
25 2.0.10
26 2.0.12
27 2.0.13
28 2.1.0
29 2.2.0
30 2.3.0
31 2.3.1
32 2.4.0
33 3.0.0
Damien Miller8b9cde72003-01-22 17:53:16 +110034 3.1.0
35 3.2.0
Darren Tuckeree5f83d2003-06-18 22:36:48 +100036 3.2.2
37 3.2.3
Darren Tucker437a5f02004-02-29 20:33:51 +110038 3.2.5
39 3.2.9
40 3.2.9.1
Damien Miller8b9cde72003-01-22 17:53:16 +110041 3.3.0"
Damien Miller38cd4352002-05-01 13:17:33 +100042
43# go for it
44for v in ${VERSIONS}; do
45 server=${TEST_COMBASE}/${v}/sftp-server2
46 if [ ! -x ${server} ]; then
47 continue
48 fi
49 verbose "sftp-server $v"
50 for B in ${BUFFERSIZE}; do
51 for R in ${REQUESTS}; do
52 verbose "test $tid: buffer_size $B num_requests $R"
53 rm -f ${COPY}.1 ${COPY}.2
Darren Tuckerc8638952009-10-07 10:46:29 +110054 ${SFTP} -D ${server} -B $B -R $R -b $SFTPCMDFILE \
Darren Tuckerbd056092003-09-04 15:26:57 +100055 > /dev/null 2>&1
Damien Miller38cd4352002-05-01 13:17:33 +100056 r=$?
57 if [ $r -ne 0 ]; then
58 fail "sftp failed with $r"
Darren Tuckerbd056092003-09-04 15:26:57 +100059 else
60 cmp $DATA ${COPY}.1 || fail "corrupted copy after get"
61 cmp $DATA ${COPY}.2 || fail "corrupted copy after put"
Damien Miller38cd4352002-05-01 13:17:33 +100062 fi
Damien Miller38cd4352002-05-01 13:17:33 +100063 done
64 done
65done
Darren Tuckerbd056092003-09-04 15:26:57 +100066rm -f ${COPY}.1 ${COPY}.2
67rm -f $SFTPCMDFILE