Home | History | Annotate | Download | only in regress
      1 #	$OpenBSD: ssh-com-sftp.sh,v 1.6 2009/08/20 18:43:07 djm Exp $
      2 #	Placed in the Public Domain.
      3 
      4 tid="basic sftp put/get with ssh.com server"
      5 
      6 DATA=/bin/ls${EXEEXT}
      7 COPY=${OBJ}/copy
      8 SFTPCMDFILE=${OBJ}/batch
      9 
     10 cat >$SFTPCMDFILE <<EOF
     11 version
     12 get $DATA ${COPY}.1
     13 put $DATA ${COPY}.2
     14 EOF
     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
     34 	3.1.0
     35 	3.2.0
     36 	3.2.2
     37 	3.2.3
     38 	3.2.5
     39 	3.2.9
     40 	3.2.9.1
     41 	3.3.0"
     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
     54 			${SFTP} -D ${server} -B $B -R $R -b $SFTPCMDFILE \
     55 			> /dev/null 2>&1
     56 			r=$?
     57 			if [ $r -ne 0 ]; then
     58 				fail "sftp failed with $r"
     59 			else                                
     60 				cmp $DATA ${COPY}.1 || fail "corrupted copy after get"
     61 				cmp $DATA ${COPY}.2 || fail "corrupted copy after put"
     62 			fi
     63 		done
     64 	done
     65 done
     66 rm -f ${COPY}.1 ${COPY}.2                
     67 rm -f $SFTPCMDFILE
     68