diff options
author | netblue30 <netblue30@yahoo.com> | 2016-04-24 06:49:25 -0400 |
---|---|---|
committer | netblue30 <netblue30@yahoo.com> | 2016-04-24 06:49:25 -0400 |
commit | 46113d48c480249363081ce75086d275948bd644 (patch) | |
tree | 5c78867f8f9cdc0900d8b855d5cfa9ca5e4ae34f /test/utils | |
parent | testing (diff) | |
download | firejail-46113d48c480249363081ce75086d275948bd644.tar.gz firejail-46113d48c480249363081ce75086d275948bd644.tar.zst firejail-46113d48c480249363081ce75086d275948bd644.zip |
testing
Diffstat (limited to 'test/utils')
-rwxr-xr-x | test/utils/caps.exp | 129 | ||||
-rw-r--r-- | test/utils/caps1.profile | 1 | ||||
-rw-r--r-- | test/utils/caps2.profile | 1 | ||||
-rwxr-xr-x | test/utils/seccomp.exp | 48 | ||||
-rwxr-xr-x | test/utils/utils.sh | 6 |
5 files changed, 185 insertions, 0 deletions
diff --git a/test/utils/caps.exp b/test/utils/caps.exp new file mode 100755 index 000000000..ab1067921 --- /dev/null +++ b/test/utils/caps.exp | |||
@@ -0,0 +1,129 @@ | |||
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 -- "firejail --name=bingo1 --noprofile --caps\r" | ||
11 | expect { | ||
12 | timeout {puts "TESTING ERROR 0\n";exit} | ||
13 | "Child process initialized" | ||
14 | } | ||
15 | sleep 1 | ||
16 | |||
17 | spawn $env(SHELL) | ||
18 | send -- "firejail --name=bingo2 --noprofile\r" | ||
19 | expect { | ||
20 | timeout {puts "TESTING ERROR 1\n";exit} | ||
21 | "Child process initialized" | ||
22 | } | ||
23 | sleep 1 | ||
24 | |||
25 | spawn $env(SHELL) | ||
26 | send -- "firejail --name=bingo3 --noprofile --caps.drop=all\r" | ||
27 | expect { | ||
28 | timeout {puts "TESTING ERROR 2\n";exit} | ||
29 | "Child process initialized" | ||
30 | } | ||
31 | sleep 1 | ||
32 | |||
33 | spawn $env(SHELL) | ||
34 | send -- "firejail --noprofile --name=bingo4 --caps.drop=chown,kill\r" | ||
35 | expect { | ||
36 | timeout {puts "TESTING ERROR 3\n";exit} | ||
37 | "Child process initialized" | ||
38 | } | ||
39 | sleep 1 | ||
40 | |||
41 | spawn $env(SHELL) | ||
42 | send -- "firejail --noprofile --name=bingo5 --caps.keep=chown,kill\r" | ||
43 | expect { | ||
44 | timeout {puts "TESTING ERROR 4\n";exit} | ||
45 | "Child process initialized" | ||
46 | } | ||
47 | sleep 1 | ||
48 | |||
49 | spawn $env(SHELL) | ||
50 | send -- "firejail --name=bingo6 --profile=caps1.profile\r" | ||
51 | expect { | ||
52 | timeout {puts "TESTING ERROR 5\n";exit} | ||
53 | "Child process initialized" | ||
54 | } | ||
55 | sleep 1 | ||
56 | |||
57 | spawn $env(SHELL) | ||
58 | send -- "firejail --name=bingo7 --profile=caps2.profile\r" | ||
59 | expect { | ||
60 | timeout {puts "TESTING ERROR 0\n";exit} | ||
61 | "Child process initialized" | ||
62 | } | ||
63 | sleep 1 | ||
64 | |||
65 | spawn $env(SHELL) | ||
66 | send -- "firemon --caps\r" | ||
67 | expect { | ||
68 | timeout {puts "TESTING ERROR 8.1\n";exit} | ||
69 | "bingo1" | ||
70 | } | ||
71 | expect { | ||
72 | timeout {puts "TESTING ERROR 8.2\n";exit} | ||
73 | "31cffff" | ||
74 | } | ||
75 | expect { | ||
76 | timeout {puts "TESTING ERROR 8.3\n";exit} | ||
77 | "bingo2" | ||
78 | } | ||
79 | expect { | ||
80 | timeout {puts "TESTING ERROR 8.4\n";exit} | ||
81 | "fffffff" | ||
82 | } | ||
83 | expect { | ||
84 | timeout {puts "TESTING ERROR 8.5\n";exit} | ||
85 | "bingo3" | ||
86 | } | ||
87 | expect { | ||
88 | timeout {puts "TESTING ERROR 8.6\n";exit} | ||
89 | "000000000000" | ||
90 | } | ||
91 | |||
92 | expect { | ||
93 | timeout {puts "TESTING ERROR 8.7\n";exit} | ||
94 | "bingo4" | ||
95 | } | ||
96 | expect { | ||
97 | timeout {puts "TESTING ERROR 8.8\n";exit} | ||
98 | "ffffffde" | ||
99 | } | ||
100 | expect { | ||
101 | timeout {puts "TESTING ERROR 8.9\n";exit} | ||
102 | "bingo5" | ||
103 | } | ||
104 | expect { | ||
105 | timeout {puts "TESTING ERROR 8.10\n";exit} | ||
106 | "0000000000000021" | ||
107 | } | ||
108 | |||
109 | expect { | ||
110 | timeout {puts "TESTING ERROR 8.11\n";exit} | ||
111 | "bingo6" | ||
112 | } | ||
113 | expect { | ||
114 | timeout {puts "TESTING ERROR 8.12\n";exit} | ||
115 | "ffffffde" | ||
116 | } | ||
117 | expect { | ||
118 | timeout {puts "TESTING ERROR 8.13\n";exit} | ||
119 | "bingo7" | ||
120 | } | ||
121 | expect { | ||
122 | timeout {puts "TESTING ERROR 8.14\n";exit} | ||
123 | "0000000000000021" | ||
124 | } | ||
125 | |||
126 | after 100 | ||
127 | |||
128 | puts "all done\n" | ||
129 | |||
diff --git a/test/utils/caps1.profile b/test/utils/caps1.profile new file mode 100644 index 000000000..e14655b2e --- /dev/null +++ b/test/utils/caps1.profile | |||
@@ -0,0 +1 @@ | |||
caps.drop chown,kill \ No newline at end of file | |||
diff --git a/test/utils/caps2.profile b/test/utils/caps2.profile new file mode 100644 index 000000000..cb2258c52 --- /dev/null +++ b/test/utils/caps2.profile | |||
@@ -0,0 +1 @@ | |||
caps.keep chown,kill \ No newline at end of file | |||
diff --git a/test/utils/seccomp.exp b/test/utils/seccomp.exp new file mode 100755 index 000000000..a318e39b1 --- /dev/null +++ b/test/utils/seccomp.exp | |||
@@ -0,0 +1,48 @@ | |||
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 -- "firejail --noprofile --name=bingo1 --seccomp\r" | ||
11 | expect { | ||
12 | timeout {puts "TESTING ERROR 0\n";exit} | ||
13 | "Child process initialized" | ||
14 | } | ||
15 | sleep 1 | ||
16 | |||
17 | spawn $env(SHELL) | ||
18 | send -- "firejail --noprofile --name=bingo2\r" | ||
19 | expect { | ||
20 | timeout {puts "TESTING ERROR 0.1\n";exit} | ||
21 | "Child process initialized" | ||
22 | } | ||
23 | sleep 1 | ||
24 | |||
25 | |||
26 | |||
27 | |||
28 | spawn $env(SHELL) | ||
29 | send -- "firemon --seccomp\r" | ||
30 | expect { | ||
31 | timeout {puts "TESTING ERROR 1\n";exit} | ||
32 | "bingo1" | ||
33 | } | ||
34 | expect { | ||
35 | timeout {puts "TESTING ERROR 2\n";exit} | ||
36 | "Seccomp: 2" | ||
37 | } | ||
38 | expect { | ||
39 | timeout {puts "TESTING ERROR 3\n";exit} | ||
40 | "bingo2" | ||
41 | } | ||
42 | expect { | ||
43 | timeout {puts "TESTING ERROR 3\n";exit} | ||
44 | "Seccomp: 0" | ||
45 | } | ||
46 | after 100 | ||
47 | |||
48 | puts "all done\n" | ||
diff --git a/test/utils/utils.sh b/test/utils/utils.sh index 8c53feab3..23cbc6b35 100755 --- a/test/utils/utils.sh +++ b/test/utils/utils.sh | |||
@@ -69,3 +69,9 @@ rm -f index.html* | |||
69 | ./trace.exp | 69 | ./trace.exp |
70 | rm -f index.html* | 70 | rm -f index.html* |
71 | 71 | ||
72 | echo "TESTING: firemon --seccomp (test/utils/seccomp.exp)" | ||
73 | ./seccomp.exp | ||
74 | |||
75 | echo "TESTING: firemon --caps (test/ustil/caps.exp)" | ||
76 | ./caps.exp | ||
77 | |||