summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorLibravatar netblue30 <netblue30@yahoo.com>2016-11-16 20:11:29 -0500
committerLibravatar netblue30 <netblue30@yahoo.com>2016-11-16 20:11:29 -0500
commitf233eee37465218ff2b8a7b8806f1d85ea757c70 (patch)
tree3cfa0efd5b7a3ae0e1d864e0f92487221d38badd /test
parentfcopy part 2 (diff)
downloadfirejail-f233eee37465218ff2b8a7b8806f1d85ea757c70.tar.gz
firejail-f233eee37465218ff2b8a7b8806f1d85ea757c70.tar.zst
firejail-f233eee37465218ff2b8a7b8806f1d85ea757c70.zip
testing
Diffstat (limited to 'test')
-rwxr-xr-xtest/fs/fs.sh13
-rwxr-xr-xtest/fs/fscheck-bindnoroot.exp (renamed from test/fscheck-bindnoroot.exp)5
-rwxr-xr-xtest/fs/fscheck-private.exp50
-rwxr-xr-xtest/fs/fscheck-readonly.exp (renamed from test/fscheck-readonly.exp)3
-rwxr-xr-xtest/fs/fscheck-tmpfs.exp (renamed from test/fscheck-tmpfs.exp)2
-rwxr-xr-xtest/fs/read-write.exp28
-rw-r--r--test/fs/testfile10
-rwxr-xr-xtest/fscheck-private.exp70
8 files changed, 75 insertions, 96 deletions
diff --git a/test/fs/fs.sh b/test/fs/fs.sh
index efbf505ee..1c5473f79 100755
--- a/test/fs/fs.sh
+++ b/test/fs/fs.sh
@@ -82,10 +82,21 @@ echo "TESTING: recursive mkdir (test/fs/mkdir.exp)"
82echo "TESTING: double whitelist (test/fs/whitelist-double.exp)" 82echo "TESTING: double whitelist (test/fs/whitelist-double.exp)"
83./whitelist-double.exp 83./whitelist-double.exp
84 84
85
86echo "TESTING: whitelist (test/fs/whitelist.exp)" 85echo "TESTING: whitelist (test/fs/whitelist.exp)"
87./whitelist.exp 86./whitelist.exp
88 87
88echo "TESTING: fscheck --bind non root (test/fs/fscheck-bindnoroot.exp)"
89./fscheck-bindnoroot.exp
90
91echo "TESTING: fscheck --tmpfs non root (test/fs/fscheck-tmpfs.exp)"
92./fscheck-tmpfs.exp
93
94echo "TESTING: fscheck --private= (test/fs/fscheck-private.exp)"
95./fscheck-private.exp
96
97echo "TESTING: fscheck --read-only= (test/fs/fscheck-readonly.exp)"
98./fscheck-readonly.exp
99
89#cleanup 100#cleanup
90rm -fr ~/fjtest-dir 101rm -fr ~/fjtest-dir
91rm -fr ~/fjtest-dir-lnk 102rm -fr ~/fjtest-dir-lnk
diff --git a/test/fscheck-bindnoroot.exp b/test/fs/fscheck-bindnoroot.exp
index 796a7d975..8cbe2b8af 100755
--- a/test/fscheck-bindnoroot.exp
+++ b/test/fs/fscheck-bindnoroot.exp
@@ -5,10 +5,13 @@ spawn $env(SHELL)
5match_max 100000 5match_max 100000
6 6
7# dir 7# dir
8send -- "firejail --net=br0 --bind=fscheck-dir,/etc\r" 8send -- "firejail --net=br0 --bind=testdir1,/etc\r"
9expect { 9expect {
10 timeout {puts "TESTING ERROR 0\n";exit} 10 timeout {puts "TESTING ERROR 0\n";exit}
11 "Error" 11 "Error"
12} 12}
13after 100 13after 100
14 14
15puts "\nall done\n"
16
17
diff --git a/test/fs/fscheck-private.exp b/test/fs/fscheck-private.exp
new file mode 100755
index 000000000..28c921538
--- /dev/null
+++ b/test/fs/fscheck-private.exp
@@ -0,0 +1,50 @@
1#!/usr/bin/expect -f
2
3set timeout 10
4spawn $env(SHELL)
5match_max 100000
6
7
8
9# file link
10#send -- "firejail --private=fscheck-file-link\r"
11#expect {
12# timeout {puts "TESTING ERROR 2\n";exit}
13# "Error"
14#}
15#after 100
16
17# file
18send -- "firejail --private=testfile1\r"
19expect {
20 timeout {puts "TESTING ERROR 2.1\n";exit}
21 "Error"
22}
23after 100
24
25# ..
26send -- "firejail --private=../fs/testfile1\r"
27expect {
28 timeout {puts "TESTING ERROR 2.2\n";exit}
29 "Error"
30}
31after 100
32
33# no file
34send -- "firejail --private=../test/nodir\r"
35expect {
36 timeout {puts "TESTING ERROR 3\n";exit}
37 "Error"
38}
39after 100
40
41# same owner
42send -- "firejail --private=/etc\r"
43expect {
44 timeout {puts "TESTING ERROR 4\n";exit}
45 "Error"
46}
47after 100
48
49puts "\nall done\n"
50
diff --git a/test/fscheck-readonly.exp b/test/fs/fscheck-readonly.exp
index e0f0a8a1d..4d7528e50 100755
--- a/test/fscheck-readonly.exp
+++ b/test/fs/fscheck-readonly.exp
@@ -5,10 +5,11 @@ spawn $env(SHELL)
5match_max 100000 5match_max 100000
6 6
7# dir 7# dir
8send -- "firejail --net=br0 --read-only=../test/fscheck-dir\r" 8send -- "firejail --read-only=../test/testdir1\r"
9expect { 9expect {
10 timeout {puts "TESTING ERROR 0\n";exit} 10 timeout {puts "TESTING ERROR 0\n";exit}
11 "Error" 11 "Error"
12} 12}
13after 100 13after 100
14 14
15puts "\nall done\n"
diff --git a/test/fscheck-tmpfs.exp b/test/fs/fscheck-tmpfs.exp
index d5bbccd96..deac5a631 100755
--- a/test/fscheck-tmpfs.exp
+++ b/test/fs/fscheck-tmpfs.exp
@@ -5,7 +5,7 @@ spawn $env(SHELL)
5match_max 100000 5match_max 100000
6 6
7# .. 7# ..
8send -- "firejail --net=br0 --tmpfs=../test/fscheck-dir\r" 8send -- "firejail --tmpfs=fscheck-dir\r"
9expect { 9expect {
10 timeout {puts "TESTING ERROR 0.1\n";exit} 10 timeout {puts "TESTING ERROR 0.1\n";exit}
11 "Error" 11 "Error"
diff --git a/test/fs/read-write.exp b/test/fs/read-write.exp
index 57986488e..19a915f66 100755
--- a/test/fs/read-write.exp
+++ b/test/fs/read-write.exp
@@ -15,37 +15,21 @@ expect {
15} 15}
16sleep 1 16sleep 1
17 17
18send -- "echo mytest >~/_firejail_test_dir/a;echo done\r" 18send -- "echo mytest > ~/_firejail_test_dir/a\r"
19expect { 19expect {
20 timeout {puts "TESTING ERROR 1\n";exit} 20 timeout {puts "TESTING ERROR 5\n";exit}
21 "done" 21 "Read-only file system"
22}
23after 100
24
25send -- "echo mytest >~/_firejail_test_dir/test1/b;echo done\r"
26expect {
27 timeout {puts "TESTING ERROR 2\n";exit}
28 "done"
29} 22}
30after 100 23after 100
31 24
32send -- "cat ~/_firejail_test_dir/a;echo done\r" 25send -- "echo mytest > ~/_firejail_test_dir/test1/b\r"
33expect { 26sleep 1
34 timeout {puts "TESTING ERROR 3\n";exit}
35 "mytest" {puts "TESTING ERROR 4\n";exit}
36 "done"
37}
38after 100
39 27
40send -- "cat ~/_firejail_test_dir/test1/b;echo done\r" 28send -- "cat ~/_firejail_test_dir/test1/b\r"
41expect { 29expect {
42 timeout {puts "TESTING ERROR 5\n";exit} 30 timeout {puts "TESTING ERROR 5\n";exit}
43 "mytest" 31 "mytest"
44} 32}
45expect {
46 timeout {puts "TESTING ERROR 6\n";exit}
47 "done"
48}
49 33
50after 100 34after 100
51puts "\nall done\n" 35puts "\nall done\n"
diff --git a/test/fs/testfile1 b/test/fs/testfile1
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/test/fs/testfile1
diff --git a/test/fscheck-private.exp b/test/fscheck-private.exp
deleted file mode 100755
index 8e485cc03..000000000
--- a/test/fscheck-private.exp
+++ /dev/null
@@ -1,70 +0,0 @@
1#!/usr/bin/expect -f
2
3set timeout 10
4spawn $env(SHELL)
5match_max 100000
6
7
8# ..
9#send -- "firejail --net=br0 --private=../test/fscheck-dir\r"
10#expect {
11# timeout {puts "TESTING ERROR 0.1\n";exit}
12# "Error"
13#}
14#after 100
15
16# dir link
17#send -- "firejail --net=br0 --private=fscheck-dir-link\r"
18#expect {
19# timeout {puts "TESTING ERROR 1\n";exit}
20# "Error"
21#}
22#after 100
23
24# ..
25#send -- "firejail --net=br0 --private=../test/fscheck-dir-link\r"
26#expect {
27# timeout {puts "TESTING ERROR 1.1\n";exit}
28# "Error"
29#}
30#after 100
31
32# file link
33send -- "firejail --net=br0 --private=fscheck-file-link\r"
34expect {
35 timeout {puts "TESTING ERROR 2\n";exit}
36 "Error"
37}
38after 100
39
40# file
41send -- "firejail --net=br0 --private=fscheck-file\r"
42expect {
43 timeout {puts "TESTING ERROR 2.1\n";exit}
44 "Error"
45}
46after 100
47
48# ..
49send -- "firejail --net=br0 --private=../test/fscheck-file\r"
50expect {
51 timeout {puts "TESTING ERROR 2.2\n";exit}
52 "Error"
53}
54after 100
55
56# no file
57send -- "firejail --net=br0 --private=../test/nodir\r"
58expect {
59 timeout {puts "TESTING ERROR 3\n";exit}
60 "Error"
61}
62after 100
63
64# same owner
65send -- "firejail --net=br0 --private=/etc\r"
66expect {
67 timeout {puts "TESTING ERROR 4\n";exit}
68 "Error"
69}
70after 100