aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/profiles/comment.profile3
-rwxr-xr-xtest/profiles/profile_comment.exp52
-rwxr-xr-xtest/profiles/profiles.sh3
-rwxr-xr-xtest/utils/build.exp32
4 files changed, 80 insertions, 10 deletions
diff --git a/test/profiles/comment.profile b/test/profiles/comment.profile
new file mode 100644
index 000000000..4a907a408
--- /dev/null
+++ b/test/profiles/comment.profile
@@ -0,0 +1,3 @@
1# this is a comment
2net none # this is another comment
3private # some other comment
diff --git a/test/profiles/profile_comment.exp b/test/profiles/profile_comment.exp
new file mode 100755
index 000000000..a2be510c1
--- /dev/null
+++ b/test/profiles/profile_comment.exp
@@ -0,0 +1,52 @@
1#!/usr/bin/expect -f
2# This file is part of Firejail project
3# Copyright (C) 2014-2021 Firejail Authors
4# License GPL v2
5
6set timeout 10
7spawn $env(SHELL)
8match_max 100000
9
10send -- "rm -fr /tmp/firejailtest*\r"
11send -- "rm -fr /tmp/firejail-strace*\r"
12send -- "rm -fr /tmp/firejail-trace*\r"
13sleep 1
14
15send -- "firejail --profile=comment.profile /usr/bin/true\r"
16expect {
17 timeout {puts "TESTING ERROR 0\n";exit}
18 "Child process initialized"
19}
20expect {
21 timeout {puts "TESTING ERROR 1\n";exit}
22 "Parent is shutting down"
23}
24sleep 2
25
26send -- "firejail --build=/tmp/firejailtest.profile /usr/bin/true\r"
27sleep 1
28
29send -- "cat /tmp/firejailtest.profile\r"
30expect {
31 timeout {puts "TESTING ERROR 2\n";exit}
32 "seccomp"
33}
34after 100
35
36send -- "firejail --profile=/tmp/firejailtest.profile /usr/bin/true\r"
37expect {
38 timeout {puts "TESTING ERROR 3\n";exit}
39 "Child process initialized"
40}
41expect {
42 timeout {puts "TESTING ERROR 4\n";exit}
43 "Parent is shutting down"
44}
45after 100
46
47send -- "rm -fr /tmp/firejailtest*\r"
48send -- "rm -fr /tmp/firejail-strace*\r"
49send -- "rm -fr /tmp/firejail-trace*\r"
50after 100
51
52puts "\nall done\n"
diff --git a/test/profiles/profiles.sh b/test/profiles/profiles.sh
index a5f74f2e2..cbc6fa4d9 100755
--- a/test/profiles/profiles.sh
+++ b/test/profiles/profiles.sh
@@ -7,6 +7,9 @@ export MALLOC_CHECK_=3
7export MALLOC_PERTURB_=$(($RANDOM % 255 + 1)) 7export MALLOC_PERTURB_=$(($RANDOM % 255 + 1))
8export LC_ALL=C 8export LC_ALL=C
9 9
10echo "TESTING: profile comments (test/profiles/profilecomment.exp)"
11./profile_comment.exp
12
10echo "TESTING: profile conditional (test/profiles/conditional.exp)" 13echo "TESTING: profile conditional (test/profiles/conditional.exp)"
11./conditional.exp 14./conditional.exp
12 15
diff --git a/test/utils/build.exp b/test/utils/build.exp
index cdc2f3b7b..7fbe969a4 100755
--- a/test/utils/build.exp
+++ b/test/utils/build.exp
@@ -21,35 +21,35 @@ expect {
21} 21}
22expect { 22expect {
23 timeout {puts "TESTING ERROR 2\n";exit} 23 timeout {puts "TESTING ERROR 2\n";exit}
24 "blacklist /usr/share" 24 "include whitelist-usr-share-common.inc"
25} 25}
26expect { 26expect {
27 timeout {puts "TESTING ERROR 3\n";exit} 27 timeout {puts "TESTING ERROR 3\n";exit}
28 "blacklist /var" 28 "include whitelist-var-common.inc"
29} 29}
30expect { 30expect {
31 timeout {puts "TESTING ERROR 4\n";exit} 31 timeout {puts "TESTING ERROR 4\n";exit}
32 "private-bin cat," 32 "caps.drop all"
33} 33}
34expect { 34expect {
35 timeout {puts "TESTING ERROR 5\n";exit} 35 timeout {puts "TESTING ERROR 5\n";exit}
36 "private-dev" 36 "ipc-namespace"
37} 37}
38expect { 38expect {
39 timeout {puts "TESTING ERROR 6\n";exit} 39 timeout {puts "TESTING ERROR 6\n";exit}
40 "private-etc" 40 "netfilter"
41} 41}
42expect { 42expect {
43 timeout {puts "TESTING ERROR 7\n";exit} 43 timeout {puts "TESTING ERROR 7\n";exit}
44 "private-tmp" 44 "nonewprivs"
45} 45}
46expect { 46expect {
47 timeout {puts "TESTING ERROR 8\n";exit} 47 timeout {puts "TESTING ERROR 8\n";exit}
48 "caps.drop all" 48 "noroot"
49} 49}
50expect { 50expect {
51 timeout {puts "TESTING ERROR 9\n";exit} 51 timeout {puts "TESTING ERROR 9\n";exit}
52 "nonewprivs" 52 "net none"
53} 53}
54expect { 54expect {
55 timeout {puts "TESTING ERROR 10\n";exit} 55 timeout {puts "TESTING ERROR 10\n";exit}
@@ -57,11 +57,23 @@ expect {
57} 57}
58expect { 58expect {
59 timeout {puts "TESTING ERROR 11\n";exit} 59 timeout {puts "TESTING ERROR 11\n";exit}
60 "net none" 60 "shell none"
61}
62expect {
63 timeout {puts "TESTING ERROR 11\n";exit}
64 "private-bin cat,"
61} 65}
62expect { 66expect {
63 timeout {puts "TESTING ERROR 12\n";exit} 67 timeout {puts "TESTING ERROR 12\n";exit}
64 "shell none" 68 "private-dev"
69}
70expect {
71 timeout {puts "TESTING ERROR 13\n";exit}
72 "private-etc none"
73}
74expect {
75 timeout {puts "TESTING ERROR 14\n";exit}
76 "private-tmp"
65} 77}
66after 100 78after 100
67 79