summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorLibravatar netblue30 <netblue30@yahoo.com>2018-08-07 09:08:21 -0400
committerLibravatar netblue30 <netblue30@yahoo.com>2018-08-07 09:08:21 -0400
commit2155203b3e01354c93d7cb68751f520704fcea1e (patch)
tree4017f17c91faf9c8dd8b2fc6a529601f4e95c4d1 /test
parentxdg support: split xdg whitelist code in a different module (diff)
downloadfirejail-2155203b3e01354c93d7cb68751f520704fcea1e.tar.gz
firejail-2155203b3e01354c93d7cb68751f520704fcea1e.tar.zst
firejail-2155203b3e01354c93d7cb68751f520704fcea1e.zip
xdg macro testing
Diffstat (limited to 'test')
-rwxr-xr-xtest/fs/fs.sh3
-rw-r--r--test/fs/macro-blacklist.profile6
-rw-r--r--test/fs/macro-readonly.profile6
-rw-r--r--test/fs/macro-whitelist.profile6
-rwxr-xr-xtest/fs/macro.exp174
5 files changed, 195 insertions, 0 deletions
diff --git a/test/fs/fs.sh b/test/fs/fs.sh
index 774c61750..c1b589c29 100755
--- a/test/fs/fs.sh
+++ b/test/fs/fs.sh
@@ -58,6 +58,9 @@ echo "TESTING: empty private-etc (test/fs/private-etc-empty.exp)"
58echo "TESTING: private-bin (test/fs/private-bin.exp)" 58echo "TESTING: private-bin (test/fs/private-bin.exp)"
59./private-bin.exp 59./private-bin.exp
60 60
61echo "TESTING: macros (test/fs/macro..exp)"
62./macro.exp
63
61echo "TESTING: whitelist empty (test/fs/whitelist-empty.exp)" 64echo "TESTING: whitelist empty (test/fs/whitelist-empty.exp)"
62./whitelist-empty.exp 65./whitelist-empty.exp
63 66
diff --git a/test/fs/macro-blacklist.profile b/test/fs/macro-blacklist.profile
new file mode 100644
index 000000000..2421d1b7c
--- /dev/null
+++ b/test/fs/macro-blacklist.profile
@@ -0,0 +1,6 @@
1blacklist ${VIDEOS}
2blacklist ${DOCUMENTS}
3blacklist ${MUSIC}
4blacklist ${DOWNLOADS}
5blacklist ${PICTURES}
6blacklist ${DESKTOP}
diff --git a/test/fs/macro-readonly.profile b/test/fs/macro-readonly.profile
new file mode 100644
index 000000000..2f3d5bd78
--- /dev/null
+++ b/test/fs/macro-readonly.profile
@@ -0,0 +1,6 @@
1read-only ${VIDEOS}
2read-only ${DOCUMENTS}
3read-only ${MUSIC}
4read-only ${DOWNLOADS}
5read-only ${PICTURES}
6read-only ${DESKTOP}
diff --git a/test/fs/macro-whitelist.profile b/test/fs/macro-whitelist.profile
new file mode 100644
index 000000000..fed7f76fc
--- /dev/null
+++ b/test/fs/macro-whitelist.profile
@@ -0,0 +1,6 @@
1whitelist ${VIDEOS}
2whitelist ${DOCUMENTS}
3whitelist ${MUSIC}
4whitelist ${DOWNLOADS}
5whitelist ${PICTURES}
6whitelist ${DESKTOP}
diff --git a/test/fs/macro.exp b/test/fs/macro.exp
new file mode 100755
index 000000000..8080a8108
--- /dev/null
+++ b/test/fs/macro.exp
@@ -0,0 +1,174 @@
1#!/usr/bin/expect -f
2# This file is part of Firejail project
3# Copyright (C) 2014-2018 Firejail Authors
4# License GPL v2
5
6set timeout 10
7spawn $env(SHELL)
8match_max 100000
9
10
11send -- "firejail --profile=macro-whitelist.profile ls ~\r"
12expect {
13 timeout {puts "TESTING ERROR 0\n";exit}
14 "Child process initialized"
15}
16expect {
17 timeout {puts "TESTING ERROR 1\n";exit}
18 "Desktop"
19}
20expect {
21 timeout {puts "TESTING ERROR 2\n";exit}
22 "Documents"
23}
24expect {
25 timeout {puts "TESTING ERROR 3\n";exit}
26 "Downloads"
27}
28expect {
29 timeout {puts "TESTING ERROR 4\n";exit}
30 "Music"
31}
32expect {
33 timeout {puts "TESTING ERROR 5\n";exit}
34 "Pictures"
35}
36expect {
37 timeout {puts "TESTING ERROR 6\n";exit}
38 "Videos"
39}
40sleep 1
41
42send -- "firejail --profile=macro-blacklist.profile ls ~/Desktop\r"
43expect {
44 timeout {puts "TESTING ERROR 7\n";exit}
45 "Child process initialized"
46}
47expect {
48 timeout {puts "TESTING ERROR 8\n";exit}
49 "Permission denied"
50}
51sleep 1
52
53send -- "firejail --profile=macro-blacklist.profile ls ~/Documents\r"
54expect {
55 timeout {puts "TESTING ERROR 9n";exit}
56 "Child process initialized"
57}
58expect {
59 timeout {puts "TESTING ERROR 10\n";exit}
60 "Permission denied"
61}
62sleep 1
63
64send -- "firejail --profile=macro-blacklist.profile ls ~/Downloads\r"
65expect {
66 timeout {puts "TESTING ERROR 11n";exit}
67 "Child process initialized"
68}
69expect {
70 timeout {puts "TESTING ERROR 12n";exit}
71 "Permission denied"
72}
73sleep 1
74
75send -- "firejail --profile=macro-blacklist.profile ls ~/Music\r"
76expect {
77 timeout {puts "TESTING ERROR 13\n";exit}
78 "Child process initialized"
79}
80expect {
81 timeout {puts "TESTING ERROR 14\n";exit}
82 "Permission denied"
83}
84sleep 1
85
86send -- "firejail --profile=macro-blacklist.profile ls ~/Pictures\r"
87expect {
88 timeout {puts "TESTING ERROR 15\n";exit}
89 "Child process initialized"
90}
91expect {
92 timeout {puts "TESTING ERROR 16\n";exit}
93 "Permission denied"
94}
95sleep 1
96
97send -- "firejail --profile=macro-blacklist.profile ls ~/Videos\r"
98expect {
99 timeout {puts "TESTING ERROR 17\n";exit}
100 "Child process initialized"
101}
102expect {
103 timeout {puts "TESTING ERROR 18\n";exit}
104 "Permission denied"
105}
106sleep 1
107
108send -- "firejail --profile=macro-readonly.profile touch ~/Desktop/blablabla\r"
109expect {
110 timeout {puts "TESTING ERROR 19\n";exit}
111 "Child process initialized"
112}
113expect {
114 timeout {puts "TESTING ERROR 20\n";exit}
115 "Read-only file system"
116}
117sleep 1
118
119send -- "firejail --profile=macro-readonly.profile touch ~/Documents/blablabla\r"
120expect {
121 timeout {puts "TESTING ERROR 21\n";exit}
122 "Child process initialized"
123}
124expect {
125 timeout {puts "TESTING ERROR 22\n";exit}
126 "Read-only file system"
127}
128sleep 1
129
130send -- "firejail --profile=macro-readonly.profile touch ~/Downloads/blablabla\r"
131expect {
132 timeout {puts "TESTING ERROR 23\n";exit}
133 "Child process initialized"
134}
135expect {
136 timeout {puts "TESTING ERROR 24\n";exit}
137 "Read-only file system"
138}
139sleep 1
140
141send -- "firejail --profile=macro-readonly.profile touch ~/Music/blablabla\r"
142expect {
143 timeout {puts "TESTING ERROR 25\n";exit}
144 "Child process initialized"
145}
146expect {
147 timeout {puts "TESTING ERROR 26\n";exit}
148 "Read-only file system"
149}
150sleep 1
151
152send -- "firejail --profile=macro-readonly.profile touch ~/Pictures/blablabla\r"
153expect {
154 timeout {puts "TESTING ERROR 27\n";exit}
155 "Child process initialized"
156}
157expect {
158 timeout {puts "TESTING ERROR 28\n";exit}
159 "Read-only file system"
160}
161sleep 1
162
163send -- "firejail --profile=macro-readonly.profile touch ~/Videos/blablabla\r"
164expect {
165 timeout {puts "TESTING ERROR 29\n";exit}
166 "Child process initialized"
167}
168expect {
169 timeout {puts "TESTING ERROR 30\n";exit}
170 "Read-only file system"
171}
172sleep 1
173
174puts "\nall done\n"