diff options
Diffstat (limited to 'test/fs/fs_dev_shm.exp')
-rwxr-xr-x | test/fs/fs_dev_shm.exp | 90 |
1 files changed, 90 insertions, 0 deletions
diff --git a/test/fs/fs_dev_shm.exp b/test/fs/fs_dev_shm.exp new file mode 100755 index 000000000..6d27978e2 --- /dev/null +++ b/test/fs/fs_dev_shm.exp | |||
@@ -0,0 +1,90 @@ | |||
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 | # testing read-write /dev/shm | ||
11 | send -- "firejail\r" | ||
12 | expect { | ||
13 | timeout {puts "TESTING ERROR 0\n";exit} | ||
14 | "Child process initialized" | ||
15 | } | ||
16 | sleep 1 | ||
17 | |||
18 | send -- "echo mytest > /dev/shm/ttt;echo done\r" | ||
19 | expect { | ||
20 | timeout {puts "TESTING ERROR 1\n";exit} | ||
21 | "done" | ||
22 | } | ||
23 | |||
24 | send -- "cat /dev/shm/ttt;echo done\r" | ||
25 | expect { | ||
26 | timeout {puts "TESTING ERROR 2\n";exit} | ||
27 | "mytest" | ||
28 | } | ||
29 | expect { | ||
30 | timeout {puts "TESTING ERROR 3\n";exit} | ||
31 | "done" | ||
32 | } | ||
33 | |||
34 | send -- "rm /dev/shm/ttt;echo done\r" | ||
35 | expect { | ||
36 | timeout {puts "TESTING ERROR 4\n";exit} | ||
37 | "done" | ||
38 | } | ||
39 | |||
40 | send -- "cat /dev/shm/ttt;echo done\r" | ||
41 | expect { | ||
42 | timeout {puts "TESTING ERROR 5\n";exit} | ||
43 | "mytest" {puts "TESTING ERROR 6\n";exit} | ||
44 | "done" | ||
45 | } | ||
46 | |||
47 | sleep 1 | ||
48 | send -- "exit\r" | ||
49 | sleep 1 | ||
50 | |||
51 | # redo the test with --private | ||
52 | send -- "firejail\r" | ||
53 | expect { | ||
54 | timeout {puts "TESTING ERROR 7\n";exit} | ||
55 | "Child process initialized" | ||
56 | } | ||
57 | sleep 1 | ||
58 | |||
59 | send -- "echo mytest > /dev/shm/ttt;echo done\r" | ||
60 | expect { | ||
61 | timeout {puts "TESTING ERROR 8\n";exit} | ||
62 | "done" | ||
63 | } | ||
64 | |||
65 | send -- "cat /dev/shm/ttt;echo done\r" | ||
66 | expect { | ||
67 | timeout {puts "TESTING ERROR 9\n";exit} | ||
68 | "mytest" | ||
69 | } | ||
70 | expect { | ||
71 | timeout {puts "TESTING ERROR 10\n";exit} | ||
72 | "done" | ||
73 | } | ||
74 | |||
75 | send -- "rm /dev/shm/ttt;echo done\r" | ||
76 | expect { | ||
77 | timeout {puts "TESTING ERROR 11\n";exit} | ||
78 | "done" | ||
79 | } | ||
80 | |||
81 | send -- "cat /dev/shm/ttt;echo done\r" | ||
82 | expect { | ||
83 | timeout {puts "TESTING ERROR 12\n";exit} | ||
84 | "mytest" {puts "TESTING ERROR 13\n";exit} | ||
85 | "done" | ||
86 | } | ||
87 | |||
88 | sleep 1 | ||
89 | |||
90 | puts "\nall done\n" | ||