diff options
Diffstat (limited to 'test/fs/read-write.exp')
-rwxr-xr-x | test/fs/read-write.exp | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/test/fs/read-write.exp b/test/fs/read-write.exp new file mode 100755 index 000000000..57986488e --- /dev/null +++ b/test/fs/read-write.exp | |||
@@ -0,0 +1,51 @@ | |||
1 | #!/usr/bin/expect -f | ||
2 | # This file is part of Firejail project | ||
3 | # Copyright (C) 2014-2016 Firejail Authors | ||
4 | # License GPL v2 | ||
5 | |||
6 | set timeout 10 | ||
7 | spawn $env(SHELL) | ||
8 | match_max 100000 | ||
9 | |||
10 | |||
11 | send -- "firejail --read-only=~/_firejail_test_dir --read-write=~/_firejail_test_dir/test1\r" | ||
12 | expect { | ||
13 | timeout {puts "TESTING ERROR 0\n";exit} | ||
14 | "Child process initialized" | ||
15 | } | ||
16 | sleep 1 | ||
17 | |||
18 | send -- "echo mytest >~/_firejail_test_dir/a;echo done\r" | ||
19 | expect { | ||
20 | timeout {puts "TESTING ERROR 1\n";exit} | ||
21 | "done" | ||
22 | } | ||
23 | after 100 | ||
24 | |||
25 | send -- "echo mytest >~/_firejail_test_dir/test1/b;echo done\r" | ||
26 | expect { | ||
27 | timeout {puts "TESTING ERROR 2\n";exit} | ||
28 | "done" | ||
29 | } | ||
30 | after 100 | ||
31 | |||
32 | send -- "cat ~/_firejail_test_dir/a;echo done\r" | ||
33 | expect { | ||
34 | timeout {puts "TESTING ERROR 3\n";exit} | ||
35 | "mytest" {puts "TESTING ERROR 4\n";exit} | ||
36 | "done" | ||
37 | } | ||
38 | after 100 | ||
39 | |||
40 | send -- "cat ~/_firejail_test_dir/test1/b;echo done\r" | ||
41 | expect { | ||
42 | timeout {puts "TESTING ERROR 5\n";exit} | ||
43 | "mytest" | ||
44 | } | ||
45 | expect { | ||
46 | timeout {puts "TESTING ERROR 6\n";exit} | ||
47 | "done" | ||
48 | } | ||
49 | |||
50 | after 100 | ||
51 | puts "\nall done\n" | ||