aboutsummaryrefslogtreecommitdiffstats
path: root/test/filters/seccomp-errno.exp
diff options
context:
space:
mode:
authorLibravatar netblue30 <netblue30@yahoo.com>2016-04-30 07:31:21 -0400
committerLibravatar netblue30 <netblue30@yahoo.com>2016-04-30 07:31:21 -0400
commitea774178f6d8f613c96c0d001fed200155b704b7 (patch)
treeee2de7fcce0499dcb21cf475a068fe8957ab07bb /test/filters/seccomp-errno.exp
parentadded make test-filters (diff)
downloadfirejail-ea774178f6d8f613c96c0d001fed200155b704b7.tar.gz
firejail-ea774178f6d8f613c96c0d001fed200155b704b7.tar.zst
firejail-ea774178f6d8f613c96c0d001fed200155b704b7.zip
added make test-filters
Diffstat (limited to 'test/filters/seccomp-errno.exp')
-rwxr-xr-xtest/filters/seccomp-errno.exp90
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
6set timeout 10
7spawn $env(SHELL)
8match_max 100000
9
10send -- "touch seccomp-test-file\r"
11sleep 1
12
13send -- "firejail --seccomp.enoent=unlinkat rm seccomp-test-file\r"
14expect {
15 timeout {puts "TESTING ERROR 0\n";exit}
16 "No such file or directory"
17}
18sleep 1
19
20send -- "firejail --seccomp.enoent=unlinkat --debug rm seccomp-test-file\r"
21expect {
22 timeout {puts "TESTING ERROR 1\n";exit}
23 "unlinkat 2 ENOENT"
24}
25sleep 1
26
27send -- "firejail --seccomp.enoent=unlinkat,mkdir\r"
28expect {
29 timeout {puts "TESTING ERROR 2\n";exit}
30 "Child process initialized"
31}
32sleep 1
33send -- "rm seccomp-test-file\r"
34expect {
35 timeout {puts "TESTING ERROR 3\n";exit}
36 "No such file or directory"
37}
38after 100
39puts "\n"
40
41send -- "mkdir seccomp-test-dir\r"
42expect {
43 timeout {puts "TESTING ERROR 4\n";exit}
44 "No such file or directory"
45}
46after 100
47puts "\n"
48
49send -- "exit\r"
50sleep 1
51
52
53send -- "firejail --seccomp.enoent=unlinkat --seccomp.enoent=mkdir\r"
54expect {
55 timeout {puts "TESTING ERROR 5\n";exit}
56 "errno enoent already configured"
57}
58sleep 1
59
60send -- "firejail --seccomp.enoent=unlinkat --seccomp.eperm=mkdir\r"
61expect {
62 timeout {puts "TESTING ERROR 6\n";exit}
63 "Child process initialized"
64}
65sleep 1
66send -- "rm seccomp-test-file\r"
67expect {
68 timeout {puts "TESTING ERROR 7\n";exit}
69 "No such file or directory"
70}
71after 100
72puts "\n"
73
74send -- "mkdir seccomp-test-dir\r"
75expect {
76 timeout {puts "TESTING ERROR 8\n";exit}
77 "Operation not permitted"
78}
79after 100
80puts "\n"
81
82send -- "exit\r"
83sleep 1
84
85
86
87
88send -- "rm seccomp-test-file\r"
89sleep 1
90puts "all done\n"