summaryrefslogtreecommitdiff
path: root/regress/scp.sh
diff options
context:
space:
mode:
authorDarren Tucker <dtucker@zip.com.au>2004-06-16 20:15:59 +1000
committerDarren Tucker <dtucker@zip.com.au>2004-06-16 20:15:59 +1000
commit50433a924344b295cd34ecdbba0c6b8f6add9231 (patch)
tree938e63b00cf4ae56b1579cc085c2a56661b1c980 /regress/scp.sh
parent4c37ef08abc56fe883e75333f04cf2a7382fce07 (diff)
- 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@
Diffstat (limited to 'regress/scp.sh')
-rw-r--r--regress/scp.sh73
1 files changed, 73 insertions, 0 deletions
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 @@
1# $OpenBSD: scp.sh,v 1.1 2004/06/13 13:51:02 dtucker Exp $
2# Placed in the Public Domain.
3
4tid="scp"
5
6#set -x
7
8DATA=/bin/ls
9COPY=${OBJ}/copy
10COPY2=${OBJ}/copy2
11DIR=${COPY}.dd
12DIR2=${COPY}.dd2
13
14SRC=`dirname ${SCRIPT}`
15cp ${SRC}/scp-ssh-wrapper.sh ${OBJ}/scp-ssh-wrapper.exe
16chmod 755 ${OBJ}/scp-ssh-wrapper.exe
17scpopts="-q -S ${OBJ}/scp-ssh-wrapper.exe"
18
19scpclean() {
20 rm -rf ${COPY} ${COPY2} ${DIR} ${DIR2}
21 mkdir ${DIR} ${DIR2}
22}
23
24verbose "$tid: simple copy local file to remote file"
25scpclean
26$SCP $scpopts ${DATA} somehost:${COPY} || fail "copy failed"
27cmp ${DATA} ${COPY} || fail "corrupted copy"
28
29verbose "$tid: simple copy remote file to local file"
30scpclean
31$SCP $scpopts somehost:${DATA} ${COPY} || fail "copy failed"
32cmp ${DATA} ${COPY} || fail "corrupted copy"
33
34verbose "$tid: simple copy local file to remote dir"
35scpclean
36cp ${DATA} ${COPY}
37$SCP $scpopts ${COPY} somehost:${DIR} || fail "copy failed"
38cmp ${COPY} ${DIR}/copy || fail "corrupted copy"
39
40verbose "$tid: simple copy remote file to local dir"
41scpclean
42cp ${DATA} ${COPY}
43$SCP $scpopts somehost:${COPY} ${DIR} || fail "copy failed"
44cmp ${COPY} ${DIR}/copy || fail "corrupted copy"
45
46verbose "$tid: recursive local dir to remote dir"
47scpclean
48cp ${DATA} ${DIR}/copy
49$SCP $scpopts -r ${DIR} somehost:${DIR2} || fail "copy failed"
50cmp ${DIR} ${DIR2} || fail "corrupted copy"
51
52verbose "$tid: recursive remote dir to local dir"
53scpclean
54cp ${DATA} ${DIR}/copy
55$SCP $scpopts -r somehost:${DIR} ${DIR2} || fail "copy failed"
56cmp ${DIR} ${DIR2} || fail "corrupted copy"
57
58for i in 0 1 2 3 4; do
59 verbose "$tid: disallow bad server #$i"
60 SCPTESTMODE=badserver_$i
61 export DIR SCPTESTMODE
62 scpclean
63 $SCP $scpopts somehost:${DATA} ${DIR} >/dev/null 2>/dev/null
64 [ -d {$DIR}/rootpathdir ] && fail "allows dir relative to root dir"
65 [ -d ${DIR}/dotpathdir ] && fail "allows dir creation in non-recursive mode"
66
67 scpclean
68 $SCP -r $scpopts somehost:${DATA} ${DIR2} >/dev/null 2>/dev/null
69 [ -d ${DIR}/dotpathdir ] && fail "allows dir creation outside of subdir"
70done
71
72scpclean
73rm -f ${OBJ}/scp-ssh-wrapper.exe