aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorLibravatar netblue30 <netblue30@yahoo.com>2020-05-18 07:33:28 -0400
committerLibravatar netblue30 <netblue30@yahoo.com>2020-05-18 07:33:28 -0400
commite7a61d334b704b3fb8dd2da1f6fdace918274fa3 (patch)
tree9ac2b114a0eca9309e1ccdcacd956a2ff12f18a7 /test
parentbetter blacklist ordering (diff)
downloadfirejail-e7a61d334b704b3fb8dd2da1f6fdace918274fa3.tar.gz
firejail-e7a61d334b704b3fb8dd2da1f6fdace918274fa3.tar.zst
firejail-e7a61d334b704b3fb8dd2da1f6fdace918274fa3.zip
fixing some of the tests
Diffstat (limited to 'test')
-rwxr-xr-xtest/fs/mkdir_mkfile.exp14
-rwxr-xr-xtest/utils/build.exp56
-rwxr-xr-xtest/utils/utils.sh5
3 files changed, 31 insertions, 44 deletions
diff --git a/test/fs/mkdir_mkfile.exp b/test/fs/mkdir_mkfile.exp
index 109984035..82dab1ddf 100755
--- a/test/fs/mkdir_mkfile.exp
+++ b/test/fs/mkdir_mkfile.exp
@@ -22,23 +22,23 @@ expect {
22 "_firejail_test_dir" 22 "_firejail_test_dir"
23} 23}
24expect { 24expect {
25 timeout {puts "TESTING ERROR 1\n";exit} 25 timeout {puts "TESTING ERROR 2\n";exit}
26 "_firejail_test_dir/dir1" 26 "_firejail_test_dir/dir1"
27} 27}
28expect { 28expect {
29 timeout {puts "TESTING ERROR 1\n";exit} 29 timeout {puts "TESTING ERROR 3\n";exit}
30 "_firejail_test_dir/dir1/dir2" 30 "_firejail_test_dir/dir1/dir2"
31} 31}
32expect { 32expect {
33 timeout {puts "TESTING ERROR 1\n";exit} 33 timeout {puts "TESTING ERROR 4\n";exit}
34 "_firejail_test_dir/dir1/dir2/dir3" 34 "_firejail_test_dir/dir1/dir2/dir3"
35} 35}
36expect { 36expect {
37 timeout {puts "TESTING ERROR 1\n";exit} 37 timeout {puts "TESTING ERROR 5\n";exit}
38 "_firejail_test_dir/dir1/dir2/dir3/file1" 38 "_firejail_test_dir/dir1/dir2/dir3/file1"
39} 39}
40expect { 40expect {
41 timeout {puts "TESTING ERROR 1\n";exit} 41 timeout {puts "TESTING ERROR 6\n";exit}
42 "_firejail_test_file" 42 "_firejail_test_file"
43} 43}
44after 100 44after 100
@@ -47,8 +47,8 @@ after 100
47 47
48send -- "firejail --profile=mkfile.profile\r" 48send -- "firejail --profile=mkfile.profile\r"
49expect { 49expect {
50 timeout {puts "TESTING ERROR 1\n";exit} 50 timeout {puts "TESTING ERROR 7\n";exit}
51 "only files in user home or /tmp" 51 "only files or directories in user home, /tmp"
52} 52}
53after 100 53after 100
54 54
diff --git a/test/utils/build.exp b/test/utils/build.exp
index ae46ffa6e..ac4f30326 100755
--- a/test/utils/build.exp
+++ b/test/utils/build.exp
@@ -7,22 +7,21 @@ set timeout 10
7spawn $env(SHELL) 7spawn $env(SHELL)
8match_max 100000 8match_max 100000
9 9
10send -- "echo testing > ~/firejail-test-file-7699\r"
11after 100
12
10send -- "firejail --build cat ~/firejail-test-file-7699\r" 13send -- "firejail --build cat ~/firejail-test-file-7699\r"
11expect { 14expect {
12 timeout {puts "TESTING ERROR 0\n";exit} 15 timeout {puts "TESTING ERROR 0\n";exit}
13 "whitelist ~/firejail-test-file-7699" 16 "whitelist $\{HOME\}/firejail-test-file-7699"
14}
15expect {
16 timeout {puts "TESTING ERROR 0.1\n";exit}
17 "include /etc/firejail/whitelist-common.inc"
18} 17}
19expect { 18expect {
20 timeout {puts "TESTING ERROR 1\n";exit} 19 timeout {puts "TESTING ERROR 1\n";exit}
21 "private-tmp" 20 "include whitelist-common.inc"
22} 21}
23expect { 22expect {
24 timeout {puts "TESTING ERROR 2\n";exit} 23 timeout {puts "TESTING ERROR 2\n";exit}
25 "private-dev" 24 "blacklist /usr/share"
26} 25}
27expect { 26expect {
28 timeout {puts "TESTING ERROR 3\n";exit} 27 timeout {puts "TESTING ERROR 3\n";exit}
@@ -34,26 +33,40 @@ expect {
34} 33}
35expect { 34expect {
36 timeout {puts "TESTING ERROR 5\n";exit} 35 timeout {puts "TESTING ERROR 5\n";exit}
37 "caps.drop all" 36 "private-dev"
38} 37}
39expect { 38expect {
40 timeout {puts "TESTING ERROR 6\n";exit} 39 timeout {puts "TESTING ERROR 6\n";exit}
41 "nonewprivs" 40 "private-etc"
42} 41}
43expect { 42expect {
44 timeout {puts "TESTING ERROR 7\n";exit} 43 timeout {puts "TESTING ERROR 7\n";exit}
45 "seccomp" 44 "private-tmp"
46} 45}
47expect { 46expect {
48 timeout {puts "TESTING ERROR 8\n";exit} 47 timeout {puts "TESTING ERROR 8\n";exit}
49 "net none" 48 "caps.drop all"
50} 49}
51expect { 50expect {
52 timeout {puts "TESTING ERROR 9\n";exit} 51 timeout {puts "TESTING ERROR 9\n";exit}
52 "nonewprivs"
53}
54expect {
55 timeout {puts "TESTING ERROR 10\n";exit}
56 "seccomp"
57}
58expect {
59 timeout {puts "TESTING ERROR 11\n";exit}
60 "net none"
61}
62expect {
63 timeout {puts "TESTING ERROR 12\n";exit}
53 "shell none" 64 "shell none"
54} 65}
55after 100 66after 100
56 67
68
69
57send -- "firejail --build cat /etc/passwd\r" 70send -- "firejail --build cat /etc/passwd\r"
58expect { 71expect {
59 timeout {puts "TESTING ERROR 10\n";exit} 72 timeout {puts "TESTING ERROR 10\n";exit}
@@ -72,21 +85,6 @@ expect {
72} 85}
73after 100 86after 100
74 87
75
76#send -- "firejail --build cat /var/tmp/firejail-test-file-7699\r"
77#expect {
78# timeout {puts "TESTING ERROR 11\n";exit}
79# "whitelist /var/tmp/firejail-test-file-7699"
80#}
81#after 100
82
83#send -- "firejail --build man firejail\r"
84#expect {
85# timeout {puts "TESTING ERROR 12\n";exit}
86# "whitelist /usr/share/man"
87#}
88#after 100
89
90send -- "firejail --build wget --output-document=~ debian.org\r" 88send -- "firejail --build wget --output-document=~ debian.org\r"
91expect { 89expect {
92 timeout {puts "TESTING ERROR 13\n";exit} 90 timeout {puts "TESTING ERROR 13\n";exit}
@@ -98,10 +96,4 @@ expect {
98} 96}
99after 100 97after 100
100 98
101
102send -- "firejail --build cat /tmp/firejail-test-file-7699\r"
103#todo - bug: it comes back with private-tmp
104sleep 1
105
106
107puts "all done\n" 99puts "all done\n"
diff --git a/test/utils/utils.sh b/test/utils/utils.sh
index 82ccc82bb..48a8051fa 100755
--- a/test/utils/utils.sh
+++ b/test/utils/utils.sh
@@ -13,14 +13,9 @@ if [ -f /etc/debian_version ]; then
13fi 13fi
14export PATH="$PATH:/usr/lib/firejail:/usr/lib64/firejail" 14export PATH="$PATH:/usr/lib/firejail:/usr/lib64/firejail"
15 15
16echo "testing" > ~/firejail-test-file-7699
17echo "testing" > /tmp/firejail-test-file-7699
18echo "testing" > /var/tmp/firejail-test-file-7699
19echo "TESTING: build (test/utils/build.exp)" 16echo "TESTING: build (test/utils/build.exp)"
20./build.exp 17./build.exp
21rm -f ~/firejail-test-file-7699 18rm -f ~/firejail-test-file-7699
22rm -f /tmp/firejail-test-file-7699
23rm -f /var/tmp/firejail-test-file-7699
24rm -f firejail-test-file-4388 19rm -f firejail-test-file-4388
25 20
26if [ $(readlink /proc/self) -lt 100 ]; then 21if [ $(readlink /proc/self) -lt 100 ]; then