diff options
Diffstat (limited to 'test')
45 files changed, 762 insertions, 119 deletions
diff --git a/test/appimage/appimage-v1.exp b/test/appimage/appimage-v1.exp index 503da2b9b..f1c1c10f5 100755 --- a/test/appimage/appimage-v1.exp +++ b/test/appimage/appimage-v1.exp | |||
@@ -7,7 +7,7 @@ set timeout 10 | |||
7 | spawn $env(SHELL) | 7 | spawn $env(SHELL) |
8 | match_max 100000 | 8 | match_max 100000 |
9 | 9 | ||
10 | send -- "firejail --name=appimage-test --appimage Leafpad-0.8.17-x86_64.AppImage\r" | 10 | send -- "firejail --name=appimage-test --debug --appimage Leafpad-0.8.17-x86_64.AppImage\r" |
11 | expect { | 11 | expect { |
12 | timeout {puts "TESTING ERROR 1\n";exit} | 12 | timeout {puts "TESTING ERROR 1\n";exit} |
13 | "Child process initialized" | 13 | "Child process initialized" |
diff --git a/test/appimage/appimage.sh b/test/appimage/appimage.sh index 6a73d0a7e..db221ec8a 100755 --- a/test/appimage/appimage.sh +++ b/test/appimage/appimage.sh | |||
@@ -10,5 +10,7 @@ echo "TESTING: AppImage v1 (test/appimage/appimage-v1.exp)" | |||
10 | ./appimage-v1.exp | 10 | ./appimage-v1.exp |
11 | 11 | ||
12 | echo "TESTING: AppImage v2 (test/appimage/appimage-v2.exp)" | 12 | echo "TESTING: AppImage v2 (test/appimage/appimage-v2.exp)" |
13 | ./appimage-v1.exp | 13 | ./appimage-v2.exp |
14 | 14 | ||
15 | echo "TESTING: AppImage file name (test/appimage/filename.exp)"; | ||
16 | ./filename.exp \ No newline at end of file | ||
diff --git a/test/appimage/filename.exp b/test/appimage/filename.exp new file mode 100755 index 000000000..ce8d70464 --- /dev/null +++ b/test/appimage/filename.exp | |||
@@ -0,0 +1,35 @@ | |||
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 -- "firejail --appimage \"bla;bla\"\r" | ||
11 | expect { | ||
12 | timeout {puts "TESTING ERROR 1\n";exit} | ||
13 | "is an invalid filename" | ||
14 | } | ||
15 | after 100 | ||
16 | |||
17 | send -- "firejail --appimage /etc/shadow\r" | ||
18 | expect { | ||
19 | timeout {puts "TESTING ERROR 2\n";exit} | ||
20 | "cannot access" | ||
21 | } | ||
22 | after 100 | ||
23 | |||
24 | send -- "firejail --appimage appimage.sh\r" | ||
25 | expect { | ||
26 | timeout {puts "TESTING ERROR 2\n";exit} | ||
27 | "Error mounting appimage" | ||
28 | } | ||
29 | after 100 | ||
30 | |||
31 | |||
32 | |||
33 | |||
34 | puts "\nall done\n" | ||
35 | |||
diff --git a/test/chroot-resolvconf.exp b/test/chroot/chroot-resolvconf.exp index 2d0da2fb0..2d0da2fb0 100755 --- a/test/chroot-resolvconf.exp +++ b/test/chroot/chroot-resolvconf.exp | |||
diff --git a/test/fs_chroot.exp b/test/chroot/fs_chroot.exp index aeb5669e1..aeb5669e1 100755 --- a/test/fs_chroot.exp +++ b/test/chroot/fs_chroot.exp | |||
diff --git a/test/environment/dns.exp b/test/environment/dns.exp index 6ffb124cf..a6a7171eb 100755 --- a/test/environment/dns.exp +++ b/test/environment/dns.exp | |||
@@ -22,9 +22,33 @@ expect { | |||
22 | timeout {puts "TESTING ERROR 1.2\n";exit} | 22 | timeout {puts "TESTING ERROR 1.2\n";exit} |
23 | "53" | 23 | "53" |
24 | } | 24 | } |
25 | |||
26 | after 100 | 25 | after 100 |
27 | 26 | ||
28 | send -- "rm index.html\r" | 27 | send -- "rm index.html\r" |
29 | after 100 | 28 | after 100 |
29 | send -- "exit\r" | ||
30 | sleep 1 | ||
31 | |||
32 | send -- "firejail --dns=8.8.4.4 --dns=8.8.8.8 --dns=4.2.2.1\r" | ||
33 | expect { | ||
34 | timeout {puts "TESTING ERROR 2.1\n";exit} | ||
35 | "Child process initialized" | ||
36 | } | ||
37 | sleep 1 | ||
38 | |||
39 | send -- "cat /etc/resolv.conf\r" | ||
40 | expect { | ||
41 | timeout {puts "TESTING ERROR 2.2\n";exit} | ||
42 | "nameserver 8.8.4.4" | ||
43 | } | ||
44 | expect { | ||
45 | timeout {puts "TESTING ERROR 2.3\n";exit} | ||
46 | "nameserver 8.8.8.8" | ||
47 | } | ||
48 | expect { | ||
49 | timeout {puts "TESTING ERROR 2.4\n";exit} | ||
50 | "nameserver 4.2.2.1" | ||
51 | } | ||
52 | after 100 | ||
53 | |||
30 | puts "\nall done\n" | 54 | puts "\nall done\n" |
diff --git a/test/environment/environment.sh b/test/environment/environment.sh index 5c4d49331..2bb5a249e 100755 --- a/test/environment/environment.sh +++ b/test/environment/environment.sh | |||
@@ -6,6 +6,7 @@ | |||
6 | export MALLOC_CHECK_=3 | 6 | export MALLOC_CHECK_=3 |
7 | export MALLOC_PERTURB_=$(($RANDOM % 255 + 1)) | 7 | export MALLOC_PERTURB_=$(($RANDOM % 255 + 1)) |
8 | 8 | ||
9 | |||
9 | echo "TESTING: DNS (test/environment/dns.exp)" | 10 | echo "TESTING: DNS (test/environment/dns.exp)" |
10 | ./dns.exp | 11 | ./dns.exp |
11 | 12 | ||
@@ -85,3 +86,28 @@ else | |||
85 | echo "TESTING SKIP: strace not found" | 86 | echo "TESTING SKIP: strace not found" |
86 | fi | 87 | fi |
87 | 88 | ||
89 | # to install ibus: | ||
90 | # $ sudo apt-get install ibus-table-array30 | ||
91 | # $ ibus-setup | ||
92 | |||
93 | find ~/.config/ibus/bus | grep unix-0 | ||
94 | if [ "$?" -eq 0 ]; | ||
95 | then | ||
96 | echo "TESTING: ibus (test/environment/ibus.exp)" | ||
97 | ./ibus.exp | ||
98 | else | ||
99 | echo "TESTING SKIP: ibus not configured" | ||
100 | fi | ||
101 | |||
102 | echo "TESTING: rlimit (test/rlimit/rlimit.exp)" | ||
103 | ./rlimit.exp | ||
104 | |||
105 | echo "TESTING: rlimit profile (test/rlimit/rlimit-profile.exp)" | ||
106 | ./rlimit-profile.exp | ||
107 | |||
108 | echo "TESTING: rlimit errors (test/rlimit/rlimit-bad.exp)" | ||
109 | ./rlimit-bad.exp | ||
110 | |||
111 | echo "TESTING: rlimit errors profile (test/rlimit/rlimit-bad-profile.exp)" | ||
112 | ./rlimit-bad-profile.exp | ||
113 | |||
diff --git a/test/environment/ibus.exp b/test/environment/ibus.exp new file mode 100755 index 000000000..4344011a6 --- /dev/null +++ b/test/environment/ibus.exp | |||
@@ -0,0 +1,28 @@ | |||
1 | #!/usr/bin/expect -f | ||
2 | |||
3 | set timeout 10 | ||
4 | cd /home | ||
5 | spawn $env(SHELL) | ||
6 | match_max 100000 | ||
7 | |||
8 | send -- "firejail\r" | ||
9 | expect { | ||
10 | timeout {puts "TESTING ERROR 0\n";exit} | ||
11 | "Child process initialized" | ||
12 | } | ||
13 | after 100 | ||
14 | |||
15 | send -- "env | grep IBUS\r" | ||
16 | expect { | ||
17 | timeout {puts "TESTING ERROR 1\n";exit} | ||
18 | "IBUS_ADDRESS" | ||
19 | } | ||
20 | expect { | ||
21 | timeout {puts "TESTING ERROR 2\n";exit} | ||
22 | "IBUS_DAEMON_PID" | ||
23 | } | ||
24 | after 100 | ||
25 | |||
26 | |||
27 | puts "\nall done\n" | ||
28 | |||
diff --git a/test/environment/rlimit-bad-profile.exp b/test/environment/rlimit-bad-profile.exp new file mode 100755 index 000000000..80693a4a0 --- /dev/null +++ b/test/environment/rlimit-bad-profile.exp | |||
@@ -0,0 +1,35 @@ | |||
1 | #!/usr/bin/expect -f | ||
2 | |||
3 | set timeout 10 | ||
4 | spawn $env(SHELL) | ||
5 | match_max 100000 | ||
6 | |||
7 | |||
8 | send -- "firejail --profile=rlimit-bad1.profile\r" | ||
9 | expect { | ||
10 | timeout {puts "TESTING ERROR 4\n";exit} | ||
11 | "Invalid rlimit option" | ||
12 | } | ||
13 | after 100 | ||
14 | |||
15 | send -- "firejail --profile=rlimit-bad2.profile\r" | ||
16 | expect { | ||
17 | timeout {puts "TESTING ERROR 5\n";exit} | ||
18 | "Invalid rlimit option" | ||
19 | } | ||
20 | after 100 | ||
21 | |||
22 | send -- "firejail --profile=rlimit-bad3.profile\r" | ||
23 | expect { | ||
24 | timeout {puts "TESTING ERROR 6\n";exit} | ||
25 | "Invalid rlimit option" | ||
26 | } | ||
27 | after 100 | ||
28 | send -- "firejail --profile=rlimit-bad4.profile\r" | ||
29 | expect { | ||
30 | timeout {puts "TESTING ERROR 7\n";exit} | ||
31 | "Invalid rlimit option" | ||
32 | } | ||
33 | after 100 | ||
34 | |||
35 | puts "\nall done\n" | ||
diff --git a/test/environment/rlimit-bad.exp b/test/environment/rlimit-bad.exp new file mode 100755 index 000000000..574e7e174 --- /dev/null +++ b/test/environment/rlimit-bad.exp | |||
@@ -0,0 +1,34 @@ | |||
1 | #!/usr/bin/expect -f | ||
2 | |||
3 | set timeout 10 | ||
4 | spawn $env(SHELL) | ||
5 | match_max 100000 | ||
6 | |||
7 | send -- "firejail --rlimit-fsize=-1024\r" | ||
8 | expect { | ||
9 | timeout {puts "TESTING ERROR 0\n";exit} | ||
10 | "invalid rlimt fsize" | ||
11 | } | ||
12 | after 100 | ||
13 | |||
14 | send -- "firejail --rlimit-nofile=asdf\r" | ||
15 | expect { | ||
16 | timeout {puts "TESTING ERROR 1\n";exit} | ||
17 | "invalid rlimt nofile" | ||
18 | } | ||
19 | after 100 | ||
20 | |||
21 | send -- "firejail --rlimit-nproc=100.23\r" | ||
22 | expect { | ||
23 | timeout {puts "TESTING ERROR 2\n";exit} | ||
24 | "invalid rlimt nproc" | ||
25 | } | ||
26 | after 100 | ||
27 | send -- "firejail --rlimit-sigpending=2345-78\r" | ||
28 | expect { | ||
29 | timeout {puts "TESTING ERROR 3\n";exit} | ||
30 | "invalid rlimt sigpending" | ||
31 | } | ||
32 | after 100 | ||
33 | |||
34 | puts "\nall done\n" | ||
diff --git a/test/environment/rlimit-bad1.profile b/test/environment/rlimit-bad1.profile new file mode 100644 index 000000000..b6d3340d8 --- /dev/null +++ b/test/environment/rlimit-bad1.profile | |||
@@ -0,0 +1 @@ | |||
rlimit-fsize -1024 | |||
diff --git a/test/environment/rlimit-bad2.profile b/test/environment/rlimit-bad2.profile new file mode 100644 index 000000000..ef3f243c6 --- /dev/null +++ b/test/environment/rlimit-bad2.profile | |||
@@ -0,0 +1 @@ | |||
rlimit-nofile asdf | |||
diff --git a/test/environment/rlimit-bad3.profile b/test/environment/rlimit-bad3.profile new file mode 100644 index 000000000..af016a29f --- /dev/null +++ b/test/environment/rlimit-bad3.profile | |||
@@ -0,0 +1 @@ | |||
rlimit-nproc 100.23 | |||
diff --git a/test/environment/rlimit-bad4.profile b/test/environment/rlimit-bad4.profile new file mode 100644 index 000000000..aabe3d008 --- /dev/null +++ b/test/environment/rlimit-bad4.profile | |||
@@ -0,0 +1 @@ | |||
rlimit-sigpending 67asd56 \ No newline at end of file | |||
diff --git a/test/rlimit/rlimit-profile.exp b/test/environment/rlimit-profile.exp index a9e54a405..a9e54a405 100755 --- a/test/rlimit/rlimit-profile.exp +++ b/test/environment/rlimit-profile.exp | |||
diff --git a/test/rlimit/rlimit.exp b/test/environment/rlimit.exp index 611f69821..611f69821 100755 --- a/test/rlimit/rlimit.exp +++ b/test/environment/rlimit.exp | |||
diff --git a/test/rlimit/rlimit.profile b/test/environment/rlimit.profile index 271891c03..271891c03 100644 --- a/test/rlimit/rlimit.profile +++ b/test/environment/rlimit.profile | |||
diff --git a/test/fcopy/cmdline.exp b/test/fcopy/cmdline.exp new file mode 100755 index 000000000..24bb19351 --- /dev/null +++ b/test/fcopy/cmdline.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 -- "/usr/lib/firejail/fcopy\r" | ||
11 | expect { | ||
12 | timeout {puts "TESTING ERROR 0\n";exit} | ||
13 | "files missing" | ||
14 | } | ||
15 | expect { | ||
16 | timeout {puts "TESTING ERROR 1\n";exit} | ||
17 | "Usage:" | ||
18 | } | ||
19 | after 100 | ||
20 | |||
21 | send -- "/usr/lib/firejail/fcopy foo\r" | ||
22 | expect { | ||
23 | timeout {puts "TESTING ERROR 2\n";exit} | ||
24 | "files missing" | ||
25 | } | ||
26 | expect { | ||
27 | timeout {puts "TESTING ERROR 3\n";exit} | ||
28 | "Usage:" | ||
29 | } | ||
30 | after 100 | ||
31 | |||
32 | send -- "/usr/lib/firejail/fcopy f%oo1 foo2\r" | ||
33 | expect { | ||
34 | timeout {puts "TESTING ERROR 4\n";exit} | ||
35 | "invalid file name" | ||
36 | } | ||
37 | after 100 | ||
38 | |||
39 | send -- "/usr/lib/firejail/fcopy foo1 f,oo2\r" | ||
40 | expect { | ||
41 | timeout {puts "TESTING ERROR 5\n";exit} | ||
42 | "invalid file name" | ||
43 | } | ||
44 | after 100 | ||
45 | |||
46 | puts "\nall done\n" | ||
diff --git a/test/fcopy/dircopy.exp b/test/fcopy/dircopy.exp new file mode 100755 index 000000000..00b0204ae --- /dev/null +++ b/test/fcopy/dircopy.exp | |||
@@ -0,0 +1,106 @@ | |||
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 | # | ||
7 | # copy directory src to dest | ||
8 | # | ||
9 | set timeout 10 | ||
10 | spawn $env(SHELL) | ||
11 | match_max 100000 | ||
12 | |||
13 | send -- "rm -fr dest/*\r" | ||
14 | after 100 | ||
15 | |||
16 | send -- "/usr/lib/firejail/fcopy src dest\r" | ||
17 | after 100 | ||
18 | |||
19 | send -- "find dest\r" | ||
20 | expect { | ||
21 | timeout {puts "TESTING ERROR 0\n";exit} | ||
22 | "dest/" | ||
23 | } | ||
24 | expect { | ||
25 | timeout {puts "TESTING ERROR 1\n";exit} | ||
26 | "dest/a" | ||
27 | } | ||
28 | expect { | ||
29 | timeout {puts "TESTING ERROR 2\n";exit} | ||
30 | "dest/a/b" | ||
31 | } | ||
32 | expect { | ||
33 | timeout {puts "TESTING ERROR 3\n";exit} | ||
34 | "dest/a/b/file4" | ||
35 | } | ||
36 | expect { | ||
37 | timeout {puts "TESTING ERROR 4\n";exit} | ||
38 | "dest/a/file3" | ||
39 | } | ||
40 | expect { | ||
41 | timeout {puts "TESTING ERROR 5\n";exit} | ||
42 | "dest/dircopy.exp" | ||
43 | } | ||
44 | expect { | ||
45 | timeout {puts "TESTING ERROR 6\n";exit} | ||
46 | "dest/file2" | ||
47 | } | ||
48 | expect { | ||
49 | timeout {puts "TESTING ERROR 7\n";exit} | ||
50 | "dest/file1" | ||
51 | } | ||
52 | after 100 | ||
53 | |||
54 | |||
55 | send -- "ls -al dest\r" | ||
56 | expect { | ||
57 | timeout {puts "TESTING ERROR 8\n";exit} | ||
58 | "drwxr-xr-x" | ||
59 | } | ||
60 | expect { | ||
61 | timeout {puts "TESTING ERROR 9\n";exit} | ||
62 | "a" | ||
63 | } | ||
64 | expect { | ||
65 | timeout {puts "TESTING ERROR 10\n";exit} | ||
66 | "lrwxrwxrwx" | ||
67 | } | ||
68 | expect { | ||
69 | timeout {puts "TESTING ERROR 11\n";exit} | ||
70 | "dircopy.exp" | ||
71 | } | ||
72 | expect { | ||
73 | timeout {puts "TESTING ERROR 12\n";exit} | ||
74 | "rwxr-xr-x" | ||
75 | } | ||
76 | expect { | ||
77 | timeout {puts "TESTING ERROR 13\n";exit} | ||
78 | "file1" | ||
79 | } | ||
80 | expect { | ||
81 | timeout {puts "TESTING ERROR 14\n";exit} | ||
82 | "rw-r--r--" | ||
83 | } | ||
84 | expect { | ||
85 | timeout {puts "TESTING ERROR 15\n";exit} | ||
86 | "file2" | ||
87 | } | ||
88 | after 100 | ||
89 | |||
90 | send -- "diff -q src/a/b/file4 dest/a/b/file4; echo done\r" | ||
91 | expect { | ||
92 | timeout {puts "TESTING ERROR 16\n";exit} | ||
93 | "differ" {puts "TESTING ERROR 17\n";exit} | ||
94 | "done" | ||
95 | } | ||
96 | |||
97 | send -- "file dest/dircopy.exp\r" | ||
98 | expect { | ||
99 | timeout {puts "TESTING ERROR 18\n";exit} | ||
100 | "symbolic link" | ||
101 | } | ||
102 | |||
103 | send -- "rm -fr dest/*\r" | ||
104 | after 100 | ||
105 | |||
106 | puts "\nall done\n" | ||
diff --git a/test/fcopy/fcopy.sh b/test/fcopy/fcopy.sh new file mode 100755 index 000000000..dcda5ca31 --- /dev/null +++ b/test/fcopy/fcopy.sh | |||
@@ -0,0 +1,23 @@ | |||
1 | #!/bin/bash | ||
2 | # This file is part of Firejail project | ||
3 | # Copyright (C) 2014-2016 Firejail Authors | ||
4 | # License GPL v2 | ||
5 | |||
6 | export MALLOC_CHECK_=3 | ||
7 | export MALLOC_PERTURB_=$(($RANDOM % 255 + 1)) | ||
8 | |||
9 | mkdir dest | ||
10 | |||
11 | echo "TESTING: fcopy cmdline (test/fcopy/cmdline.exp)" | ||
12 | ./cmdline.exp | ||
13 | |||
14 | echo "TESTING: fcopy directory (test/fcopy/dircopy.exp)" | ||
15 | ./dircopy.exp | ||
16 | |||
17 | echo "TESTING: fcopy file (test/fcopy/filecopy.exp)" | ||
18 | ./filecopy.exp | ||
19 | |||
20 | echo "TESTING: fcopy link (test/fcopy/linkcopy.exp)" | ||
21 | ./linkcopy.exp | ||
22 | |||
23 | rm -fr dest/* | ||
diff --git a/test/fcopy/filecopy.exp b/test/fcopy/filecopy.exp new file mode 100755 index 000000000..d1f0a4424 --- /dev/null +++ b/test/fcopy/filecopy.exp | |||
@@ -0,0 +1,54 @@ | |||
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 | # | ||
7 | # copy directory src to dest | ||
8 | # | ||
9 | set timeout 10 | ||
10 | spawn $env(SHELL) | ||
11 | match_max 100000 | ||
12 | |||
13 | send -- "rm -fr dest/*\r" | ||
14 | after 100 | ||
15 | |||
16 | send -- "/usr/lib/firejail/fcopy dircopy.exp dest\r" | ||
17 | after 100 | ||
18 | |||
19 | send -- "find dest\r" | ||
20 | expect { | ||
21 | timeout {puts "TESTING ERROR 0\n";exit} | ||
22 | "dest/" | ||
23 | } | ||
24 | expect { | ||
25 | timeout {puts "TESTING ERROR 1\n";exit} | ||
26 | "dest/dircopy.exp" | ||
27 | } | ||
28 | after 100 | ||
29 | |||
30 | |||
31 | send -- "ls -al dest\r" | ||
32 | expect { | ||
33 | timeout {puts "TESTING ERROR 2\n";exit} | ||
34 | "rwxr-xr-x" | ||
35 | } | ||
36 | after 100 | ||
37 | |||
38 | send -- "diff -q dircopy.exp dest/dircopy.exp; echo done\r" | ||
39 | expect { | ||
40 | timeout {puts "TESTING ERROR 3\n";exit} | ||
41 | "differ" {puts "TESTING ERROR 4\n";exit} | ||
42 | "done" | ||
43 | } | ||
44 | |||
45 | send -- "file dest/dircopy.exp\r" | ||
46 | expect { | ||
47 | timeout {puts "TESTING ERROR 5\n";exit} | ||
48 | "ASCII text" | ||
49 | } | ||
50 | |||
51 | send -- "rm -fr dest/*\r" | ||
52 | after 100 | ||
53 | |||
54 | puts "\nall done\n" | ||
diff --git a/test/fcopy/linkcopy.exp b/test/fcopy/linkcopy.exp new file mode 100755 index 000000000..9927e18fe --- /dev/null +++ b/test/fcopy/linkcopy.exp | |||
@@ -0,0 +1,54 @@ | |||
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 | # | ||
7 | # copy directory src to dest | ||
8 | # | ||
9 | set timeout 10 | ||
10 | spawn $env(SHELL) | ||
11 | match_max 100000 | ||
12 | |||
13 | send -- "rm -fr dest/*\r" | ||
14 | after 100 | ||
15 | |||
16 | send -- "/usr/lib/firejail/fcopy src/dircopy.exp dest\r" | ||
17 | after 100 | ||
18 | |||
19 | send -- "find dest\r" | ||
20 | expect { | ||
21 | timeout {puts "TESTING ERROR 0\n";exit} | ||
22 | "dest/" | ||
23 | } | ||
24 | expect { | ||
25 | timeout {puts "TESTING ERROR 1\n";exit} | ||
26 | "dest/dircopy.exp" | ||
27 | } | ||
28 | after 100 | ||
29 | |||
30 | |||
31 | send -- "ls -al dest\r" | ||
32 | expect { | ||
33 | timeout {puts "TESTING ERROR 2\n";exit} | ||
34 | "lrwxrwxrwx" | ||
35 | } | ||
36 | after 100 | ||
37 | |||
38 | send -- "diff -q dircopy.exp dest/dircopy.exp; echo done\r" | ||
39 | expect { | ||
40 | timeout {puts "TESTING ERROR 3\n";exit} | ||
41 | "differ" {puts "TESTING ERROR 4\n";exit} | ||
42 | "done" | ||
43 | } | ||
44 | |||
45 | send -- "file dest/dircopy.exp\r" | ||
46 | expect { | ||
47 | timeout {puts "TESTING ERROR 5\n";exit} | ||
48 | "symbolic link" | ||
49 | } | ||
50 | |||
51 | send -- "rm -fr dest/*\r" | ||
52 | after 100 | ||
53 | |||
54 | puts "\nall done\n" | ||
diff --git a/test/fcopy/src/a/b/file4 b/test/fcopy/src/a/b/file4 new file mode 100644 index 000000000..ac318d7ab --- /dev/null +++ b/test/fcopy/src/a/b/file4 | |||
@@ -0,0 +1,11 @@ | |||
1 | |||
2 | |||
3 | Lorem ipsum dolor sit amet, consectetur adipiscing elit. Etiam interdum at massa non aliquam. Maecenas molestie id orci volutpat porta. Praesent aliquam nunc quis mi tristique, ac feugiat enim rutrum. Nulla vitae metus sodales, pellentesque risus sit amet, volutpat nisl. Curabitur accumsan arcu congue lacus porta laoreet. Nulla facilisi. Integer nec augue id magna gravida tincidunt id vitae lorem. Curabitur facilisis, tellus vel pellentesque pretium, odio dolor efficitur lorem, et tincidunt dui enim cursus lacus. Cras a orci ac magna semper dapibus nec et velit. Nullam aliquam sollicitudin auctor. | ||
4 | |||
5 | Mauris ac quam vel purus volutpat semper eget a ante. Curabitur arcu nisl, dapibus ac lectus ac, porttitor fermentum metus. Aliquam et sem aliquam magna interdum ultricies at eu orci. Aenean tortor augue, volutpat nec magna nec, rutrum bibendum justo. Vivamus ex quam, auctor ut pellentesque mattis, aliquet a eros. Etiam ac lacus ac ante ullamcorper sollicitudin a quis orci. Suspendisse quis justo ac mauris cursus finibus quis at elit. Vestibulum elementum finibus diam, eget convallis purus aliquet et. Fusce fermentum ornare urna, non ornare nisl tincidunt consectetur. Donec et lacus vitae ex eleifend porttitor id ut odio. Quisque luctus eget lorem et sollicitudin. | ||
6 | |||
7 | Aliquam libero elit, finibus a nisl a, commodo viverra turpis. Nam pulvinar in est sit amet fermentum. Praesent scelerisque tempus lectus, ac porta elit sodales rutrum. Duis faucibus faucibus urna eget accumsan. Vivamus in turpis ut massa rhoncus pretium nec et lorem. Aenean at tellus eget metus porta ornare. Aliquam erat volutpat. Donec hendrerit a massa vel malesuada. Integer varius sapien et orci viverra pretium. In at velit aliquet, vulputate nisi lobortis, aliquam augue. | ||
8 | |||
9 | Ut aliquam turpis ut lorem aliquam, in faucibus elit pulvinar. Vivamus viverra tortor ornare, lacinia leo sit amet, auctor arcu. Sed erat leo, pellentesque vel nibh a, malesuada vehicula purus. Vivamus est dolor, aliquet quis facilisis fermentum, varius in dolor. Nunc quis libero feugiat, imperdiet est vitae, mollis risus. Vestibulum elementum mattis lorem vitae gravida. Nullam id tellus interdum, aliquam erat eu, laoreet nunc. Aliquam ut felis vel mauris maximus pellentesque. | ||
10 | |||
11 | Vestibulum tempus mauris eget ex interdum, vitae vehicula tortor sollicitudin. Pellentesque et dolor cursus dui vulputate laoreet. Morbi eu bibendum quam, at ultrices elit. Vestibulum dictum enim sit amet ultricies imperdiet. Praesent congue magna ac mauris mattis, a iaculis ante aliquet. Vivamus at egestas ex. Suspendisse orci dolor, pharetra at aliquam a, faucibus facilisis leo. Quisque semper lorem eget elit commodo pretium. Aenean posuere augue quis arcu finibus, sit amet fringilla risus congue. Pellentesque rutrum nunc leo, aliquam lobortis lacus molestie nec. Donec convallis congue diam, ullamcorper vestibulum dui varius nec. Praesent pellentesque nisi risus. In aliquam molestie malesuada. Nulla facilisis a risus eu tristique. Morbi molestie et arcu quis efficitur. Curabitur cursus vestibulum luctus. | ||
diff --git a/test/fcopy/src/a/file3 b/test/fcopy/src/a/file3 new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/test/fcopy/src/a/file3 | |||
diff --git a/test/fcopy/src/dircopy.exp b/test/fcopy/src/dircopy.exp new file mode 120000 index 000000000..2acf88f7b --- /dev/null +++ b/test/fcopy/src/dircopy.exp | |||
@@ -0,0 +1 @@ | |||
../dircopy.exp \ No newline at end of file | |||
diff --git a/test/fcopy/src/file1 b/test/fcopy/src/file1 new file mode 100755 index 000000000..e69de29bb --- /dev/null +++ b/test/fcopy/src/file1 | |||
diff --git a/test/fcopy/src/file2 b/test/fcopy/src/file2 new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/test/fcopy/src/file2 | |||
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)" | |||
82 | echo "TESTING: double whitelist (test/fs/whitelist-double.exp)" | 82 | echo "TESTING: double whitelist (test/fs/whitelist-double.exp)" |
83 | ./whitelist-double.exp | 83 | ./whitelist-double.exp |
84 | 84 | ||
85 | |||
86 | echo "TESTING: whitelist (test/fs/whitelist.exp)" | 85 | echo "TESTING: whitelist (test/fs/whitelist.exp)" |
87 | ./whitelist.exp | 86 | ./whitelist.exp |
88 | 87 | ||
88 | echo "TESTING: fscheck --bind non root (test/fs/fscheck-bindnoroot.exp)" | ||
89 | ./fscheck-bindnoroot.exp | ||
90 | |||
91 | echo "TESTING: fscheck --tmpfs non root (test/fs/fscheck-tmpfs.exp)" | ||
92 | ./fscheck-tmpfs.exp | ||
93 | |||
94 | echo "TESTING: fscheck --private= (test/fs/fscheck-private.exp)" | ||
95 | ./fscheck-private.exp | ||
96 | |||
97 | echo "TESTING: fscheck --read-only= (test/fs/fscheck-readonly.exp)" | ||
98 | ./fscheck-readonly.exp | ||
99 | |||
89 | #cleanup | 100 | #cleanup |
90 | rm -fr ~/fjtest-dir | 101 | rm -fr ~/fjtest-dir |
91 | rm -fr ~/fjtest-dir-lnk | 102 | rm -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) | |||
5 | match_max 100000 | 5 | match_max 100000 |
6 | 6 | ||
7 | # dir | 7 | # dir |
8 | send -- "firejail --net=br0 --bind=fscheck-dir,/etc\r" | 8 | send -- "firejail --net=br0 --bind=testdir1,/etc\r" |
9 | expect { | 9 | expect { |
10 | timeout {puts "TESTING ERROR 0\n";exit} | 10 | timeout {puts "TESTING ERROR 0\n";exit} |
11 | "Error" | 11 | "Error" |
12 | } | 12 | } |
13 | after 100 | 13 | after 100 |
14 | 14 | ||
15 | puts "\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 | |||
3 | set timeout 10 | ||
4 | spawn $env(SHELL) | ||
5 | match_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 | ||
18 | send -- "firejail --private=testfile1\r" | ||
19 | expect { | ||
20 | timeout {puts "TESTING ERROR 2.1\n";exit} | ||
21 | "Error" | ||
22 | } | ||
23 | after 100 | ||
24 | |||
25 | # .. | ||
26 | send -- "firejail --private=../fs/testfile1\r" | ||
27 | expect { | ||
28 | timeout {puts "TESTING ERROR 2.2\n";exit} | ||
29 | "Error" | ||
30 | } | ||
31 | after 100 | ||
32 | |||
33 | # no file | ||
34 | send -- "firejail --private=../test/nodir\r" | ||
35 | expect { | ||
36 | timeout {puts "TESTING ERROR 3\n";exit} | ||
37 | "Error" | ||
38 | } | ||
39 | after 100 | ||
40 | |||
41 | # same owner | ||
42 | send -- "firejail --private=/etc\r" | ||
43 | expect { | ||
44 | timeout {puts "TESTING ERROR 4\n";exit} | ||
45 | "Error" | ||
46 | } | ||
47 | after 100 | ||
48 | |||
49 | puts "\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) | |||
5 | match_max 100000 | 5 | match_max 100000 |
6 | 6 | ||
7 | # dir | 7 | # dir |
8 | send -- "firejail --net=br0 --read-only=../test/fscheck-dir\r" | 8 | send -- "firejail --read-only=../test/testdir1\r" |
9 | expect { | 9 | expect { |
10 | timeout {puts "TESTING ERROR 0\n";exit} | 10 | timeout {puts "TESTING ERROR 0\n";exit} |
11 | "Error" | 11 | "Error" |
12 | } | 12 | } |
13 | after 100 | 13 | after 100 |
14 | 14 | ||
15 | puts "\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) | |||
5 | match_max 100000 | 5 | match_max 100000 |
6 | 6 | ||
7 | # .. | 7 | # .. |
8 | send -- "firejail --net=br0 --tmpfs=../test/fscheck-dir\r" | 8 | send -- "firejail --tmpfs=fscheck-dir\r" |
9 | expect { | 9 | expect { |
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/invalid_filename.exp b/test/fs/invalid_filename.exp index 1acc85491..a6efc24b6 100755 --- a/test/fs/invalid_filename.exp +++ b/test/fs/invalid_filename.exp | |||
@@ -109,6 +109,21 @@ expect { | |||
109 | } | 109 | } |
110 | after 100 | 110 | after 100 |
111 | 111 | ||
112 | send -- "firejail --debug-check-filename --noprofile --private-home=\"bla&&bla\"\r" | ||
113 | expect { | ||
114 | timeout {puts "TESTING ERROR 8.1\n";exit} | ||
115 | "Checking filename bla&&bla" | ||
116 | } | ||
117 | expect { | ||
118 | timeout {puts "TESTING ERROR 8.2\n";exit} | ||
119 | "Error:" | ||
120 | } | ||
121 | expect { | ||
122 | timeout {puts "TESTING ERROR 8.3\n";exit} | ||
123 | "is an invalid filename" | ||
124 | } | ||
125 | after 100 | ||
126 | |||
112 | send -- "firejail --debug-check-filename --noprofile --private-etc=\"bla&&bla\"\r" | 127 | send -- "firejail --debug-check-filename --noprofile --private-etc=\"bla&&bla\"\r" |
113 | expect { | 128 | expect { |
114 | timeout {puts "TESTING ERROR 9.1\n";exit} | 129 | timeout {puts "TESTING ERROR 9.1\n";exit} |
diff --git a/test/fs/private-bin.exp b/test/fs/private-bin.exp index fe9468be9..f7181d218 100755 --- a/test/fs/private-bin.exp +++ b/test/fs/private-bin.exp | |||
@@ -65,6 +65,28 @@ expect { | |||
65 | "sh" | 65 | "sh" |
66 | } | 66 | } |
67 | send -- "exit\r" | 67 | send -- "exit\r" |
68 | after 100 | ||
69 | |||
70 | |||
71 | send -- "firejail --private-bin=/etc/shadow\r" | ||
72 | expect { | ||
73 | timeout {puts "TESTING ERROR 8\n";exit} | ||
74 | "invalid filename" | ||
75 | } | ||
76 | after 100 | ||
77 | |||
78 | send -- "firejail --private-bin=\"bla;bla\"\r" | ||
79 | expect { | ||
80 | timeout {puts "TESTING ERROR 9\n";exit} | ||
81 | "is an invalid filename" | ||
82 | } | ||
83 | after 100 | ||
84 | |||
85 | send -- "firejail --private-etc=../bin/ls\r" | ||
86 | expect { | ||
87 | timeout {puts "TESTING ERROR 10\n";exit} | ||
88 | "is an invalid filename" | ||
89 | } | ||
68 | 90 | ||
69 | after 100 | 91 | after 100 |
70 | puts "\nall done\n" | 92 | puts "\nall done\n" |
diff --git a/test/fs/private-etc.exp b/test/fs/private-etc.exp index e692f7382..36b5d247c 100755 --- a/test/fs/private-etc.exp +++ b/test/fs/private-etc.exp | |||
@@ -33,12 +33,40 @@ expect { | |||
33 | "resolv.conf" | 33 | "resolv.conf" |
34 | } | 34 | } |
35 | 35 | ||
36 | send -- "ls -al /etc; echo done\r" | 36 | |
37 | send -- "file /etc/shadow\r" | ||
37 | expect { | 38 | expect { |
38 | timeout {puts "TESTING ERROR 7\n";exit} | 39 | timeout {puts "TESTING ERROR 7\n";exit} |
39 | "shadow" {puts "TESTING ERROR 8\n";exit} | 40 | "No such file or directory" |
40 | "done" | 41 | } |
42 | after 100 | ||
43 | send -- "exit\r" | ||
44 | sleep 1 | ||
45 | |||
46 | send -- "firejail --private-etc=shadow\r" | ||
47 | expect { | ||
48 | timeout {puts "TESTING ERROR 8\n";exit} | ||
49 | "invalid file type" | ||
50 | } | ||
51 | after 100 | ||
52 | |||
53 | send -- "firejail --private-etc=\"bla;bla\"\r" | ||
54 | expect { | ||
55 | timeout {puts "TESTING ERROR 9\n";exit} | ||
56 | "is an invalid filename" | ||
41 | } | 57 | } |
58 | after 100 | ||
59 | |||
60 | send -- "firejail --private-etc=../bin/ls\r" | ||
61 | expect { | ||
62 | timeout {puts "TESTING ERROR 10\n";exit} | ||
63 | "is an invalid filename" | ||
64 | } | ||
65 | after 100 | ||
66 | |||
67 | |||
68 | |||
69 | |||
42 | 70 | ||
43 | after 100 | 71 | after 100 |
44 | puts "\nall done\n" | 72 | puts "\nall done\n" |
diff --git a/test/fs/private-home.exp b/test/fs/private-home.exp index de5a88dea..3840d1cb8 100755 --- a/test/fs/private-home.exp +++ b/test/fs/private-home.exp | |||
@@ -9,11 +9,19 @@ match_max 100000 | |||
9 | 9 | ||
10 | # create some test files in user home directory | 10 | # create some test files in user home directory |
11 | send -- "touch ~/_firejail_test_file1\r" | 11 | send -- "touch ~/_firejail_test_file1\r" |
12 | after 100 | ||
12 | send -- "touch ~/_firejail_test_file2\r" | 13 | send -- "touch ~/_firejail_test_file2\r" |
14 | after 100 | ||
13 | send -- "mkdir ~/_firejail_test_dir1\r" | 15 | send -- "mkdir ~/_firejail_test_dir1\r" |
16 | after 100 | ||
14 | send -- "mkdir ~/_firejail_test_dir1/_firejail_test_dir2\r" | 17 | send -- "mkdir ~/_firejail_test_dir1/_firejail_test_dir2\r" |
18 | after 100 | ||
15 | send -- "touch ~/_firejail_test_dir1/_firejail_test_dir2/_firejail_test_file3\r" | 19 | send -- "touch ~/_firejail_test_dir1/_firejail_test_dir2/_firejail_test_file3\r" |
16 | after 100 | 20 | after 100 |
21 | send -- "ln -s /etc ~/_firejail_test_link1\r" | ||
22 | after 100 | ||
23 | send -- "ln -s ~/_firejail_test_dir1 ~/_firejail_test_link2\r" | ||
24 | after 100 | ||
17 | 25 | ||
18 | send -- "firejail --private-home=_firejail_test_file1,_firejail_test_file2,_firejail_test_dir1\r" | 26 | send -- "firejail --private-home=_firejail_test_file1,_firejail_test_file2,_firejail_test_dir1\r" |
19 | expect { | 27 | expect { |
@@ -37,8 +45,58 @@ expect { | |||
37 | } | 45 | } |
38 | after 100 | 46 | after 100 |
39 | 47 | ||
40 | send -- "rm -f ~/_firejail_test_file*\r" | 48 | send -- "exit\r" |
41 | send -- "rm -fr ~/_firejail_test_dir*\r" | 49 | sleep 1 |
50 | |||
51 | send -- "firejail --private-home=\"bla;bla\"\r" | ||
52 | expect { | ||
53 | timeout {puts "TESTING ERROR 5\n";exit} | ||
54 | "is an invalid filename" | ||
55 | } | ||
56 | after 100 | ||
57 | |||
58 | send -- "firejail --private-home=/etc/shadow\r" | ||
59 | expect { | ||
60 | timeout {puts "TESTING ERROR 6\n";exit} | ||
61 | "invalid file" | ||
62 | } | ||
63 | after 100 | ||
64 | |||
65 | send -- "firejail --private-home=/etc/passwd\r" | ||
66 | expect { | ||
67 | timeout {puts "TESTING ERROR 7\n";exit} | ||
68 | "invalid file" | ||
69 | } | ||
70 | after 100 | ||
71 | |||
72 | send -- "firejail --private-home=../../etc/passwd\r" | ||
73 | expect { | ||
74 | timeout {puts "TESTING ERROR 8\n";exit} | ||
75 | "invalid file" | ||
76 | } | ||
77 | after 100 | ||
78 | |||
79 | send -- "firejail --private-home=_firejail_test_link1\r" | ||
80 | expect { | ||
81 | timeout {puts "TESTING ERROR 9\n";exit} | ||
82 | "to file or directory not owned by the user" | ||
83 | } | ||
84 | after 100 | ||
85 | |||
86 | send -- "firejail --private-home=_firejail_test_link2\r" | ||
87 | expect { | ||
88 | timeout {puts "TESTING ERROR 10\n";exit} | ||
89 | "Child process initialized" | ||
90 | } | ||
91 | after 100 | ||
92 | send -- "file file ~/_firejail_test_link2\r" | ||
93 | expect { | ||
94 | timeout {puts "TESTING ERROR 11\n";exit} | ||
95 | "broken symbolic link" | ||
96 | } | ||
97 | send -- "exit\r" | ||
98 | |||
99 | send -- "rm -f ~/_firejail_test*\r" | ||
42 | after 100 | 100 | after 100 |
43 | 101 | ||
44 | puts "\nall done\n" | 102 | puts "\nall done\n" |
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 | } |
16 | sleep 1 | 16 | sleep 1 |
17 | 17 | ||
18 | send -- "echo mytest >~/_firejail_test_dir/a;echo done\r" | 18 | send -- "echo mytest > ~/_firejail_test_dir/a\r" |
19 | expect { | 19 | expect { |
20 | timeout {puts "TESTING ERROR 1\n";exit} | 20 | timeout {puts "TESTING ERROR 5\n";exit} |
21 | "done" | 21 | "Read-only file system" |
22 | } | ||
23 | after 100 | ||
24 | |||
25 | send -- "echo mytest >~/_firejail_test_dir/test1/b;echo done\r" | ||
26 | expect { | ||
27 | timeout {puts "TESTING ERROR 2\n";exit} | ||
28 | "done" | ||
29 | } | 22 | } |
30 | after 100 | 23 | after 100 |
31 | 24 | ||
32 | send -- "cat ~/_firejail_test_dir/a;echo done\r" | 25 | send -- "echo mytest > ~/_firejail_test_dir/test1/b\r" |
33 | expect { | 26 | sleep 1 |
34 | timeout {puts "TESTING ERROR 3\n";exit} | ||
35 | "mytest" {puts "TESTING ERROR 4\n";exit} | ||
36 | "done" | ||
37 | } | ||
38 | after 100 | ||
39 | 27 | ||
40 | send -- "cat ~/_firejail_test_dir/test1/b;echo done\r" | 28 | send -- "cat ~/_firejail_test_dir/test1/b\r" |
41 | expect { | 29 | expect { |
42 | timeout {puts "TESTING ERROR 5\n";exit} | 30 | timeout {puts "TESTING ERROR 5\n";exit} |
43 | "mytest" | 31 | "mytest" |
44 | } | 32 | } |
45 | expect { | ||
46 | timeout {puts "TESTING ERROR 6\n";exit} | ||
47 | "done" | ||
48 | } | ||
49 | 33 | ||
50 | after 100 | 34 | after 100 |
51 | puts "\nall done\n" | 35 | puts "\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 | |||
3 | set timeout 10 | ||
4 | spawn $env(SHELL) | ||
5 | match_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 | ||
33 | send -- "firejail --net=br0 --private=fscheck-file-link\r" | ||
34 | expect { | ||
35 | timeout {puts "TESTING ERROR 2\n";exit} | ||
36 | "Error" | ||
37 | } | ||
38 | after 100 | ||
39 | |||
40 | # file | ||
41 | send -- "firejail --net=br0 --private=fscheck-file\r" | ||
42 | expect { | ||
43 | timeout {puts "TESTING ERROR 2.1\n";exit} | ||
44 | "Error" | ||
45 | } | ||
46 | after 100 | ||
47 | |||
48 | # .. | ||
49 | send -- "firejail --net=br0 --private=../test/fscheck-file\r" | ||
50 | expect { | ||
51 | timeout {puts "TESTING ERROR 2.2\n";exit} | ||
52 | "Error" | ||
53 | } | ||
54 | after 100 | ||
55 | |||
56 | # no file | ||
57 | send -- "firejail --net=br0 --private=../test/nodir\r" | ||
58 | expect { | ||
59 | timeout {puts "TESTING ERROR 3\n";exit} | ||
60 | "Error" | ||
61 | } | ||
62 | after 100 | ||
63 | |||
64 | # same owner | ||
65 | send -- "firejail --net=br0 --private=/etc\r" | ||
66 | expect { | ||
67 | timeout {puts "TESTING ERROR 4\n";exit} | ||
68 | "Error" | ||
69 | } | ||
70 | after 100 | ||
diff --git a/test/rlimit/rlimit.sh b/test/rlimit/rlimit.sh deleted file mode 100755 index d85497176..000000000 --- a/test/rlimit/rlimit.sh +++ /dev/null | |||
@@ -1,14 +0,0 @@ | |||
1 | #!/bin/bash | ||
2 | # This file is part of Firejail project | ||
3 | # Copyright (C) 2014-2016 Firejail Authors | ||
4 | # License GPL v2 | ||
5 | |||
6 | export MALLOC_CHECK_=3 | ||
7 | export MALLOC_PERTURB_=$(($RANDOM % 255 + 1)) | ||
8 | |||
9 | echo "TESTING: rlimit (test/rlimit/rlimit.exp)" | ||
10 | ./rlimit.exp | ||
11 | |||
12 | echo "TESTING: rlimit profile (test/rlimit/rlimit-profile.exp)" | ||
13 | ./rlimit-profile.exp | ||
14 | |||
diff --git a/test/utils/firemon-cpu.exp b/test/utils/firemon-cpu.exp index f2ecd4a5c..00156c909 100755 --- a/test/utils/firemon-cpu.exp +++ b/test/utils/firemon-cpu.exp | |||
@@ -24,7 +24,6 @@ sleep 1 | |||
24 | 24 | ||
25 | spawn $env(SHELL) | 25 | spawn $env(SHELL) |
26 | send -- "firemon --cpu\r" | 26 | send -- "firemon --cpu\r" |
27 | sleep 4 | ||
28 | expect { | 27 | expect { |
29 | timeout {puts "TESTING ERROR 2\n";exit} | 28 | timeout {puts "TESTING ERROR 2\n";exit} |
30 | "need to be root" {puts "TESTING SKIP: /proc mounted as hidepid\n"; exit} | 29 | "need to be root" {puts "TESTING SKIP: /proc mounted as hidepid\n"; exit} |
diff --git a/test/utils/firemon-interface.exp b/test/utils/firemon-interface.exp new file mode 100755 index 000000000..edafd1639 --- /dev/null +++ b/test/utils/firemon-interface.exp | |||
@@ -0,0 +1,18 @@ | |||
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 -- "firemon --interface\r" | ||
11 | expect { | ||
12 | timeout {puts "TESTING ERROR 0\n";exit} | ||
13 | "you need to be root" | ||
14 | } | ||
15 | after 100 | ||
16 | |||
17 | puts "\nall done\n" | ||
18 | |||
diff --git a/test/utils/firemon-name.exp b/test/utils/firemon-name.exp new file mode 100755 index 000000000..c5dbfabab --- /dev/null +++ b/test/utils/firemon-name.exp | |||
@@ -0,0 +1,28 @@ | |||
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 -- "firejail --name=test\r" | ||
11 | expect { | ||
12 | timeout {puts "TESTING ERROR 0\n";exit} | ||
13 | "Child process initialized" | ||
14 | } | ||
15 | sleep 1 | ||
16 | |||
17 | spawn $env(SHELL) | ||
18 | send -- "firemon --cpu --name=test\r" | ||
19 | expect { | ||
20 | timeout {puts "TESTING ERROR 2\n";exit} | ||
21 | "need to be root" {puts "TESTING SKIP: /proc mounted as hidepid\n"; exit} | ||
22 | "Cpus_allowed_list" | ||
23 | } | ||
24 | |||
25 | after 100 | ||
26 | |||
27 | puts "\nall done\n" | ||
28 | |||
diff --git a/test/utils/firemon-version.exp b/test/utils/firemon-version.exp new file mode 100755 index 000000000..639c15c29 --- /dev/null +++ b/test/utils/firemon-version.exp | |||
@@ -0,0 +1,18 @@ | |||
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 -- "firemon --version\r" | ||
11 | expect { | ||
12 | timeout {puts "TESTING ERROR 0\n";exit} | ||
13 | "firemon version" | ||
14 | } | ||
15 | after 100 | ||
16 | |||
17 | puts "\nall done\n" | ||
18 | |||
diff --git a/test/utils/utils.sh b/test/utils/utils.sh index bd91110f7..804e5ae0f 100755 --- a/test/utils/utils.sh +++ b/test/utils/utils.sh | |||
@@ -100,3 +100,12 @@ echo "TESTING: firemon cpu (test/utils/firemon-cpu.exp)" | |||
100 | echo "TESTING: firemon cgroup (test/utils/firemon-cgroup.exp)" | 100 | echo "TESTING: firemon cgroup (test/utils/firemon-cgroup.exp)" |
101 | ./firemon-cgroup.exp | 101 | ./firemon-cgroup.exp |
102 | 102 | ||
103 | echo "TESTING: firemon version (test/utils/firemon-version.exp)" | ||
104 | ./firemon-version.exp | ||
105 | |||
106 | echo "TESTING: firemon interface (test/utils/firemon-interface.exp)" | ||
107 | ./firemon-interface.exp | ||
108 | |||
109 | echo "TESTING: firemon name (test/utils/firemon-name.exp)" | ||
110 | ./firemon-name.exp | ||
111 | |||