summaryrefslogtreecommitdiffstats
path: root/test/ssh/scp.exp
diff options
context:
space:
mode:
Diffstat (limited to 'test/ssh/scp.exp')
-rwxr-xr-xtest/ssh/scp.exp63
1 files changed, 63 insertions, 0 deletions
diff --git a/test/ssh/scp.exp b/test/ssh/scp.exp
new file mode 100755
index 000000000..355125751
--- /dev/null
+++ b/test/ssh/scp.exp
@@ -0,0 +1,63 @@
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 -- "scp testfile firejail-test@0:~/testfile\r"
23expect {
24 timeout {puts "TESTING ERROR 1\n";exit}
25 "100%"
26}
27sleep 1
28
29
30send -- "ssh firejail-test@0\r"
31expect {
32 timeout {puts "TESTING ERROR 2\n";exit}
33 "Child process initialized" {puts "OK\n"}
34 "an existing sandbox was detected" {puts "OK\n"}
35}
36sleep 1
37send -- "cat testfile\r"
38expect {
39 timeout {puts "TESTING ERROR 3\n";exit}
40 "12345"
41}
42after 100
43send -- "exit\r"
44sleep 1
45
46send -- "rm testfile\r"
47after 100
48send -- "scp firejail-test@0:~/testfile testfile\r"
49expect {
50 timeout {puts "TESTING ERROR 4\n";exit}
51 "100%"
52}
53sleep 1
54send -- "cat testfile\r"
55expect {
56 timeout {puts "TESTING ERROR 5\n";exit}
57 "12345"
58}
59after 100
60send -- "rm testfile\r"
61sleep 1
62
63puts "\nall done\n"