diff options
Diffstat (limited to 'regress/sftp-cmds.sh')
-rw-r--r-- | regress/sftp-cmds.sh | 62 |
1 files changed, 59 insertions, 3 deletions
diff --git a/regress/sftp-cmds.sh b/regress/sftp-cmds.sh index 987887ff0..b86712f47 100644 --- a/regress/sftp-cmds.sh +++ b/regress/sftp-cmds.sh | |||
@@ -1,8 +1,7 @@ | |||
1 | # $OpenBSD: sftp-cmds.sh,v 1.3 2003/04/04 09:34:22 djm Exp $ | 1 | # $OpenBSD: sftp-cmds.sh,v 1.4 2003/05/15 04:07:12 mouring Exp $ |
2 | # Placed in the Public Domain. | 2 | # Placed in the Public Domain. |
3 | 3 | ||
4 | # XXX - TODO: | 4 | # XXX - TODO: |
5 | # - globbed operations | ||
6 | # - chmod / chown / chgrp | 5 | # - chmod / chown / chgrp |
7 | # - -p flag for get & put | 6 | # - -p flag for get & put |
8 | 7 | ||
@@ -10,8 +9,10 @@ tid="sftp commands" | |||
10 | 9 | ||
11 | DATA=/bin/ls | 10 | DATA=/bin/ls |
12 | COPY=${OBJ}/copy | 11 | COPY=${OBJ}/copy |
12 | GLOBFILES=`(cd /bin;echo l*)` | ||
13 | 13 | ||
14 | rm -rf ${COPY} ${COPY}.1 ${COPY}.2 ${COPY}.dd ${COPY}.dd2 ${BATCH}.* | 14 | rm -rf ${COPY} ${COPY}.1 ${COPY}.2 ${COPY}.dd ${COPY}.dd2 ${BATCH}.* |
15 | mkdir ${COPY}.dd | ||
15 | 16 | ||
16 | verbose "$tid: lls" | 17 | verbose "$tid: lls" |
17 | echo "lls ${OBJ}" | ${SFTP} -P ${SFTPSERVER} >/dev/null 2>&1 \ | 18 | echo "lls ${OBJ}" | ${SFTP} -P ${SFTPSERVER} >/dev/null 2>&1 \ |
@@ -54,19 +55,74 @@ echo "get $DATA $COPY" | ${SFTP} -P ${SFTPSERVER} >/dev/null 2>&1 \ | |||
54 | || fail "get failed" | 55 | || fail "get failed" |
55 | cmp $DATA ${COPY} || fail "corrupted copy after get" | 56 | cmp $DATA ${COPY} || fail "corrupted copy after get" |
56 | 57 | ||
58 | rm -f ${COPY}.dd/* | ||
59 | verbose "$tid: get to directory" | ||
60 | echo "get $DATA ${COPY}.dd" | ${SFTP} -P ${SFTPSERVER} >/dev/null 2>&1 \ | ||
61 | || fail "get failed" | ||
62 | cmp $DATA ${COPY}.dd/ls || fail "corrupted copy after get" | ||
63 | |||
64 | rm -f ${COPY}.dd/* | ||
65 | verbose "$tid: glob get to directory" | ||
66 | echo "get /bin/l* ${COPY}.dd" | ${SFTP} -P ${SFTPSERVER} >/dev/null 2>&1 \ | ||
67 | || fail "get failed" | ||
68 | for x in $GLOBFILES; do | ||
69 | cmp /bin/$x ${COPY}.dd/$x || fail "corrupted copy after get" | ||
70 | done | ||
71 | |||
72 | rm -f ${COPY}.dd/* | ||
73 | verbose "$tid: get to local dir" | ||
74 | echo "lcd ${COPY}.dd\nget $DATA" | ${SFTP} -P ${SFTPSERVER} >/dev/null 2>&1 \ | ||
75 | || fail "get failed" | ||
76 | cmp $DATA ${COPY}.dd/ls || fail "corrupted copy after get" | ||
77 | |||
78 | rm -f ${COPY}.dd/* | ||
79 | verbose "$tid: glob get to local dir" | ||
80 | echo "lcd ${COPY}.dd\nget /bin/l*" | ${SFTP} -P ${SFTPSERVER} >/dev/null 2>&1 \ | ||
81 | || fail "get failed" | ||
82 | for x in $GLOBFILES; do | ||
83 | cmp /bin/$x ${COPY}.dd/$x || fail "corrupted copy after get" | ||
84 | done | ||
85 | |||
57 | rm -f ${COPY} | 86 | rm -f ${COPY} |
58 | verbose "$tid: put" | 87 | verbose "$tid: put" |
59 | echo "put $DATA $COPY" | ${SFTP} -P ${SFTPSERVER} >/dev/null 2>&1 \ | 88 | echo "put $DATA $COPY" | ${SFTP} -P ${SFTPSERVER} >/dev/null 2>&1 \ |
60 | || fail "put failed" | 89 | || fail "put failed" |
61 | cmp $DATA ${COPY} || fail "corrupted copy after put" | 90 | cmp $DATA ${COPY} || fail "corrupted copy after put" |
62 | 91 | ||
92 | rm -f ${COPY}.dd/* | ||
93 | verbose "$tid: put to directory" | ||
94 | echo "put $DATA ${COPY}.dd" | ${SFTP} -P ${SFTPSERVER} >/dev/null 2>&1 \ | ||
95 | || fail "put failed" | ||
96 | cmp $DATA ${COPY}.dd/ls || fail "corrupted copy after put" | ||
97 | |||
98 | rm -f ${COPY}.dd/* | ||
99 | verbose "$tid: glob put to directory" | ||
100 | echo "put /bin/l* ${COPY}.dd" | ${SFTP} -P ${SFTPSERVER} >/dev/null 2>&1 \ | ||
101 | || fail "put failed" | ||
102 | for x in $GLOBFILES; do | ||
103 | cmp /bin/$x ${COPY}.dd/$x || fail "corrupted copy after put" | ||
104 | done | ||
105 | |||
106 | rm -f ${COPY}.dd/* | ||
107 | verbose "$tid: put to local dir" | ||
108 | echo "cd ${COPY}.dd\nput $DATA" | ${SFTP} -P ${SFTPSERVER} >/dev/null 2>&1 \ | ||
109 | || fail "put failed" | ||
110 | cmp $DATA ${COPY}.dd/ls || fail "corrupted copy after put" | ||
111 | |||
112 | rm -f ${COPY}.dd/* | ||
113 | verbose "$tid: glob put to local dir" | ||
114 | echo "cd ${COPY}.dd\nput /bin/l*" | ${SFTP} -P ${SFTPSERVER} >/dev/null 2>&1 \ | ||
115 | || fail "put failed" | ||
116 | for x in $GLOBFILES; do | ||
117 | cmp /bin/$x ${COPY}.dd/$x || fail "corrupted copy after put" | ||
118 | done | ||
119 | |||
63 | verbose "$tid: rename" | 120 | verbose "$tid: rename" |
64 | echo "rename $COPY ${COPY}.1" | ${SFTP} -P ${SFTPSERVER} >/dev/null 2>&1 \ | 121 | echo "rename $COPY ${COPY}.1" | ${SFTP} -P ${SFTPSERVER} >/dev/null 2>&1 \ |
65 | || fail "rename failed" | 122 | || fail "rename failed" |
66 | test -f ${COPY}.1 || fail "missing file after rename" | 123 | test -f ${COPY}.1 || fail "missing file after rename" |
67 | cmp $DATA ${COPY}.1 >/dev/null 2>&1 || fail "corrupted copy after rename" | 124 | cmp $DATA ${COPY}.1 >/dev/null 2>&1 || fail "corrupted copy after rename" |
68 | 125 | ||
69 | mkdir ${COPY}.dd | ||
70 | verbose "$tid: rename directory" | 126 | verbose "$tid: rename directory" |
71 | echo "rename ${COPY}.dd ${COPY}.dd2" | ${SFTP} -P ${SFTPSERVER} >/dev/null 2>&1 \ | 127 | echo "rename ${COPY}.dd ${COPY}.dd2" | ${SFTP} -P ${SFTPSERVER} >/dev/null 2>&1 \ |
72 | || fail "rename directory failed" | 128 | || fail "rename directory failed" |