aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rwxr-xr-xtest/appimage/appimage-args.exp97
-rwxr-xr-xtest/appimage/appimage.sh6
-rwxr-xr-xtest/fs/private-home-dir.exp62
3 files changed, 163 insertions, 2 deletions
diff --git a/test/appimage/appimage-args.exp b/test/appimage/appimage-args.exp
new file mode 100755
index 000000000..93dba69ad
--- /dev/null
+++ b/test/appimage/appimage-args.exp
@@ -0,0 +1,97 @@
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 -- "firejail --name=appimage-test --debug --appimage Leafpad-0.8.17-x86_64.AppImage testfile\r"
11expect {
12 timeout {puts "TESTING ERROR 1\n";exit}
13 "execvp argument 2"
14}
15expect {
16 timeout {puts "TESTING ERROR 2\n";exit}
17 "AppRun"
18}
19expect {
20 timeout {puts "TESTING ERROR 3\n";exit}
21 "testfile"
22}
23expect {
24 timeout {puts "TESTING ERROR 4\n";exit}
25 "Child process initialized"
26}
27sleep 2
28
29spawn $env(SHELL)
30send -- "firejail --list\r"
31expect {
32 timeout {puts "TESTING ERROR 5\n";exit}
33 ":firejail"
34}
35expect {
36 timeout {puts "TESTING ERROR 6\n";exit}
37 "appimage Leafpad"
38}
39after 100
40
41# grsecurity exit
42send -- "file /proc/sys/kernel/grsecurity\r"
43expect {
44 timeout {puts "TESTING ERROR - grsecurity detection\n";exit}
45 "grsecurity: directory" {puts "grsecurity present, exiting...\n";exit}
46 "cannot open" {puts "grsecurity not present\n"}
47}
48
49
50send -- "firejail --name=blablabla\r"
51expect {
52 timeout {puts "TESTING ERROR 7\n";exit}
53 "Child process initialized"
54}
55sleep 2
56
57spawn $env(SHELL)
58send -- "firemon --seccomp\r"
59expect {
60 timeout {puts "TESTING ERROR 8\n";exit}
61 "need to be root" {puts "/proc mounted as hidepid, exiting...\n"; exit}
62 "appimage Leafpad"
63}
64expect {
65 timeout {puts "TESTING ERROR 9 (seccomp)\n";exit}
66 "Seccomp: 2"
67}
68expect {
69 timeout {puts "TESTING ERROR 10\n";exit}
70 "name=blablabla"
71}
72after 100
73send -- "firemon --caps\r"
74expect {
75 timeout {puts "TESTING ERROR 11\n";exit}
76 "appimage Leafpad"
77}
78expect {
79 timeout {puts "TESTING ERROR 12\n";exit}
80 "CapBnd:"
81}
82expect {
83 timeout {puts "TESTING ERROR 13\n";exit}
84 "0000000000000000"
85}
86expect {
87 timeout {puts "TESTING ERROR 14\n";exit}
88 "name=blablabla"
89}
90after 100
91
92spawn $env(SHELL)
93send -- "firejail --shutdown=appimage-test\r"
94sleep 3
95
96puts "\nall done\n"
97
diff --git a/test/appimage/appimage.sh b/test/appimage/appimage.sh
index db221ec8a..bb646e189 100755
--- a/test/appimage/appimage.sh
+++ b/test/appimage/appimage.sh
@@ -13,4 +13,8 @@ echo "TESTING: AppImage v2 (test/appimage/appimage-v2.exp)"
13./appimage-v2.exp 13./appimage-v2.exp
14 14
15echo "TESTING: AppImage file name (test/appimage/filename.exp)"; 15echo "TESTING: AppImage file name (test/appimage/filename.exp)";
16./filename.exp \ No newline at end of file 16./filename.exp
17
18echo "TESTING: AppImage argsv1 (test/appimage/appimage-args.exp)"
19./appimage-args.exp
20
diff --git a/test/fs/private-home-dir.exp b/test/fs/private-home-dir.exp
index 5491be834..f85a939b1 100755
--- a/test/fs/private-home-dir.exp
+++ b/test/fs/private-home-dir.exp
@@ -21,6 +21,8 @@ if {[file exists ~/.Xauthority]} {
21 send -- "touch ~/.Xauthority\r" 21 send -- "touch ~/.Xauthority\r"
22} 22}
23after 100 23after 100
24send -- "rm -fr ~/_firejail_test_dir_\r"
25after 100
24send -- "mkdir ~/_firejail_test_dir_\r" 26send -- "mkdir ~/_firejail_test_dir_\r"
25sleep 1 27sleep 1
26 28
@@ -65,6 +67,64 @@ expect {
65 "private directory should be owned by the current user" 67 "private directory should be owned by the current user"
66} 68}
67sleep 1 69sleep 1
70send -- "mkdir ~/_firejail_test_dir_/test_dir_2\r"
71after 100
72send -- "touch ~/_firejail_test_dir_/test_dir_2/testfile\r"
73sleep 1
68 74
75send -- "firejail --debug --noprofile --blacklist=~/test_dir_2 --private=~/_firejail_test_dir_\r"
76expect {
77 timeout {puts "TESTING ERROR 6\n";exit}
78 "Not blacklist"
79}
80expect {
81 timeout {puts "TESTING ERROR 7\n";exit}
82 "test_dir_2"
83}
84expect {
85 timeout {puts "TESTING ERROR 8\n";exit}
86 "Child process initialized"
87}
88
89sleep 1
90
91send -- "find ~\r"
92expect {
93 timeout {puts "TESTING ERROR 9\n";exit}
94 "testfile"
95}
96after 100
97
98send -- "exit\r"
99sleep 1
100
101send -- "firejail --debug --noprofile --allow-private-blacklist --blacklist=~/test_dir_2 --private=~/_firejail_test_dir_\r"
102expect {
103 timeout {puts "TESTING ERROR 10\n";exit}
104 "Disable"
105}
106expect {
107 timeout {puts "TESTING ERROR 11\n";exit}
108 "test_dir_2"
109}
110expect {
111 timeout {puts "TESTING ERROR 12\n";exit}
112 "Child process initialized"
113}
114
115sleep 1
116
117send -- "ls ~/test_dir_2\r"
118expect {
119 timeout {puts "TESTING ERROR 13\n";exit}
120 "cannot open directory"
121}
122after 100
123
124send "exit\r"
125sleep 1
126
127send -- "rm -fr ~/_firejail_test_dir_\r"
128after 100
69 129
70puts "all done\n" 130puts "\nall done\n"