diff options
Diffstat (limited to 'regress/sftp-cmds.sh')
-rw-r--r-- | regress/sftp-cmds.sh | 100 |
1 files changed, 100 insertions, 0 deletions
diff --git a/regress/sftp-cmds.sh b/regress/sftp-cmds.sh new file mode 100644 index 000000000..462c6802f --- /dev/null +++ b/regress/sftp-cmds.sh | |||
@@ -0,0 +1,100 @@ | |||
1 | # $OpenBSD: sftp-cmds.sh,v 1.2 2003/01/10 07:52:41 djm Exp $ | ||
2 | # Placed in the Public Domain. | ||
3 | |||
4 | # XXX - TODO: | ||
5 | # - globbed operations | ||
6 | # - chmod / chown / chgrp | ||
7 | # - -p flag for get & put | ||
8 | |||
9 | tid="sftp commands" | ||
10 | |||
11 | DATA=/bin/ls | ||
12 | COPY=${OBJ}/copy | ||
13 | |||
14 | rm -rf ${COPY} ${COPY}.1 ${COPY}.2 ${COPY}.dd ${BATCH}.* | ||
15 | |||
16 | verbose "$tid: lls" | ||
17 | echo "lls ${OBJ}" | ${SFTP} -P ${SFTPSERVER} >/dev/null 2>&1 \ | ||
18 | || fail "lls failed" | ||
19 | # XXX always successful | ||
20 | |||
21 | verbose "$tid: ls" | ||
22 | echo "ls ${OBJ}" | ${SFTP} -P ${SFTPSERVER} >/dev/null 2>&1 \ | ||
23 | || fail "ls failed" | ||
24 | # XXX always successful | ||
25 | |||
26 | verbose "$tid: shell" | ||
27 | echo "!echo hi there" | ${SFTP} -P ${SFTPSERVER} >/dev/null 2>&1 \ | ||
28 | || fail "shell failed" | ||
29 | # XXX always successful | ||
30 | |||
31 | verbose "$tid: pwd" | ||
32 | echo "pwd" | ${SFTP} -P ${SFTPSERVER} >/dev/null 2>&1 \ | ||
33 | || fail "pwd failed" | ||
34 | # XXX always successful | ||
35 | |||
36 | verbose "$tid: lpwd" | ||
37 | echo "lpwd" | ${SFTP} -P ${SFTPSERVER} >/dev/null 2>&1 \ | ||
38 | || fail "lpwd failed" | ||
39 | # XXX always successful | ||
40 | |||
41 | verbose "$tid: quit" | ||
42 | echo "quit" | ${SFTP} -P ${SFTPSERVER} >/dev/null 2>&1 \ | ||
43 | || fail "quit failed" | ||
44 | # XXX always successful | ||
45 | |||
46 | verbose "$tid: help" | ||
47 | echo "help" | ${SFTP} -P ${SFTPSERVER} >/dev/null 2>&1 \ | ||
48 | || fail "help failed" | ||
49 | # XXX always successful | ||
50 | |||
51 | rm -f ${COPY} | ||
52 | verbose "$tid: get" | ||
53 | echo "get $DATA $COPY" | ${SFTP} -P ${SFTPSERVER} >/dev/null 2>&1 \ | ||
54 | || fail "get failed" | ||
55 | cmp $DATA ${COPY} || fail "corrupted copy after get" | ||
56 | |||
57 | rm -f ${COPY} | ||
58 | verbose "$tid: put" | ||
59 | echo "put $DATA $COPY" | ${SFTP} -P ${SFTPSERVER} >/dev/null 2>&1 \ | ||
60 | || fail "put failed" | ||
61 | cmp $DATA ${COPY} || fail "corrupted copy after put" | ||
62 | |||
63 | verbose "$tid: rename" | ||
64 | echo "rename $COPY ${COPY}.1" | ${SFTP} -P ${SFTPSERVER} >/dev/null 2>&1 \ | ||
65 | || fail "rename failed" | ||
66 | test -f ${COPY}.1 || fail "missing file after rename" | ||
67 | cmp $DATA ${COPY}.1 >/dev/null 2>&1 || fail "corrupted copy after rename" | ||
68 | |||
69 | verbose "$tid: ln" | ||
70 | echo "ln ${COPY}.1 ${COPY}.2" | ${SFTP} -P ${SFTPSERVER} >/dev/null 2>&1 || fail "ln failed" | ||
71 | test -L ${COPY}.2 || fail "missing file after ln" | ||
72 | |||
73 | verbose "$tid: mkdir" | ||
74 | echo "mkdir ${COPY}.dd" | ${SFTP} -P ${SFTPSERVER} >/dev/null 2>&1 \ | ||
75 | || fail "mkdir failed" | ||
76 | test -d ${COPY}.dd || fail "missing directory after mkdir" | ||
77 | |||
78 | # XXX do more here | ||
79 | verbose "$tid: chdir" | ||
80 | echo "chdir ${COPY}.dd" | ${SFTP} -P ${SFTPSERVER} >/dev/null 2>&1 \ | ||
81 | || fail "chdir failed" | ||
82 | |||
83 | verbose "$tid: rmdir" | ||
84 | echo "rmdir ${COPY}.dd" | ${SFTP} -P ${SFTPSERVER} >/dev/null 2>&1 \ | ||
85 | || fail "rmdir failed" | ||
86 | test -d ${COPY}.1 && fail "present directory after rmdir" | ||
87 | |||
88 | verbose "$tid: lmkdir" | ||
89 | echo "lmkdir ${COPY}.dd" | ${SFTP} -P ${SFTPSERVER} >/dev/null 2>&1 \ | ||
90 | || fail "lmkdir failed" | ||
91 | test -d ${COPY}.dd || fail "missing directory after lmkdir" | ||
92 | |||
93 | # XXX do more here | ||
94 | verbose "$tid: lchdir" | ||
95 | echo "lchdir ${COPY}.dd" | ${SFTP} -P ${SFTPSERVER} >/dev/null 2>&1 \ | ||
96 | || fail "lchdir failed" | ||
97 | |||
98 | rm -rf ${COPY} ${COPY}.1 ${COPY}.2 ${COPY}.dd ${BATCH}.* | ||
99 | |||
100 | |||