Darren Tucker | c863895 | 2009-10-07 10:46:29 +1100 | [diff] [blame] | 1 | # $OpenBSD: ssh-com-sftp.sh,v 1.6 2009/08/20 18:43:07 djm Exp $ |
Damien Miller | 38cd435 | 2002-05-01 13:17:33 +1000 | [diff] [blame] | 2 | # Placed in the Public Domain. |
| 3 | |
| 4 | tid="basic sftp put/get with ssh.com server" |
| 5 | |
Darren Tucker | c2c4223 | 2003-09-04 14:54:39 +1000 | [diff] [blame] | 6 | DATA=/bin/ls${EXEEXT} |
Damien Miller | 38cd435 | 2002-05-01 13:17:33 +1000 | [diff] [blame] | 7 | COPY=${OBJ}/copy |
Darren Tucker | bd05609 | 2003-09-04 15:26:57 +1000 | [diff] [blame] | 8 | SFTPCMDFILE=${OBJ}/batch |
| 9 | |
| 10 | cat >$SFTPCMDFILE <<EOF |
| 11 | version |
| 12 | get $DATA ${COPY}.1 |
| 13 | put $DATA ${COPY}.2 |
| 14 | EOF |
Damien Miller | 38cd435 | 2002-05-01 13:17:33 +1000 | [diff] [blame] | 15 | |
| 16 | BUFFERSIZE="5 1000 32000 64000" |
| 17 | REQUESTS="1 2 10" |
| 18 | |
| 19 | #TEST_COMBASE=/path/to/ssh/com/binaries |
| 20 | if [ "X${TEST_COMBASE}" = "X" ]; then |
| 21 | fatal '$TEST_COMBASE is not set' |
| 22 | fi |
| 23 | |
| 24 | VERSIONS=" |
| 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 Miller | 8b9cde7 | 2003-01-22 17:53:16 +1100 | [diff] [blame] | 34 | 3.1.0 |
| 35 | 3.2.0 |
Darren Tucker | ee5f83d | 2003-06-18 22:36:48 +1000 | [diff] [blame] | 36 | 3.2.2 |
| 37 | 3.2.3 |
Darren Tucker | 437a5f0 | 2004-02-29 20:33:51 +1100 | [diff] [blame] | 38 | 3.2.5 |
| 39 | 3.2.9 |
| 40 | 3.2.9.1 |
Damien Miller | 8b9cde7 | 2003-01-22 17:53:16 +1100 | [diff] [blame] | 41 | 3.3.0" |
Damien Miller | 38cd435 | 2002-05-01 13:17:33 +1000 | [diff] [blame] | 42 | |
| 43 | # go for it |
| 44 | for 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 Tucker | c863895 | 2009-10-07 10:46:29 +1100 | [diff] [blame] | 54 | ${SFTP} -D ${server} -B $B -R $R -b $SFTPCMDFILE \ |
Darren Tucker | bd05609 | 2003-09-04 15:26:57 +1000 | [diff] [blame] | 55 | > /dev/null 2>&1 |
Damien Miller | 38cd435 | 2002-05-01 13:17:33 +1000 | [diff] [blame] | 56 | r=$? |
| 57 | if [ $r -ne 0 ]; then |
| 58 | fail "sftp failed with $r" |
Darren Tucker | bd05609 | 2003-09-04 15:26:57 +1000 | [diff] [blame] | 59 | else |
| 60 | cmp $DATA ${COPY}.1 || fail "corrupted copy after get" |
| 61 | cmp $DATA ${COPY}.2 || fail "corrupted copy after put" |
Damien Miller | 38cd435 | 2002-05-01 13:17:33 +1000 | [diff] [blame] | 62 | fi |
Damien Miller | 38cd435 | 2002-05-01 13:17:33 +1000 | [diff] [blame] | 63 | done |
| 64 | done |
| 65 | done |
Darren Tucker | bd05609 | 2003-09-04 15:26:57 +1000 | [diff] [blame] | 66 | rm -f ${COPY}.1 ${COPY}.2 |
| 67 | rm -f $SFTPCMDFILE |