upstream: regress test for in-place transfers and clobbering larger

files with smaller ones; would have caught last regression in scp(1)

OpenBSD-Regress-ID: 19de4e88dd3a4f7e5c1618c9be3c32415bd93bc2
This commit is contained in:
djm@openbsd.org 2022-05-15 23:48:07 +00:00 committed by Damien Miller
parent b4f0d719c2
commit bedb93415b
1 changed files with 26 additions and 1 deletions

View File

@ -1,4 +1,4 @@
# $OpenBSD: scp.sh,v 1.13 2021/08/10 03:35:45 djm Exp $ # $OpenBSD: scp.sh,v 1.14 2022/05/15 23:48:07 djm Exp $
# Placed in the Public Domain. # Placed in the Public Domain.
tid="scp" tid="scp"
@ -49,6 +49,31 @@ for mode in scp sftp ; do
$SCP $scpopts somehost:${DATA} ${COPY} || fail "copy failed" $SCP $scpopts somehost:${DATA} ${COPY} || fail "copy failed"
cmp ${DATA} ${COPY} || fail "corrupted copy" cmp ${DATA} ${COPY} || fail "corrupted copy"
verbose "$tag: copy local file to remote file in place"
scpclean
cp ${DATA} ${COPY}
$SCP $scpopts ${COPY} somehost:${COPY} || fail "copy failed"
cmp ${DATA} ${COPY} || fail "corrupted copy"
verbose "$tag: copy remote file to local file in place"
scpclean
cp ${DATA} ${COPY}
$SCP $scpopts somehost:${COPY} ${COPY} || fail "copy failed"
cmp ${DATA} ${COPY} || fail "corrupted copy"
verbose "$tag: copy local file to remote file clobber"
scpclean
cat ${DATA} ${DATA} > ${COPY}
$SCP $scpopts ${DATA} somehost:${COPY} || fail "copy failed"
ls -l $DATA $COPY
cmp ${DATA} ${COPY} || fail "corrupted copy"
verbose "$tag: copy remote file to local file clobber"
scpclean
cat ${DATA} ${DATA} > ${COPY}
$SCP $scpopts somehost:${DATA} ${COPY} || fail "copy failed"
cmp ${DATA} ${COPY} || fail "corrupted copy"
verbose "$tag: simple copy local file to remote dir" verbose "$tag: simple copy local file to remote dir"
scpclean scpclean
cp ${DATA} ${COPY} cp ${DATA} ${COPY}