aboutsummaryrefslogtreecommitdiffstats
path: root/test/fs
diff options
context:
space:
mode:
authorLibravatar netblue30 <netblue30@yahoo.com>2016-11-20 21:23:10 -0500
committerLibravatar netblue30 <netblue30@yahoo.com>2016-11-20 21:23:10 -0500
commit13ef7fba2bdf48319f68a7362779c41edae19651 (patch)
treea746c86a4a13a53243b6ba7d615cc4fdbdd74611 /test/fs
parentcaps testing (diff)
downloadfirejail-13ef7fba2bdf48319f68a7362779c41edae19651.tar.gz
firejail-13ef7fba2bdf48319f68a7362779c41edae19651.tar.zst
firejail-13ef7fba2bdf48319f68a7362779c41edae19651.zip
testing
Diffstat (limited to 'test/fs')
-rwxr-xr-xtest/fs/fs.sh3
-rw-r--r--test/fs/user-dirs.dirs15
-rwxr-xr-xtest/fs/whitelist-downloads.exp49
3 files changed, 67 insertions, 0 deletions
diff --git a/test/fs/fs.sh b/test/fs/fs.sh
index 1c5473f79..d9a425661 100755
--- a/test/fs/fs.sh
+++ b/test/fs/fs.sh
@@ -61,6 +61,9 @@ echo "TESTING: whitelist empty (test/fs/whitelist-empty.exp)"
61echo "TESTING: private whitelist (test/fs/private-whitelist.exp)" 61echo "TESTING: private whitelist (test/fs/private-whitelist.exp)"
62./private-whitelist.exp 62./private-whitelist.exp
63 63
64echo "TESTING: whitelist ~/Downloads (test/fs/whitelist-downloads.exp)"
65./whitelist-downloads.exp
66
64echo "TESTING: invalid filename (test/fs/invalid_filename.exp)" 67echo "TESTING: invalid filename (test/fs/invalid_filename.exp)"
65./invalid_filename.exp 68./invalid_filename.exp
66 69
diff --git a/test/fs/user-dirs.dirs b/test/fs/user-dirs.dirs
new file mode 100644
index 000000000..0d19da4e4
--- /dev/null
+++ b/test/fs/user-dirs.dirs
@@ -0,0 +1,15 @@
1# This file is written by xdg-user-dirs-update
2# If you want to change or add directories, just edit the line you're
3# interested in. All local changes will be retained on the next run
4# Format is XDG_xxx_DIR="$HOME/yyy", where yyy is a shell-escaped
5# homedir-relative path, or XDG_xxx_DIR="/yyy", where /yyy is an
6# absolute path. No other format is supported.
7#
8XDG_DESKTOP_DIR="$HOME/Desktop"
9XDG_DOWNLOAD_DIR="$HOME/Downloads"
10XDG_TEMPLATES_DIR="$HOME/Templates"
11XDG_PUBLICSHARE_DIR="$HOME/Public"
12XDG_DOCUMENTS_DIR="$HOME/Documents"
13XDG_MUSIC_DIR="$HOME/Music"
14XDG_PICTURES_DIR="$HOME/Pictures"
15XDG_VIDEOS_DIR="$HOME/Videos"
diff --git a/test/fs/whitelist-downloads.exp b/test/fs/whitelist-downloads.exp
new file mode 100755
index 000000000..6af318d2b
--- /dev/null
+++ b/test/fs/whitelist-downloads.exp
@@ -0,0 +1,49 @@
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 -- "cp user-dirs.dirs /tmp/.\r"
11after 100
12
13send -- "firejail --private --noprofile\r"
14expect {
15 timeout {puts "TESTING ERROR 0\n";exit}
16 "Child process initialized"
17}
18after 100
19
20send -- "firejail --force --profile=/etc/firejail/firefox.profile\r"
21expect {
22 timeout {puts "TESTING ERROR 1\n";exit}
23 "cannot whitelist Downloads directory"
24}
25expect {
26 timeout {puts "TESTING ERROR 2\n";exit}
27 "Child process initialized"
28}
29after 100
30
31send -- "exit\r"
32after 100
33
34send -- "cp /tmp/user-dirs.dirs ~/.config/.\r"
35after 100
36
37send -- "firejail --force --profile=/etc/firejail/firefox.profile\r"
38expect {
39 timeout {puts "TESTING ERROR 3\n";exit}
40 "cannot whitelist Downloads directory"
41}
42expect {
43 timeout {puts "TESTING ERROR 4\n";exit}
44 "Child process initialized"
45}
46after 100
47
48puts "\nall done\n"
49