summaryrefslogtreecommitdiff
path: root/regress/scp-uri.sh
diff options
context:
space:
mode:
authormillert@openbsd.org@openbsd.org <millert@openbsd.org@openbsd.org>2017-10-24 19:33:32 +0000
committerDamien Miller <djm@mindrot.org>2017-10-31 09:08:51 +1100
commit116b1b439413a724ebb3320633a64dd0f3ee1fe7 (patch)
tree55da5d72989b0d26d1296f1689016664ae60f4d5 /regress/scp-uri.sh
parentdbe0662e9cd482593a4a8bf58c6481bfe8a747a4 (diff)
upstream commit
Add tests for URI parsing. OK markus@ OpenBSD-Regress-ID: 5d1df19874f3b916d1a2256a905526e17a98bd3b
Diffstat (limited to 'regress/scp-uri.sh')
-rw-r--r--regress/scp-uri.sh66
1 files changed, 66 insertions, 0 deletions
diff --git a/regress/scp-uri.sh b/regress/scp-uri.sh
new file mode 100644
index 000000000..bf21bf32e
--- /dev/null
+++ b/regress/scp-uri.sh
@@ -0,0 +1,66 @@
1# $OpenBSD: scp-uri.sh,v 1.1 2017/10/24 19:33:32 millert Exp $
2# Placed in the Public Domain.
3
4tid="scp-uri"
5
6#set -x
7
8COPY2=${OBJ}/copy2
9DIR=${COPY}.dd
10DIR2=${COPY}.dd2
11
12SRC=`dirname ${SCRIPT}`
13cp ${SRC}/scp-ssh-wrapper.sh ${OBJ}/scp-ssh-wrapper.scp
14chmod 755 ${OBJ}/scp-ssh-wrapper.scp
15scpopts="-q -S ${OBJ}/scp-ssh-wrapper.scp"
16export SCP # used in scp-ssh-wrapper.scp
17
18scpclean() {
19 rm -rf ${COPY} ${COPY2} ${DIR} ${DIR2}
20 mkdir ${DIR} ${DIR2}
21}
22
23# Remove Port and User from ssh_config, we want to rely on the URI
24cp $OBJ/ssh_config $OBJ/ssh_config.orig
25egrep -v '^ +(Port|User) +.*$' $OBJ/ssh_config.orig > $OBJ/ssh_config
26
27verbose "$tid: simple copy local file to remote file"
28scpclean
29$SCP $scpopts ${DATA} "scp://${USER}@somehost:${PORT}/${COPY}" || fail "copy failed"
30cmp ${DATA} ${COPY} || fail "corrupted copy"
31
32verbose "$tid: simple copy remote file to local file"
33scpclean
34$SCP $scpopts "scp://${USER}@somehost:${PORT}/${DATA}" ${COPY} || fail "copy failed"
35cmp ${DATA} ${COPY} || fail "corrupted copy"
36
37verbose "$tid: simple copy local file to remote dir"
38scpclean
39cp ${DATA} ${COPY}
40$SCP $scpopts ${COPY} "scp://${USER}@somehost:${PORT}/${DIR}" || fail "copy failed"
41cmp ${COPY} ${DIR}/copy || fail "corrupted copy"
42
43verbose "$tid: simple copy remote file to local dir"
44scpclean
45cp ${DATA} ${COPY}
46$SCP $scpopts "scp://${USER}@somehost:${PORT}/${COPY}" ${DIR} || fail "copy failed"
47cmp ${COPY} ${DIR}/copy || fail "corrupted copy"
48
49verbose "$tid: recursive local dir to remote dir"
50scpclean
51rm -rf ${DIR2}
52cp ${DATA} ${DIR}/copy
53$SCP $scpopts -r ${DIR} "scp://${USER}@somehost:${PORT}/${DIR2}" || fail "copy failed"
54diff -rN ${DIR} ${DIR2} || fail "corrupted copy"
55
56verbose "$tid: recursive remote dir to local dir"
57scpclean
58rm -rf ${DIR2}
59cp ${DATA} ${DIR}/copy
60$SCP $scpopts -r "scp://${USER}@somehost:${PORT}/${DIR}" ${DIR2} || fail "copy failed"
61diff -rN ${DIR} ${DIR2} || fail "corrupted copy"
62
63# TODO: scp -3
64
65scpclean
66rm -f ${OBJ}/scp-ssh-wrapper.exe