summaryrefslogtreecommitdiff
path: root/regress/sftp-batch.sh
diff options
context:
space:
mode:
authorDamien Miller <djm@mindrot.org>2003-01-22 17:53:16 +1100
committerDamien Miller <djm@mindrot.org>2003-01-22 17:53:16 +1100
commit8b9cde784784949f9fdf0451f9da9030b76ca705 (patch)
tree9bf6279aa53922b3a251a5ca6d5f26c929a55251 /regress/sftp-batch.sh
parente9b7d720c8de6c293a3632c1fbf02cfa9c542923 (diff)
- (djm) Sync regress with OpenBSD -current
Diffstat (limited to 'regress/sftp-batch.sh')
-rw-r--r--regress/sftp-batch.sh57
1 files changed, 57 insertions, 0 deletions
diff --git a/regress/sftp-batch.sh b/regress/sftp-batch.sh
new file mode 100644
index 000000000..cffacb6df
--- /dev/null
+++ b/regress/sftp-batch.sh
@@ -0,0 +1,57 @@
1# $OpenBSD: sftp-batch.sh,v 1.2 2003/01/10 07:52:41 djm Exp $
2# Placed in the Public Domain.
3
4tid="sftp batchfile"
5
6DATA=/bin/ls
7COPY=${OBJ}/copy
8BATCH=${OBJ}/sftp-batch
9
10rm -rf ${COPY} ${COPY}.1 ${COPY}.2 ${COPY}.dd ${BATCH}.*
11
12cat << EOF > ${BATCH}.pass.1
13 get $DATA $COPY
14 put ${COPY} ${COPY}.1
15 rm ${COPY}
16 -put ${COPY} ${COPY}.2
17EOF
18
19cat << EOF > ${BATCH}.pass.2
20 # This is a comment
21
22 # That was a blank line
23 ls
24EOF
25
26cat << EOF > ${BATCH}.fail.1
27 get $DATA $COPY
28 put ${COPY} ${COPY}.3
29 rm ${COPY}.*
30 # The next command should fail
31 put ${COPY}.3 ${COPY}.4
32EOF
33
34cat << EOF > ${BATCH}.fail.2
35 # The next command should fail
36 jajajajaja
37EOF
38
39verbose "$tid: good commands"
40${SFTP} -b ${BATCH}.pass.1 -P ${SFTPSERVER} >/dev/null 2>&1 \
41 || fail "good commands failed"
42
43verbose "$tid: bad commands"
44${SFTP} -b ${BATCH}.fail.1 -P ${SFTPSERVER} >/dev/null 2>&1 \
45 && fail "bad commands succeeded"
46
47verbose "$tid: comments and blanks"
48${SFTP} -b ${BATCH}.pass.2 -P ${SFTPSERVER} >/dev/null 2>&1 \
49 || fail "comments & blanks failed"
50
51verbose "$tid: junk command"
52${SFTP} -b ${BATCH}.fail.2 -P ${SFTPSERVER} >/dev/null 2>&1 \
53 && fail "junk command succeeded"
54
55rm -rf ${COPY} ${COPY}.1 ${COPY}.2 ${COPY}.dd ${BATCH}.*
56
57