[openssh-commits] [openssh] 02/02: upstream: regression test for scp -3

git+noreply at mindrot.org git+noreply at mindrot.org
Fri Aug 6 16:57:52 AEST 2021


This is an automated email from the git hooks/post-receive script.

dtucker pushed a commit to branch master
in repository openssh.

commit d247a73ce27b460138599648d9c637c6f2b77605
Author: djm at openbsd.org <djm at openbsd.org>
Date:   Wed Aug 4 21:28:00 2021 +0000

    upstream: regression test for scp -3
    
    OpenBSD-Regress-ID: b44375d125c827754a1f722ec6b6b75b634de05d
---
 regress/Makefile |  3 ++-
 regress/scp3.sh  | 58 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 60 insertions(+), 1 deletion(-)

diff --git a/regress/Makefile b/regress/Makefile
index faf26ee2..810d74ce 100644
--- a/regress/Makefile
+++ b/regress/Makefile
@@ -1,4 +1,4 @@
-#	$OpenBSD: Makefile,v 1.115 2021/07/25 12:27:37 dtucker Exp $
+#	$OpenBSD: Makefile,v 1.116 2021/08/04 21:28:00 djm Exp $
 
 tests:		prep file-tests t-exec unit
 
@@ -52,6 +52,7 @@ LTESTS= 	connect \
 		keygen-sshfp \
 		key-options \
 		scp \
+		scp3 \
 		scp-uri \
 		sftp \
 		sftp-chroot \
diff --git a/regress/scp3.sh b/regress/scp3.sh
new file mode 100644
index 00000000..e5493ee8
--- /dev/null
+++ b/regress/scp3.sh
@@ -0,0 +1,58 @@
+#	$OpenBSD: scp3.sh,v 1.1 2021/08/04 21:28:00 djm Exp $
+#	Placed in the Public Domain.
+
+tid="scp3"
+
+#set -x
+
+COPY2=${OBJ}/copy2
+DIR=${COPY}.dd
+DIR2=${COPY}.dd2
+
+SRC=`dirname ${SCRIPT}`
+cp ${SRC}/scp-ssh-wrapper.sh ${OBJ}/scp-ssh-wrapper.scp
+chmod 755 ${OBJ}/scp-ssh-wrapper.scp
+export SCP # used in scp-ssh-wrapper.scp
+
+scpclean() {
+	rm -rf ${COPY} ${COPY2} ${DIR} ${DIR2}
+	mkdir ${DIR} ${DIR2}
+	chmod 755 ${DIR} ${DIR2}
+}
+
+# XXX sftp too once it's ready
+for mode in scp ; do
+	scpopts="-F${OBJ}/ssh_proxy -S ${SSH} -q"
+	tag="$tid: $mode mode"
+#	if test $mode = scp ; then
+#		scpopts="$scpopts -O"
+#	fi
+
+	verbose "$tag: simple copy remote file to remote file"
+	scpclean
+	$SCP $scpopts -3 hostA:${DATA} hostB:${COPY} || fail "copy failed"
+	cmp ${DATA} ${COPY} || fail "corrupted copy"
+
+	verbose "$tag: simple copy remote file to remote dir"
+	scpclean
+	cp ${DATA} ${COPY}
+	$SCP $scpopts -3 hostA:${COPY} hostB:${DIR} || fail "copy failed"
+	cmp ${COPY} ${DIR}/copy || fail "corrupted copy"
+
+	verbose "$tag: recursive remote dir to remote dir"
+	scpclean
+	rm -rf ${DIR2}
+	cp ${DATA} ${DIR}/copy
+	$SCP $scpopts -3r hostA:${DIR} hostB:${DIR2} || fail "copy failed"
+	diff -rN ${DIR} ${DIR2} || fail "corrupted copy"
+
+	verbose "$tag: detect non-directory target"
+	scpclean
+	echo a > ${COPY}
+	echo b > ${COPY2}
+	$SCP $scpopts -3 hostA:${DATA} hostA:${COPY} hostB:${COPY2}
+	cmp ${COPY} ${COPY2} >/dev/null && fail "corrupt target"
+done
+
+scpclean
+rm -f ${OBJ}/scp-ssh-wrapper.exe

-- 
To stop receiving notification emails like this one, please contact
djm at mindrot.org.


More information about the openssh-commits mailing list