aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorLibravatar smitsohu <smitsohu@gmail.com>2019-09-26 10:59:26 +0200
committerLibravatar smitsohu <smitsohu@gmail.com>2019-09-26 10:59:26 +0200
commitb9888e6a388b7d2c17f0aa75b2ef5205b4b90720 (patch)
treeb17e2d4430e1118e34f4f9764f082d30e309384e /test
parenttesting: rename and simplify (diff)
downloadfirejail-b9888e6a388b7d2c17f0aa75b2ef5205b4b90720.tar.gz
firejail-b9888e6a388b7d2c17f0aa75b2ef5205b4b90720.tar.zst
firejail-b9888e6a388b7d2c17f0aa75b2ef5205b4b90720.zip
testing
Diffstat (limited to 'test')
-rwxr-xr-xtest/environment/environment.sh3
-rwxr-xr-xtest/environment/umask.exp41
-rwxr-xr-xtest/fs/fs.sh9
-rwxr-xr-xtest/fs/noblacklist-blacklist-noexec.exp36
-rwxr-xr-xtest/fs/noblacklist-blacklist-readonly.exp35
-rwxr-xr-xtest/fs/whitelist-noexec.exp36
6 files changed, 160 insertions, 0 deletions
diff --git a/test/environment/environment.sh b/test/environment/environment.sh
index 735d3e59e..f860f7c24 100755
--- a/test/environment/environment.sh
+++ b/test/environment/environment.sh
@@ -120,3 +120,6 @@ echo "TESTING: rlimit errors profile (test/environment/rlimit-bad-profile.exp)"
120 120
121echo "TESTING: deterministic exit code (test/environment/deterministic-exit-code.exp" 121echo "TESTING: deterministic exit code (test/environment/deterministic-exit-code.exp"
122./deterministic-exit-code.exp 122./deterministic-exit-code.exp
123
124echo "TESTING: retain umask (test/environment/umask.exp"
125(umask 123 && ./umask.exp)
diff --git a/test/environment/umask.exp b/test/environment/umask.exp
new file mode 100755
index 000000000..e93d71bd4
--- /dev/null
+++ b/test/environment/umask.exp
@@ -0,0 +1,41 @@
1#!/usr/bin/expect -f
2
3set timeout 10
4spawn $env(SHELL)
5match_max 100000
6
7send -- "firejail --noprofile\r"
8expect {
9 timeout {puts "TESTING ERROR 0\n";exit}
10 "Child process initialized"
11}
12sleep 1
13
14send -- "umask\r"
15expect {
16 timeout {puts "TESTING ERROR 1\n";exit}
17 "0123"
18}
19after 100
20
21send -- "firejail\r"
22expect {
23 timeout {puts "TESTING ERROR 2\n";exit}
24 "Warning: an existing sandbox was detected"
25}
26after 100
27
28send -- "umask\r"
29expect {
30 timeout {puts "TESTING ERROR 3\n";exit}
31 "0123"
32}
33after 100
34
35send -- "exit\r"
36after 100
37
38send -- "exit\r"
39sleep 1
40
41puts "\nall done\n"
diff --git a/test/fs/fs.sh b/test/fs/fs.sh
index fa642443f..2509638fc 100755
--- a/test/fs/fs.sh
+++ b/test/fs/fs.sh
@@ -99,6 +99,12 @@ echo "TESTING: blacklist file (test/fs/option_blacklist_file.exp)"
99echo "TESTING: blacklist glob (test/fs/option_blacklist_glob.exp)" 99echo "TESTING: blacklist glob (test/fs/option_blacklist_glob.exp)"
100./option_blacklist_glob.exp 100./option_blacklist_glob.exp
101 101
102echo "TESTING: noblacklist blacklist noexec (test/fs/noblacklist-blacklist-noexec.exp)"
103./noblacklist-blacklist-noexec.exp
104
105echo "TESTING: noblacklist blacklist readonly (test/fs/noblacklist-blacklist-readonly.exp)"
106./noblacklist-blacklist-readonly.exp
107
102echo "TESTING: bind as user (test/fs/option_bind_user.exp)" 108echo "TESTING: bind as user (test/fs/option_bind_user.exp)"
103./option_bind_user.exp 109./option_bind_user.exp
104 110
@@ -114,6 +120,9 @@ echo "TESTING: whitelist (test/fs/whitelist.exp)"
114echo "TESTING: whitelist dev, var(test/fs/whitelist-dev.exp)" 120echo "TESTING: whitelist dev, var(test/fs/whitelist-dev.exp)"
115./whitelist-dev.exp 121./whitelist-dev.exp
116 122
123echo "TESTING: whitelist noexec (test/fs/whitelist-noexec.exp)"
124./whitelist-noexec.exp
125
117echo "TESTING: whitelist with whitespaces (test/fs/whitelist-whitespace.exp)" 126echo "TESTING: whitelist with whitespaces (test/fs/whitelist-whitespace.exp)"
118./whitelist-whitespace.exp 127./whitelist-whitespace.exp
119 128
diff --git a/test/fs/noblacklist-blacklist-noexec.exp b/test/fs/noblacklist-blacklist-noexec.exp
new file mode 100755
index 000000000..5d0581a8c
--- /dev/null
+++ b/test/fs/noblacklist-blacklist-noexec.exp
@@ -0,0 +1,36 @@
1#!/usr/bin/expect -f
2# This file is part of Firejail project
3# Copyright (C) 2014-2019 Firejail Authors
4# License GPL v2
5
6set timeout 10
7spawn $env(SHELL)
8match_max 100000
9set PWD $env(PWD)
10
11
12send -- "firejail --noprofile --noblacklist=$PWD --blacklist=$PWD --noexec=$PWD\r"
13expect {
14 timeout {puts "TESTING ERROR 0\n";exit}
15 "Child process initialized"
16}
17sleep 1
18
19send -- "ls $PWD\r"
20expect {
21 timeout {puts "TESTING ERROR 1\n";exit}
22 "noblacklist-blacklist-noexec.exp"
23}
24after 100
25
26send -- "$PWD/noblacklist-blacklist-noexec.exp\r"
27expect {
28 timeout {puts "TESTING ERROR 2\n";exit}
29 "Permission denied"
30}
31after 100
32
33send -- "exit\r"
34sleep 1
35
36puts "\nall done\n"
diff --git a/test/fs/noblacklist-blacklist-readonly.exp b/test/fs/noblacklist-blacklist-readonly.exp
new file mode 100755
index 000000000..c31bd6948
--- /dev/null
+++ b/test/fs/noblacklist-blacklist-readonly.exp
@@ -0,0 +1,35 @@
1#!/usr/bin/expect -f
2# This file is part of Firejail project
3# Copyright (C) 2014-2019 Firejail Authors
4# License GPL v2
5
6set timeout 10
7spawn $env(SHELL)
8match_max 100000
9
10
11send -- "firejail --noprofile --noblacklist=~ --blacklist=~ --read-only=~\r"
12expect {
13 timeout {puts "TESTING ERROR 0\n";exit}
14 "Child process initialized"
15}
16sleep 1
17
18send -- "ls ~\r"
19expect {
20 timeout {puts "TESTING ERROR 1\n";exit}
21 "Downloads"
22}
23after 100
24
25send -- "echo World > ~/Hello\r"
26expect {
27 timeout {puts "TESTING ERROR 2\n";exit}
28 "Read-only file system"
29}
30after 100
31
32send -- "exit\r"
33sleep 1
34
35puts "\nall done\n"
diff --git a/test/fs/whitelist-noexec.exp b/test/fs/whitelist-noexec.exp
new file mode 100755
index 000000000..f05316a30
--- /dev/null
+++ b/test/fs/whitelist-noexec.exp
@@ -0,0 +1,36 @@
1#!/usr/bin/expect -f
2# This file is part of Firejail project
3# Copyright (C) 2014-2019 Firejail Authors
4# License GPL v2
5
6set timeout 10
7spawn $env(SHELL)
8match_max 100000
9set PWD $env(PWD)
10
11
12send -- "firejail --noprofile --whitelist=$PWD --noexec=$PWD\r"
13expect {
14 timeout {puts "TESTING ERROR 0\n";exit}
15 "Child process initialized"
16}
17sleep 1
18
19send -- "ls $PWD\r"
20expect {
21 timeout {puts "TESTING ERROR 1\n";exit}
22 "whitelist-noexec.exp"
23}
24after 100
25
26send -- "$PWD/whitelist-noexec.exp\r"
27expect {
28 timeout {puts "TESTING ERROR 2\n";exit}
29 "Permission denied"
30}
31after 100
32
33send -- "exit\r"
34sleep 1
35
36puts "\nall done\n"