aboutsummaryrefslogtreecommitdiffstats
path: root/test/ssh/sftp.exp
diff options
context:
space:
mode:
Diffstat (limited to 'test/ssh/sftp.exp')
-rwxr-xr-xtest/ssh/sftp.exp87
1 files changed, 87 insertions, 0 deletions
diff --git a/test/ssh/sftp.exp b/test/ssh/sftp.exp
new file mode 100755
index 000000000..72c858f05
--- /dev/null
+++ b/test/ssh/sftp.exp
@@ -0,0 +1,87 @@
1#!/usr/bin/expect -f
2
3set timeout 10
4spawn $env(SHELL)
5match_max 100000
6
7send -- "ssh firejail-test@0\r"
8expect {
9 timeout {puts "TESTING ERROR 0\n";exit}
10 "Child process initialized" {puts "OK\n"}
11 "an existing sandbox was detected" {puts "OK\n"}
12}
13sleep 1
14
15send -- "rm -f testfile\r"
16after 100
17send -- "exit\r"
18sleep 1
19
20send -- "echo 12345 > testfile\r"
21after 100
22send -- "sftp firejail-test@0\r"
23expect {
24 timeout {puts "TESTING ERROR 0\n";exit}
25 "Connected to 0"
26}
27expect {
28 timeout {puts "TESTING ERROR 0\n";exit}
29 "sftp>"
30}
31after 100
32send -- "put testfile\r"
33expect {
34 timeout {puts "TESTING ERROR 0\n";exit}
35 "100%"
36}
37after 100
38send -- "exit\r"
39sleep 1
40
41
42send -- "ssh firejail-test@0\r"
43expect {
44 timeout {puts "TESTING ERROR 0\n";exit}
45 "Child process initialized" {puts "OK\n"}
46 "an existing sandbox was detected" {puts "OK\n"}
47}
48sleep 1
49send -- "cat testfile\r"
50expect {
51 timeout {puts "TESTING ERROR 0\n";exit}
52 "12345"
53}
54after 100
55send -- "exit\r"
56sleep 1
57
58send -- "rm testfile\r"
59after 100
60send -- "sftp firejail-test@0\r"
61expect {
62 timeout {puts "TESTING ERROR 0\n";exit}
63 "Connected to 0"
64}
65expect {
66 timeout {puts "TESTING ERROR 0\n";exit}
67 "sftp>"
68}
69after 100
70send -- "get testfile\r"
71expect {
72 timeout {puts "TESTING ERROR 0\n";exit}
73 "100%"
74}
75after 100
76send -- "exit\r"
77sleep 1
78send -- "cat testfile\r"
79expect {
80 timeout {puts "TESTING ERROR 0\n";exit}
81 "12345"
82}
83after 100
84send -- "rm testfile\r"
85sleep 1
86
87puts "\nall done\n"