diff options
author | netblue30 <netblue30@yahoo.com> | 2016-11-12 07:36:41 -0500 |
---|---|---|
committer | netblue30 <netblue30@yahoo.com> | 2016-11-12 07:36:41 -0500 |
commit | ca79ff961cc303670f1ccb8841495ddd7f17a76b (patch) | |
tree | 51de876c47e405afec28eed5562337782265eebe /test | |
parent | testing (diff) | |
download | firejail-ca79ff961cc303670f1ccb8841495ddd7f17a76b.tar.gz firejail-ca79ff961cc303670f1ccb8841495ddd7f17a76b.tar.zst firejail-ca79ff961cc303670f1ccb8841495ddd7f17a76b.zip |
testing
Diffstat (limited to 'test')
-rwxr-xr-x | test/overlay/fs-named.exp | 66 | ||||
-rwxr-xr-x | test/overlay/fs-tmpfs.exp | 62 | ||||
-rwxr-xr-x | test/overlay/overlay.sh | 12 | ||||
-rwxr-xr-x | test/root/firecfg.exp | 46 |
4 files changed, 185 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 | |||
3 | set timeout 10 | ||
4 | spawn $env(SHELL) | ||
5 | match_max 100000 | ||
6 | |||
7 | send -- "firejail --overlay-named=firejail-test\r" | ||
8 | expect { | ||
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 | } | ||
14 | sleep 1 | ||
15 | |||
16 | send -- "echo xyzxyzxyz > ~/_firejail_test_file; echo done\r" | ||
17 | expect { | ||
18 | timeout {puts "TESTING ERROR 3\n";exit} | ||
19 | "done" | ||
20 | } | ||
21 | after 100 | ||
22 | |||
23 | send -- "cat ~/_firejail_test_file; echo done\r" | ||
24 | expect { | ||
25 | timeout {puts "TESTING ERROR 4\n";exit} | ||
26 | "xyzxyzxyz" | ||
27 | } | ||
28 | expect { | ||
29 | timeout {puts "TESTING ERROR 4.1\n";exit} | ||
30 | "done" | ||
31 | } | ||
32 | after 100 | ||
33 | |||
34 | send -- "exit\r" | ||
35 | sleep 2 | ||
36 | |||
37 | send -- "cat ~/_firejail_test_file; echo done\r" | ||
38 | expect { | ||
39 | timeout {puts "TESTING ERROR 5\n";exit} | ||
40 | "xyzxyzxyz" {puts "TESTING ERROR 5.1\n";exit} | ||
41 | "done" | ||
42 | } | ||
43 | after 100 | ||
44 | |||
45 | send -- "firejail --overlay-named=firejail-test\r" | ||
46 | expect { | ||
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 | } | ||
52 | sleep 1 | ||
53 | |||
54 | send -- "cat ~/_firejail_test_file; echo done\r" | ||
55 | expect { | ||
56 | timeout {puts "TESTING ERROR 4\n";exit} | ||
57 | "xyzxyzxyz" | ||
58 | } | ||
59 | expect { | ||
60 | timeout {puts "TESTING ERROR 4.1\n";exit} | ||
61 | "done" | ||
62 | } | ||
63 | after 100 | ||
64 | |||
65 | puts "\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 | |||
3 | set timeout 10 | ||
4 | spawn $env(SHELL) | ||
5 | match_max 100000 | ||
6 | |||
7 | send -- "firejail --overlay-clean\r" | ||
8 | after 100 | ||
9 | send -- "file ~/.firejail\r" | ||
10 | expect { | ||
11 | timeout {puts "TESTING ERROR 0\n";exit} | ||
12 | "cannot open" | ||
13 | } | ||
14 | after 100 | ||
15 | |||
16 | send -- "firejail --overlay-tmpfs\r" | ||
17 | expect { | ||
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 | } | ||
23 | sleep 1 | ||
24 | |||
25 | send -- "echo xyzxyzxyz > ~/_firejail_test_file; echo done\r" | ||
26 | expect { | ||
27 | timeout {puts "TESTING ERROR 2\n";exit} | ||
28 | "done" | ||
29 | } | ||
30 | after 100 | ||
31 | |||
32 | send -- "cat ~/_firejail_test_file; echo done\r" | ||
33 | expect { | ||
34 | timeout {puts "TESTING ERROR 3\n";exit} | ||
35 | "xyzxyzxyz" | ||
36 | } | ||
37 | expect { | ||
38 | timeout {puts "TESTING ERROR 4\n";exit} | ||
39 | "done" | ||
40 | } | ||
41 | after 100 | ||
42 | |||
43 | send -- "exit\r" | ||
44 | sleep 1 | ||
45 | |||
46 | send -- "cat ~/_firejail_test_file; echo done\r" | ||
47 | expect { | ||
48 | timeout {puts "TESTING ERROR 5\n";exit} | ||
49 | "xyzxyzxyz" {puts "TESTING ERROR 6\n";exit} | ||
50 | "done" | ||
51 | } | ||
52 | after 100 | ||
53 | |||
54 | send -- "file ~/.firejail\r" | ||
55 | expect { | ||
56 | timeout {puts "TESTING ERROR 7\n";exit} | ||
57 | "cannot open" | ||
58 | } | ||
59 | after 100 | ||
60 | |||
61 | puts "\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 |
12 | rm -fr ~/_firejail_test_* | 12 | rm -fr ~/_firejail_test_* |
13 | 13 | ||
14 | echo "TESTING: overlay named fs (test/overlay/fs-named.exp)" | ||
15 | rm -fr ~/_firejail_test_* | ||
16 | ./fs-named.exp | ||
17 | rm -fr ~/_firejail_test_* | ||
18 | |||
19 | echo "TESTING: overlay tmpfs fs (test/overlay/fs-tmpfs.exp)" | ||
20 | rm -fr ~/_firejail_test_* | ||
21 | ./fs-tmpfs.exp | ||
22 | rm -fr ~/_firejail_test_* | ||
23 | |||
14 | which firefox | 24 | which firefox |
15 | if [ "$?" -eq 0 ]; | 25 | if [ "$?" -eq 0 ]; |
16 | then | 26 | then |
@@ -51,7 +61,7 @@ which firefox | |||
51 | if [ "$?" -eq 0 ]; | 61 | if [ "$?" -eq 0 ]; |
52 | then | 62 | then |
53 | echo "TESTING: overlay firefox x11" | 63 | echo "TESTING: overlay firefox x11" |
54 | ./firefox.exp | 64 | ./firefox-x11.exp |
55 | else | 65 | else |
56 | echo "TESTING SKIP: firefox not found" | 66 | echo "TESTING SKIP: firefox not found" |
57 | fi | 67 | fi |
diff --git a/test/root/firecfg.exp b/test/root/firecfg.exp new file mode 100755 index 000000000..b4864988d --- /dev/null +++ b/test/root/firecfg.exp | |||
@@ -0,0 +1,46 @@ | |||
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 | |||
6 | set timeout 10 | ||
7 | spawn $env(SHELL) | ||
8 | match_max 100000 | ||
9 | |||
10 | send -- "firecfg\r" | ||
11 | sleep 1 | ||
12 | |||
13 | send -- "firecfg --clean\r" | ||
14 | expect { | ||
15 | timeout {puts "TESTING ERROR 0\n";exit} | ||
16 | "/usr/local/bin/firefox removed" | ||
17 | } | ||
18 | after 100 | ||
19 | send -- "file /usr/local/bin/firefox; echo done\r" | ||
20 | expect { | ||
21 | timeout {puts "TESTING ERROR 1\n";exit} | ||
22 | "symbolic link to /usr/bin/firejail" {puts "TESTING ERROR 2\n";exit} | ||
23 | "done" | ||
24 | } | ||
25 | after 100 | ||
26 | |||
27 | send -- "firecfg\r" | ||
28 | expect { | ||
29 | timeout {puts "TESTING ERROR 3\n";exit} | ||
30 | "/usr/local/bin/firefox created" | ||
31 | } | ||
32 | after 100 | ||
33 | send -- "file /usr/local/bin/firefox\r" | ||
34 | expect { | ||
35 | timeout {puts "TESTING ERROR 4\n";exit} | ||
36 | "symbolic link to /usr/bin/firejail" | ||
37 | } | ||
38 | after 100 | ||
39 | |||
40 | send -- "firecfg --list\r" | ||
41 | expect { | ||
42 | timeout {puts "TESTING ERROR 5\n";exit} | ||
43 | "/usr/local/bin/firefox" | ||
44 | } | ||
45 | after 100 | ||
46 | puts "\nall done\n" | ||