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