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