diff options
Diffstat (limited to 'test/fs/macro.exp')
-rwxr-xr-x | test/fs/macro.exp | 174 |
1 files changed, 174 insertions, 0 deletions
diff --git a/test/fs/macro.exp b/test/fs/macro.exp new file mode 100755 index 000000000..8080a8108 --- /dev/null +++ b/test/fs/macro.exp | |||
@@ -0,0 +1,174 @@ | |||
1 | #!/usr/bin/expect -f | ||
2 | # This file is part of Firejail project | ||
3 | # Copyright (C) 2014-2018 Firejail Authors | ||
4 | # License GPL v2 | ||
5 | |||
6 | set timeout 10 | ||
7 | spawn $env(SHELL) | ||
8 | match_max 100000 | ||
9 | |||
10 | |||
11 | send -- "firejail --profile=macro-whitelist.profile ls ~\r" | ||
12 | expect { | ||
13 | timeout {puts "TESTING ERROR 0\n";exit} | ||
14 | "Child process initialized" | ||
15 | } | ||
16 | expect { | ||
17 | timeout {puts "TESTING ERROR 1\n";exit} | ||
18 | "Desktop" | ||
19 | } | ||
20 | expect { | ||
21 | timeout {puts "TESTING ERROR 2\n";exit} | ||
22 | "Documents" | ||
23 | } | ||
24 | expect { | ||
25 | timeout {puts "TESTING ERROR 3\n";exit} | ||
26 | "Downloads" | ||
27 | } | ||
28 | expect { | ||
29 | timeout {puts "TESTING ERROR 4\n";exit} | ||
30 | "Music" | ||
31 | } | ||
32 | expect { | ||
33 | timeout {puts "TESTING ERROR 5\n";exit} | ||
34 | "Pictures" | ||
35 | } | ||
36 | expect { | ||
37 | timeout {puts "TESTING ERROR 6\n";exit} | ||
38 | "Videos" | ||
39 | } | ||
40 | sleep 1 | ||
41 | |||
42 | send -- "firejail --profile=macro-blacklist.profile ls ~/Desktop\r" | ||
43 | expect { | ||
44 | timeout {puts "TESTING ERROR 7\n";exit} | ||
45 | "Child process initialized" | ||
46 | } | ||
47 | expect { | ||
48 | timeout {puts "TESTING ERROR 8\n";exit} | ||
49 | "Permission denied" | ||
50 | } | ||
51 | sleep 1 | ||
52 | |||
53 | send -- "firejail --profile=macro-blacklist.profile ls ~/Documents\r" | ||
54 | expect { | ||
55 | timeout {puts "TESTING ERROR 9n";exit} | ||
56 | "Child process initialized" | ||
57 | } | ||
58 | expect { | ||
59 | timeout {puts "TESTING ERROR 10\n";exit} | ||
60 | "Permission denied" | ||
61 | } | ||
62 | sleep 1 | ||
63 | |||
64 | send -- "firejail --profile=macro-blacklist.profile ls ~/Downloads\r" | ||
65 | expect { | ||
66 | timeout {puts "TESTING ERROR 11n";exit} | ||
67 | "Child process initialized" | ||
68 | } | ||
69 | expect { | ||
70 | timeout {puts "TESTING ERROR 12n";exit} | ||
71 | "Permission denied" | ||
72 | } | ||
73 | sleep 1 | ||
74 | |||
75 | send -- "firejail --profile=macro-blacklist.profile ls ~/Music\r" | ||
76 | expect { | ||
77 | timeout {puts "TESTING ERROR 13\n";exit} | ||
78 | "Child process initialized" | ||
79 | } | ||
80 | expect { | ||
81 | timeout {puts "TESTING ERROR 14\n";exit} | ||
82 | "Permission denied" | ||
83 | } | ||
84 | sleep 1 | ||
85 | |||
86 | send -- "firejail --profile=macro-blacklist.profile ls ~/Pictures\r" | ||
87 | expect { | ||
88 | timeout {puts "TESTING ERROR 15\n";exit} | ||
89 | "Child process initialized" | ||
90 | } | ||
91 | expect { | ||
92 | timeout {puts "TESTING ERROR 16\n";exit} | ||
93 | "Permission denied" | ||
94 | } | ||
95 | sleep 1 | ||
96 | |||
97 | send -- "firejail --profile=macro-blacklist.profile ls ~/Videos\r" | ||
98 | expect { | ||
99 | timeout {puts "TESTING ERROR 17\n";exit} | ||
100 | "Child process initialized" | ||
101 | } | ||
102 | expect { | ||
103 | timeout {puts "TESTING ERROR 18\n";exit} | ||
104 | "Permission denied" | ||
105 | } | ||
106 | sleep 1 | ||
107 | |||
108 | send -- "firejail --profile=macro-readonly.profile touch ~/Desktop/blablabla\r" | ||
109 | expect { | ||
110 | timeout {puts "TESTING ERROR 19\n";exit} | ||
111 | "Child process initialized" | ||
112 | } | ||
113 | expect { | ||
114 | timeout {puts "TESTING ERROR 20\n";exit} | ||
115 | "Read-only file system" | ||
116 | } | ||
117 | sleep 1 | ||
118 | |||
119 | send -- "firejail --profile=macro-readonly.profile touch ~/Documents/blablabla\r" | ||
120 | expect { | ||
121 | timeout {puts "TESTING ERROR 21\n";exit} | ||
122 | "Child process initialized" | ||
123 | } | ||
124 | expect { | ||
125 | timeout {puts "TESTING ERROR 22\n";exit} | ||
126 | "Read-only file system" | ||
127 | } | ||
128 | sleep 1 | ||
129 | |||
130 | send -- "firejail --profile=macro-readonly.profile touch ~/Downloads/blablabla\r" | ||
131 | expect { | ||
132 | timeout {puts "TESTING ERROR 23\n";exit} | ||
133 | "Child process initialized" | ||
134 | } | ||
135 | expect { | ||
136 | timeout {puts "TESTING ERROR 24\n";exit} | ||
137 | "Read-only file system" | ||
138 | } | ||
139 | sleep 1 | ||
140 | |||
141 | send -- "firejail --profile=macro-readonly.profile touch ~/Music/blablabla\r" | ||
142 | expect { | ||
143 | timeout {puts "TESTING ERROR 25\n";exit} | ||
144 | "Child process initialized" | ||
145 | } | ||
146 | expect { | ||
147 | timeout {puts "TESTING ERROR 26\n";exit} | ||
148 | "Read-only file system" | ||
149 | } | ||
150 | sleep 1 | ||
151 | |||
152 | send -- "firejail --profile=macro-readonly.profile touch ~/Pictures/blablabla\r" | ||
153 | expect { | ||
154 | timeout {puts "TESTING ERROR 27\n";exit} | ||
155 | "Child process initialized" | ||
156 | } | ||
157 | expect { | ||
158 | timeout {puts "TESTING ERROR 28\n";exit} | ||
159 | "Read-only file system" | ||
160 | } | ||
161 | sleep 1 | ||
162 | |||
163 | send -- "firejail --profile=macro-readonly.profile touch ~/Videos/blablabla\r" | ||
164 | expect { | ||
165 | timeout {puts "TESTING ERROR 29\n";exit} | ||
166 | "Child process initialized" | ||
167 | } | ||
168 | expect { | ||
169 | timeout {puts "TESTING ERROR 30\n";exit} | ||
170 | "Read-only file system" | ||
171 | } | ||
172 | sleep 1 | ||
173 | |||
174 | puts "\nall done\n" | ||