Darren Tucker | ed6b0c5 | 2009-10-07 10:43:57 +1100 | [diff] [blame] | 1 | # $OpenBSD: sftp.sh,v 1.3 2009/08/13 01:11:55 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" |
| 5 | |
Darren Tucker | f241254 | 2003-09-04 14:56:49 +1000 | [diff] [blame] | 6 | DATA=/bin/ls${EXEEXT} |
Damien Miller | 38cd435 | 2002-05-01 13:17:33 +1000 | [diff] [blame] | 7 | COPY=${OBJ}/copy |
| 8 | |
Darren Tucker | e15b0dd | 2003-09-04 15:00:55 +1000 | [diff] [blame] | 9 | SFTPCMDFILE=${OBJ}/batch |
| 10 | cat >$SFTPCMDFILE <<EOF |
| 11 | version |
| 12 | get $DATA ${COPY}.1 |
| 13 | put $DATA ${COPY}.2 |
| 14 | EOF |
| 15 | |
Damien Miller | 38cd435 | 2002-05-01 13:17:33 +1000 | [diff] [blame] | 16 | BUFFERSIZE="5 1000 32000 64000" |
| 17 | REQUESTS="1 2 10" |
| 18 | |
| 19 | for B in ${BUFFERSIZE}; do |
| 20 | for R in ${REQUESTS}; do |
| 21 | verbose "test $tid: buffer_size $B num_requests $R" |
Darren Tucker | ed6b0c5 | 2009-10-07 10:43:57 +1100 | [diff] [blame] | 22 | rm -f ${COPY}.1 ${COPY}.2 |
| 23 | ${SFTP} -D ${SFTPSERVER} -B $B -R $R -b $SFTPCMDFILE \ |
Darren Tucker | e15b0dd | 2003-09-04 15:00:55 +1000 | [diff] [blame] | 24 | > /dev/null 2>&1 |
Damien Miller | 38cd435 | 2002-05-01 13:17:33 +1000 | [diff] [blame] | 25 | r=$? |
| 26 | if [ $r -ne 0 ]; then |
| 27 | fail "sftp failed with $r" |
Darren Tucker | e15b0dd | 2003-09-04 15:00:55 +1000 | [diff] [blame] | 28 | else |
| 29 | cmp $DATA ${COPY}.1 || fail "corrupted copy after get" |
| 30 | cmp $DATA ${COPY}.2 || fail "corrupted copy after put" |
Damien Miller | 38cd435 | 2002-05-01 13:17:33 +1000 | [diff] [blame] | 31 | fi |
Damien Miller | 38cd435 | 2002-05-01 13:17:33 +1000 | [diff] [blame] | 32 | done |
| 33 | done |
Darren Tucker | e15b0dd | 2003-09-04 15:00:55 +1000 | [diff] [blame] | 34 | rm -f ${COPY}.1 ${COPY}.2 |
| 35 | rm -f $SFTPCMDFILE |