diff options
Diffstat (limited to 'test/filters/seccomp-errno.exp')
-rwxr-xr-x | test/filters/seccomp-errno.exp | 90 |
1 files changed, 90 insertions, 0 deletions
diff --git a/test/filters/seccomp-errno.exp b/test/filters/seccomp-errno.exp new file mode 100755 index 000000000..aefe816e1 --- /dev/null +++ b/test/filters/seccomp-errno.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 | send -- "touch seccomp-test-file\r" | ||
11 | sleep 1 | ||
12 | |||
13 | send -- "firejail --seccomp.enoent=unlinkat rm seccomp-test-file\r" | ||
14 | expect { | ||
15 | timeout {puts "TESTING ERROR 0\n";exit} | ||
16 | "No such file or directory" | ||
17 | } | ||
18 | sleep 1 | ||
19 | |||
20 | send -- "firejail --seccomp.enoent=unlinkat --debug rm seccomp-test-file\r" | ||
21 | expect { | ||
22 | timeout {puts "TESTING ERROR 1\n";exit} | ||
23 | "unlinkat 2 ENOENT" | ||
24 | } | ||
25 | sleep 1 | ||
26 | |||
27 | send -- "firejail --seccomp.enoent=unlinkat,mkdir\r" | ||
28 | expect { | ||
29 | timeout {puts "TESTING ERROR 2\n";exit} | ||
30 | "Child process initialized" | ||
31 | } | ||
32 | sleep 1 | ||
33 | send -- "rm seccomp-test-file\r" | ||
34 | expect { | ||
35 | timeout {puts "TESTING ERROR 3\n";exit} | ||
36 | "No such file or directory" | ||
37 | } | ||
38 | after 100 | ||
39 | puts "\n" | ||
40 | |||
41 | send -- "mkdir seccomp-test-dir\r" | ||
42 | expect { | ||
43 | timeout {puts "TESTING ERROR 4\n";exit} | ||
44 | "No such file or directory" | ||
45 | } | ||
46 | after 100 | ||
47 | puts "\n" | ||
48 | |||
49 | send -- "exit\r" | ||
50 | sleep 1 | ||
51 | |||
52 | |||
53 | send -- "firejail --seccomp.enoent=unlinkat --seccomp.enoent=mkdir\r" | ||
54 | expect { | ||
55 | timeout {puts "TESTING ERROR 5\n";exit} | ||
56 | "errno enoent already configured" | ||
57 | } | ||
58 | sleep 1 | ||
59 | |||
60 | send -- "firejail --seccomp.enoent=unlinkat --seccomp.eperm=mkdir\r" | ||
61 | expect { | ||
62 | timeout {puts "TESTING ERROR 6\n";exit} | ||
63 | "Child process initialized" | ||
64 | } | ||
65 | sleep 1 | ||
66 | send -- "rm seccomp-test-file\r" | ||
67 | expect { | ||
68 | timeout {puts "TESTING ERROR 7\n";exit} | ||
69 | "No such file or directory" | ||
70 | } | ||
71 | after 100 | ||
72 | puts "\n" | ||
73 | |||
74 | send -- "mkdir seccomp-test-dir\r" | ||
75 | expect { | ||
76 | timeout {puts "TESTING ERROR 8\n";exit} | ||
77 | "Operation not permitted" | ||
78 | } | ||
79 | after 100 | ||
80 | puts "\n" | ||
81 | |||
82 | send -- "exit\r" | ||
83 | sleep 1 | ||
84 | |||
85 | |||
86 | |||
87 | |||
88 | send -- "rm seccomp-test-file\r" | ||
89 | sleep 1 | ||
90 | puts "all done\n" | ||