From 50433a924344b295cd34ecdbba0c6b8f6add9231 Mon Sep 17 00:00:00 2001 From: Darren Tucker Date: Wed, 16 Jun 2004 20:15:59 +1000 Subject: - dtucker@cvs.openbsd.org 2004/06/13 13:51:02 [regress/Makefile regress/test-exec.sh, added regress/scp-ssh-wrapper.sh regress/scp.sh] Add scp regression test; with & ok markus@ --- regress/scp.sh | 73 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 73 insertions(+) create mode 100644 regress/scp.sh (limited to 'regress/scp.sh') diff --git a/regress/scp.sh b/regress/scp.sh new file mode 100644 index 000000000..2d722c70c --- /dev/null +++ b/regress/scp.sh @@ -0,0 +1,73 @@ +# $OpenBSD: scp.sh,v 1.1 2004/06/13 13:51:02 dtucker Exp $ +# Placed in the Public Domain. + +tid="scp" + +#set -x + +DATA=/bin/ls +COPY=${OBJ}/copy +COPY2=${OBJ}/copy2 +DIR=${COPY}.dd +DIR2=${COPY}.dd2 + +SRC=`dirname ${SCRIPT}` +cp ${SRC}/scp-ssh-wrapper.sh ${OBJ}/scp-ssh-wrapper.exe +chmod 755 ${OBJ}/scp-ssh-wrapper.exe +scpopts="-q -S ${OBJ}/scp-ssh-wrapper.exe" + +scpclean() { + rm -rf ${COPY} ${COPY2} ${DIR} ${DIR2} + mkdir ${DIR} ${DIR2} +} + +verbose "$tid: simple copy local file to remote file" +scpclean +$SCP $scpopts ${DATA} somehost:${COPY} || fail "copy failed" +cmp ${DATA} ${COPY} || fail "corrupted copy" + +verbose "$tid: simple copy remote file to local file" +scpclean +$SCP $scpopts somehost:${DATA} ${COPY} || fail "copy failed" +cmp ${DATA} ${COPY} || fail "corrupted copy" + +verbose "$tid: simple copy local file to remote dir" +scpclean +cp ${DATA} ${COPY} +$SCP $scpopts ${COPY} somehost:${DIR} || fail "copy failed" +cmp ${COPY} ${DIR}/copy || fail "corrupted copy" + +verbose "$tid: simple copy remote file to local dir" +scpclean +cp ${DATA} ${COPY} +$SCP $scpopts somehost:${COPY} ${DIR} || fail "copy failed" +cmp ${COPY} ${DIR}/copy || fail "corrupted copy" + +verbose "$tid: recursive local dir to remote dir" +scpclean +cp ${DATA} ${DIR}/copy +$SCP $scpopts -r ${DIR} somehost:${DIR2} || fail "copy failed" +cmp ${DIR} ${DIR2} || fail "corrupted copy" + +verbose "$tid: recursive remote dir to local dir" +scpclean +cp ${DATA} ${DIR}/copy +$SCP $scpopts -r somehost:${DIR} ${DIR2} || fail "copy failed" +cmp ${DIR} ${DIR2} || fail "corrupted copy" + +for i in 0 1 2 3 4; do + verbose "$tid: disallow bad server #$i" + SCPTESTMODE=badserver_$i + export DIR SCPTESTMODE + scpclean + $SCP $scpopts somehost:${DATA} ${DIR} >/dev/null 2>/dev/null + [ -d {$DIR}/rootpathdir ] && fail "allows dir relative to root dir" + [ -d ${DIR}/dotpathdir ] && fail "allows dir creation in non-recursive mode" + + scpclean + $SCP -r $scpopts somehost:${DATA} ${DIR2} >/dev/null 2>/dev/null + [ -d ${DIR}/dotpathdir ] && fail "allows dir creation outside of subdir" +done + +scpclean +rm -f ${OBJ}/scp-ssh-wrapper.exe -- cgit v1.2.3 From 6f0e35b5664b34423f64da2c8dfd876a61888d6d Mon Sep 17 00:00:00 2001 From: Darren Tucker Date: Wed, 16 Jun 2004 23:22:37 +1000 Subject: - dtucker@cvs.openbsd.org 2004/06/16 13:15:09 [regress/scp.sh] Make scp -r tests use diff -rN not cmp (which won't do dirs. ok markus@ --- ChangeLog | 5 ++++- regress/scp.sh | 8 +++++--- 2 files changed, 9 insertions(+), 4 deletions(-) (limited to 'regress/scp.sh') diff --git a/ChangeLog b/ChangeLog index 08054bba2..9630ed6da 100644 --- a/ChangeLog +++ b/ChangeLog @@ -16,6 +16,9 @@ - djm@cvs.openbsd.org 2004/06/13 15:16:54 [regress/test-exec.sh] remove duplicate setting of $SCP; spotted by markus@ + - dtucker@cvs.openbsd.org 2004/06/16 13:15:09 + [regress/scp.sh] + Make scp -r tests use diff -rN not cmp (which won't do dirs. ok markus@ - (dtucker) [regress/test-exec.sh] Move Portable-only StrictModes to top of list to make syncs easier. - (dtucker) [regress/README.regress] @@ -1245,4 +1248,4 @@ - (djm) Trim deprecated options from INSTALL. Mention UsePAM - (djm) Fix quote handling in sftp; Patch from admorten AT umich.edu -$Id: ChangeLog,v 1.3395 2004/06/16 11:08:32 dtucker Exp $ +$Id: ChangeLog,v 1.3396 2004/06/16 13:22:37 dtucker Exp $ diff --git a/regress/scp.sh b/regress/scp.sh index 2d722c70c..cda01868a 100644 --- a/regress/scp.sh +++ b/regress/scp.sh @@ -1,4 +1,4 @@ -# $OpenBSD: scp.sh,v 1.1 2004/06/13 13:51:02 dtucker Exp $ +# $OpenBSD: scp.sh,v 1.2 2004/06/16 13:15:09 dtucker Exp $ # Placed in the Public Domain. tid="scp" @@ -45,15 +45,17 @@ cmp ${COPY} ${DIR}/copy || fail "corrupted copy" verbose "$tid: recursive local dir to remote dir" scpclean +rm -rf ${DIR2} cp ${DATA} ${DIR}/copy $SCP $scpopts -r ${DIR} somehost:${DIR2} || fail "copy failed" -cmp ${DIR} ${DIR2} || fail "corrupted copy" +diff -rN ${DIR} ${DIR2} || fail "corrupted copy" verbose "$tid: recursive remote dir to local dir" scpclean +rm -rf ${DIR2} cp ${DATA} ${DIR}/copy $SCP $scpopts -r somehost:${DIR} ${DIR2} || fail "copy failed" -cmp ${DIR} ${DIR2} || fail "corrupted copy" +diff -rN ${DIR} ${DIR2} || fail "corrupted copy" for i in 0 1 2 3 4; do verbose "$tid: disallow bad server #$i" -- cgit v1.2.3 From 8a2f1b353760922bc7336f7c4030e192e13dc018 Mon Sep 17 00:00:00 2001 From: Darren Tucker Date: Thu, 17 Jun 2004 15:18:32 +1000 Subject: - (dtucker) [regress/scp.sh] diff -N is not portable (but needed for some platforms), so test if diff understands it. Pointed out by tim@, ok djm@ --- ChangeLog | 6 +++++- regress/scp.sh | 11 +++++++++-- 2 files changed, 14 insertions(+), 3 deletions(-) (limited to 'regress/scp.sh') diff --git a/ChangeLog b/ChangeLog index 90447f320..acb0e26dd 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +20040617 + - (dtucker) [regress/scp.sh] diff -N is not portable (but needed for some + platforms), so test if diff understands it. Pointed out by tim@, ok djm@ + 20040616 - (dtucker) [openbsd-compat/port-aix.c] Expand whitespace -> tabs. No code changes. @@ -1251,4 +1255,4 @@ - (djm) Trim deprecated options from INSTALL. Mention UsePAM - (djm) Fix quote handling in sftp; Patch from admorten AT umich.edu -$Id: ChangeLog,v 1.3398 2004/06/16 13:24:19 dtucker Exp $ +$Id: ChangeLog,v 1.3399 2004/06/17 05:18:32 dtucker Exp $ diff --git a/regress/scp.sh b/regress/scp.sh index cda01868a..703cc0893 100644 --- a/regress/scp.sh +++ b/regress/scp.sh @@ -5,6 +5,13 @@ tid="scp" #set -x +# Figure out if diff understands "-N" +if diff -N ${SRC}/scp.sh ${SRC}/scp.sh 2>/dev/null; then + DIFFOPT="-rN" +else + DIFFOPT="-r" +fi + DATA=/bin/ls COPY=${OBJ}/copy COPY2=${OBJ}/copy2 @@ -48,14 +55,14 @@ scpclean rm -rf ${DIR2} cp ${DATA} ${DIR}/copy $SCP $scpopts -r ${DIR} somehost:${DIR2} || fail "copy failed" -diff -rN ${DIR} ${DIR2} || fail "corrupted copy" +diff ${DIFFOPT} ${DIR} ${DIR2} || fail "corrupted copy" verbose "$tid: recursive remote dir to local dir" scpclean rm -rf ${DIR2} cp ${DATA} ${DIR}/copy $SCP $scpopts -r somehost:${DIR} ${DIR2} || fail "copy failed" -diff -rN ${DIR} ${DIR2} || fail "corrupted copy" +diff ${DIFFOPT} ${DIR} ${DIR2} || fail "corrupted copy" for i in 0 1 2 3 4; do verbose "$tid: disallow bad server #$i" -- cgit v1.2.3