aboutsummaryrefslogtreecommitdiffstats
path: root/test/fs
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/fs
parentfcopy part 2 (diff)
downloadfirejail-f233eee37465218ff2b8a7b8806f1d85ea757c70.tar.gz
firejail-f233eee37465218ff2b8a7b8806f1d85ea757c70.tar.zst
firejail-f233eee37465218ff2b8a7b8806f1d85ea757c70.zip
testing
Diffstat (limited to 'test/fs')
-rwxr-xr-xtest/fs/fs.sh13
-rwxr-xr-xtest/fs/fscheck-bindnoroot.exp17
-rwxr-xr-xtest/fs/fscheck-private.exp50
-rwxr-xr-xtest/fs/fscheck-readonly.exp15
-rwxr-xr-xtest/fs/fscheck-tmpfs.exp14
-rwxr-xr-xtest/fs/read-write.exp28
-rw-r--r--test/fs/testfile10
7 files changed, 114 insertions, 23 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/fs/fscheck-bindnoroot.exp b/test/fs/fscheck-bindnoroot.exp
new file mode 100755
index 000000000..8cbe2b8af
--- /dev/null
+++ b/test/fs/fscheck-bindnoroot.exp
@@ -0,0 +1,17 @@
1#!/usr/bin/expect -f
2
3set timeout 10
4spawn $env(SHELL)
5match_max 100000
6
7# dir
8send -- "firejail --net=br0 --bind=testdir1,/etc\r"
9expect {
10 timeout {puts "TESTING ERROR 0\n";exit}
11 "Error"
12}
13after 100
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/fs/fscheck-readonly.exp b/test/fs/fscheck-readonly.exp
new file mode 100755
index 000000000..4d7528e50
--- /dev/null
+++ b/test/fs/fscheck-readonly.exp
@@ -0,0 +1,15 @@
1#!/usr/bin/expect -f
2
3set timeout 10
4spawn $env(SHELL)
5match_max 100000
6
7# dir
8send -- "firejail --read-only=../test/testdir1\r"
9expect {
10 timeout {puts "TESTING ERROR 0\n";exit}
11 "Error"
12}
13after 100
14
15puts "\nall done\n"
diff --git a/test/fs/fscheck-tmpfs.exp b/test/fs/fscheck-tmpfs.exp
new file mode 100755
index 000000000..deac5a631
--- /dev/null
+++ b/test/fs/fscheck-tmpfs.exp
@@ -0,0 +1,14 @@
1#!/usr/bin/expect -f
2
3set timeout 10
4spawn $env(SHELL)
5match_max 100000
6
7# ..
8send -- "firejail --tmpfs=fscheck-dir\r"
9expect {
10 timeout {puts "TESTING ERROR 0.1\n";exit}
11 "Error"
12}
13after 100
14
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