aboutsummaryrefslogtreecommitdiffstats
path: root/test/overlay
diff options
context:
space:
mode:
authorLibravatar netblue30 <netblue30@yahoo.com>2016-11-12 07:36:41 -0500
committerLibravatar netblue30 <netblue30@yahoo.com>2016-11-12 07:36:41 -0500
commitca79ff961cc303670f1ccb8841495ddd7f17a76b (patch)
tree51de876c47e405afec28eed5562337782265eebe /test/overlay
parenttesting (diff)
downloadfirejail-ca79ff961cc303670f1ccb8841495ddd7f17a76b.tar.gz
firejail-ca79ff961cc303670f1ccb8841495ddd7f17a76b.tar.zst
firejail-ca79ff961cc303670f1ccb8841495ddd7f17a76b.zip
testing
Diffstat (limited to 'test/overlay')
-rwxr-xr-xtest/overlay/fs-named.exp66
-rwxr-xr-xtest/overlay/fs-tmpfs.exp62
-rwxr-xr-xtest/overlay/overlay.sh12
3 files changed, 139 insertions, 1 deletions
diff --git a/test/overlay/fs-named.exp b/test/overlay/fs-named.exp
new file mode 100755
index 000000000..2ccb22bb1
--- /dev/null
+++ b/test/overlay/fs-named.exp
@@ -0,0 +1,66 @@
1#!/usr/bin/expect -f
2
3set timeout 10
4spawn $env(SHELL)
5match_max 100000
6
7send -- "firejail --overlay-named=firejail-test\r"
8expect {
9 timeout {puts "TESTING ERROR 2\n";exit}
10 "not available for kernels older than 3.18" {puts "\nTESTING: overlayfs not available\n"; exit}
11 "Error: --overlay option is not available on Grsecurity systems" {puts "\nTESTING: overlayfs not available\n"; exit}
12 "Child process initialized" {puts "found\n"}
13}
14sleep 1
15
16send -- "echo xyzxyzxyz > ~/_firejail_test_file; echo done\r"
17expect {
18 timeout {puts "TESTING ERROR 3\n";exit}
19 "done"
20}
21after 100
22
23send -- "cat ~/_firejail_test_file; echo done\r"
24expect {
25 timeout {puts "TESTING ERROR 4\n";exit}
26 "xyzxyzxyz"
27}
28expect {
29 timeout {puts "TESTING ERROR 4.1\n";exit}
30 "done"
31}
32after 100
33
34send -- "exit\r"
35sleep 2
36
37send -- "cat ~/_firejail_test_file; echo done\r"
38expect {
39 timeout {puts "TESTING ERROR 5\n";exit}
40 "xyzxyzxyz" {puts "TESTING ERROR 5.1\n";exit}
41 "done"
42}
43after 100
44
45send -- "firejail --overlay-named=firejail-test\r"
46expect {
47 timeout {puts "TESTING ERROR 2\n";exit}
48 "not available for kernels older than 3.18" {puts "\nTESTING: overlayfs not available\n"; exit}
49 "Error: --overlay option is not available on Grsecurity systems" {puts "\nTESTING: overlayfs not available\n"; exit}
50 "Child process initialized" {puts "found\n"}
51}
52sleep 1
53
54send -- "cat ~/_firejail_test_file; echo done\r"
55expect {
56 timeout {puts "TESTING ERROR 4\n";exit}
57 "xyzxyzxyz"
58}
59expect {
60 timeout {puts "TESTING ERROR 4.1\n";exit}
61 "done"
62}
63after 100
64
65puts "\nall done\n"
66
diff --git a/test/overlay/fs-tmpfs.exp b/test/overlay/fs-tmpfs.exp
new file mode 100755
index 000000000..658d16779
--- /dev/null
+++ b/test/overlay/fs-tmpfs.exp
@@ -0,0 +1,62 @@
1#!/usr/bin/expect -f
2
3set timeout 10
4spawn $env(SHELL)
5match_max 100000
6
7send -- "firejail --overlay-clean\r"
8after 100
9send -- "file ~/.firejail\r"
10expect {
11 timeout {puts "TESTING ERROR 0\n";exit}
12 "cannot open"
13}
14after 100
15
16send -- "firejail --overlay-tmpfs\r"
17expect {
18 timeout {puts "TESTING ERROR 1\n";exit}
19 "not available for kernels older than 3.18" {puts "\nTESTING: overlayfs not available\n"; exit}
20 "Error: --overlay option is not available on Grsecurity systems" {puts "\nTESTING: overlayfs not available\n"; exit}
21 "Child process initialized" {puts "found\n"}
22}
23sleep 1
24
25send -- "echo xyzxyzxyz > ~/_firejail_test_file; echo done\r"
26expect {
27 timeout {puts "TESTING ERROR 2\n";exit}
28 "done"
29}
30after 100
31
32send -- "cat ~/_firejail_test_file; echo done\r"
33expect {
34 timeout {puts "TESTING ERROR 3\n";exit}
35 "xyzxyzxyz"
36}
37expect {
38 timeout {puts "TESTING ERROR 4\n";exit}
39 "done"
40}
41after 100
42
43send -- "exit\r"
44sleep 1
45
46send -- "cat ~/_firejail_test_file; echo done\r"
47expect {
48 timeout {puts "TESTING ERROR 5\n";exit}
49 "xyzxyzxyz" {puts "TESTING ERROR 6\n";exit}
50 "done"
51}
52after 100
53
54send -- "file ~/.firejail\r"
55expect {
56 timeout {puts "TESTING ERROR 7\n";exit}
57 "cannot open"
58}
59after 100
60
61puts "\nall done\n"
62
diff --git a/test/overlay/overlay.sh b/test/overlay/overlay.sh
index 971adddfe..4c9ebe5b0 100755
--- a/test/overlay/overlay.sh
+++ b/test/overlay/overlay.sh
@@ -11,6 +11,16 @@ rm -fr ~/_firejail_test_*
11./fs.exp 11./fs.exp
12rm -fr ~/_firejail_test_* 12rm -fr ~/_firejail_test_*
13 13
14echo "TESTING: overlay named fs (test/overlay/fs-named.exp)"
15rm -fr ~/_firejail_test_*
16./fs-named.exp
17rm -fr ~/_firejail_test_*
18
19echo "TESTING: overlay tmpfs fs (test/overlay/fs-tmpfs.exp)"
20rm -fr ~/_firejail_test_*
21./fs-tmpfs.exp
22rm -fr ~/_firejail_test_*
23
14which firefox 24which firefox
15if [ "$?" -eq 0 ]; 25if [ "$?" -eq 0 ];
16then 26then
@@ -51,7 +61,7 @@ which firefox
51if [ "$?" -eq 0 ]; 61if [ "$?" -eq 0 ];
52then 62then
53 echo "TESTING: overlay firefox x11" 63 echo "TESTING: overlay firefox x11"
54 ./firefox.exp 64 ./firefox-x11.exp
55else 65else
56 echo "TESTING SKIP: firefox not found" 66 echo "TESTING SKIP: firefox not found"
57fi 67fi