sftp.sh 738 B

123456789101112131415161718192021222324252627282930313233
  1. # $OpenBSD: sftp.sh,v 1.6 2017/10/30 21:59:43 djm Exp $
  2. # Placed in the Public Domain.
  3. tid="basic sftp put/get"
  4. SFTPCMDFILE=${OBJ}/batch
  5. cat > $SFTPCMDFILE << EOF
  6. version
  7. get $DATA ${COPY}.1
  8. put $DATA ${COPY}.2
  9. EOF
  10. BUFFERSIZE="5 1000 32000 64000"
  11. REQUESTS="1 2 10"
  12. for B in ${BUFFERSIZE}; do
  13. for R in ${REQUESTS}; do
  14. verbose "test $tid: buffer_size $B num_requests $R"
  15. rm -f ${COPY}.1 ${COPY}.2
  16. ${SFTP} -D ${SFTPSERVER} -B $B -R $R -b $SFTPCMDFILE \
  17. > /dev/null 2>&1
  18. r=$?
  19. if [ $r -ne 0 ]; then
  20. fail "sftp failed with $r"
  21. else
  22. cmp $DATA ${COPY}.1 || fail "corrupted copy after get"
  23. cmp $DATA ${COPY}.2 || fail "corrupted copy after put"
  24. fi
  25. done
  26. done
  27. rm -f ${COPY}.1 ${COPY}.2
  28. rm -f $SFTPCMDFILE