diff options
author | root <root@debian> | 2017-03-24 09:39:24 -0400 |
---|---|---|
committer | root <root@debian> | 2017-03-24 09:39:24 -0400 |
commit | e7fbd682f8ab04f3f505c1bcfa165295739e06dc (patch) | |
tree | 59ae7cdbeb3fbc9a5573b26a328d2adf8056a57b | |
parent | testing (diff) | |
download | firejail-e7fbd682f8ab04f3f505c1bcfa165295739e06dc.tar.gz firejail-e7fbd682f8ab04f3f505c1bcfa165295739e06dc.tar.zst firejail-e7fbd682f8ab04f3f505c1bcfa165295739e06dc.zip |
testing
-rwxr-xr-x | test/fs/mkdir.exp | 7 | ||||
-rw-r--r-- | test/fs/mkdir2.profile | 1 | ||||
-rwxr-xr-x | test/fs/mkdir_mkfile.exp | 9 | ||||
-rw-r--r-- | test/fs/mkfile.profile | 1 | ||||
-rwxr-xr-x | test/root/cgroup.exp | 61 | ||||
-rwxr-xr-x | test/root/root.sh | 7 | ||||
-rwxr-xr-x | test/utils/join-profile.exp | 2 | ||||
-rwxr-xr-x | test/utils/join2.exp | 2 | ||||
-rwxr-xr-x | test/utils/join3.exp | 2 | ||||
-rwxr-xr-x | test/utils/join4.exp | 2 |
10 files changed, 88 insertions, 6 deletions
diff --git a/test/fs/mkdir.exp b/test/fs/mkdir.exp index 111db06db..81df7cd86 100755 --- a/test/fs/mkdir.exp +++ b/test/fs/mkdir.exp | |||
@@ -17,4 +17,11 @@ expect { | |||
17 | send -- "rm -rf ~/.firejail_test\r" | 17 | send -- "rm -rf ~/.firejail_test\r" |
18 | after 100 | 18 | after 100 |
19 | 19 | ||
20 | send -- "firejail --profile=mkdir2.profile\r" | ||
21 | expect { | ||
22 | timeout {puts "TESTING ERROR 2\n";exit} | ||
23 | "only directories in user home or /tmp" | ||
24 | } | ||
25 | after 100 | ||
26 | |||
20 | puts "\nall done\n" | 27 | puts "\nall done\n" |
diff --git a/test/fs/mkdir2.profile b/test/fs/mkdir2.profile new file mode 100644 index 000000000..28afb8d21 --- /dev/null +++ b/test/fs/mkdir2.profile | |||
@@ -0,0 +1 @@ | |||
mkdir /etc/somefile | |||
diff --git a/test/fs/mkdir_mkfile.exp b/test/fs/mkdir_mkfile.exp index e2e7d3ef0..28a5ae459 100755 --- a/test/fs/mkdir_mkfile.exp +++ b/test/fs/mkdir_mkfile.exp | |||
@@ -42,5 +42,14 @@ expect { | |||
42 | "_firejail_test_dir/dir1/dir2/dir3/file1" | 42 | "_firejail_test_dir/dir1/dir2/dir3/file1" |
43 | } | 43 | } |
44 | after 100 | 44 | after 100 |
45 | send -- "exit\r" | ||
46 | after 100 | ||
47 | |||
48 | send -- "firejail --profile=mkfile.profile\r" | ||
49 | expect { | ||
50 | timeout {puts "TESTING ERROR 1\n";exit} | ||
51 | "only files in user home or /tmp" | ||
52 | } | ||
53 | after 100 | ||
45 | 54 | ||
46 | puts "all done\n" | 55 | puts "all done\n" |
diff --git a/test/fs/mkfile.profile b/test/fs/mkfile.profile new file mode 100644 index 000000000..6b7fbb322 --- /dev/null +++ b/test/fs/mkfile.profile | |||
@@ -0,0 +1 @@ | |||
mkfile /etc/somefile | |||
diff --git a/test/root/cgroup.exp b/test/root/cgroup.exp new file mode 100755 index 000000000..4b07183a1 --- /dev/null +++ b/test/root/cgroup.exp | |||
@@ -0,0 +1,61 @@ | |||
1 | #!/usr/bin/expect -f | ||
2 | # This file is part of Firejail project | ||
3 | # Copyright (C) 2014-2017 Firejail Authors | ||
4 | # License GPL v2 | ||
5 | |||
6 | set timeout 10 | ||
7 | cd /home | ||
8 | spawn $env(SHELL) | ||
9 | match_max 100000 | ||
10 | |||
11 | |||
12 | send -- "mkdir /sys/fs/cgroup/systemd/firejail\r" | ||
13 | sleep 1 | ||
14 | send -- "ls /sys/fs/cgroup/systemd/firejail\r" | ||
15 | expect { | ||
16 | timeout {puts "TESTING ERROR 0\n";exit} | ||
17 | "tasks" | ||
18 | } | ||
19 | |||
20 | send -- "firejail --name=\"join testing\" --cgroup=/sys/fs/cgroup/systemd/firejail/tasks\r" | ||
21 | expect { | ||
22 | timeout {puts "TESTING ERROR 1\n";exit} | ||
23 | "Child process initialized" | ||
24 | } | ||
25 | sleep 2 | ||
26 | |||
27 | spawn $env(SHELL) | ||
28 | send -- "wc -l /sys/fs/cgroup/systemd/firejail/tasks\r" | ||
29 | expect { | ||
30 | timeout {puts "TESTING ERROR 2\n";exit} | ||
31 | "3" | ||
32 | } | ||
33 | |||
34 | spawn $env(SHELL) | ||
35 | send -- "firejail --join=\"join testing\"\r" | ||
36 | expect { | ||
37 | timeout {puts "TESTING ERROR 3\n";exit} | ||
38 | "Switching to pid" | ||
39 | } | ||
40 | sleep 1 | ||
41 | send -- "ps aux\r" | ||
42 | expect { | ||
43 | timeout {puts "TESTING ERROR 4\n";exit} | ||
44 | "/bin/bash" | ||
45 | } | ||
46 | expect { | ||
47 | timeout {puts "TESTING ERROR 5\n";exit} | ||
48 | "/bin/bash" | ||
49 | } | ||
50 | |||
51 | after 100 | ||
52 | |||
53 | spawn $env(SHELL) | ||
54 | send -- "wc -l /sys/fs/cgroup/systemd/firejail/tasks\r" | ||
55 | expect { | ||
56 | timeout {puts "TESTING ERROR 6\n";exit} | ||
57 | "3" | ||
58 | } | ||
59 | after 100 | ||
60 | |||
61 | puts "\nall done\n" | ||
diff --git a/test/root/root.sh b/test/root/root.sh index 82fdc90b5..406e7dc4f 100755 --- a/test/root/root.sh +++ b/test/root/root.sh | |||
@@ -1,7 +1,7 @@ | |||
1 | #!/bin/bash | 1 | #!/bin/bash |
2 | 2 | ||
3 | # set a new firejail config file | 3 | # set a new firejail config file |
4 | cp firejail.config /etc/firejail/firejail.config | 4 | #cp firejail.config /etc/firejail/firejail.config |
5 | 5 | ||
6 | #******************************** | 6 | #******************************** |
7 | # servers | 7 | # servers |
@@ -84,6 +84,9 @@ echo "TESTING: firejail configuration (test/root/checkcfg.exp)" | |||
84 | ./checkcfg.exp | 84 | ./checkcfg.exp |
85 | cp ../../etc/firejail.config /etc/firejail/. | 85 | cp ../../etc/firejail.config /etc/firejail/. |
86 | 86 | ||
87 | echo "TESTING: cgroup (test/root/cgroup.exp)" | ||
88 | ./cgroup.exp | ||
89 | |||
87 | echo "TESTING: tmpfs (test/root/option_tmpfs.exp)" | 90 | echo "TESTING: tmpfs (test/root/option_tmpfs.exp)" |
88 | ./option_tmpfs.exp | 91 | ./option_tmpfs.exp |
89 | 92 | ||
@@ -117,5 +120,5 @@ else | |||
117 | fi | 120 | fi |
118 | 121 | ||
119 | # restore the default config file | 122 | # restore the default config file |
120 | cp ../../etc/firejail.config /etc/firejail/firejail.config | 123 | #cp ../../etc/firejail.config /etc/firejail/firejail.config |
121 | 124 | ||
diff --git a/test/utils/join-profile.exp b/test/utils/join-profile.exp index a2078c2f6..716bd2947 100755 --- a/test/utils/join-profile.exp +++ b/test/utils/join-profile.exp | |||
@@ -29,7 +29,7 @@ expect { | |||
29 | "/bin/bash" | 29 | "/bin/bash" |
30 | } | 30 | } |
31 | 31 | ||
32 | send -- "exit" | 32 | send -- "exit\r" |
33 | after 100 | 33 | after 100 |
34 | 34 | ||
35 | puts "\nall done\n" | 35 | puts "\nall done\n" |
diff --git a/test/utils/join2.exp b/test/utils/join2.exp index b7d1f345f..0c1fa6684 100755 --- a/test/utils/join2.exp +++ b/test/utils/join2.exp | |||
@@ -32,7 +32,7 @@ expect { | |||
32 | "/bin/bash" | 32 | "/bin/bash" |
33 | } | 33 | } |
34 | 34 | ||
35 | send -- "exit" | 35 | send -- "exit\r" |
36 | after 100 | 36 | after 100 |
37 | 37 | ||
38 | puts "\nall done\n" | 38 | puts "\nall done\n" |
diff --git a/test/utils/join3.exp b/test/utils/join3.exp index c0cc7c2e4..968aa3008 100755 --- a/test/utils/join3.exp +++ b/test/utils/join3.exp | |||
@@ -32,7 +32,7 @@ expect { | |||
32 | "/bin/bash" | 32 | "/bin/bash" |
33 | } | 33 | } |
34 | 34 | ||
35 | send -- "exit" | 35 | send -- "exit\r" |
36 | after 100 | 36 | after 100 |
37 | 37 | ||
38 | puts "\nall done\n" | 38 | puts "\nall done\n" |
diff --git a/test/utils/join4.exp b/test/utils/join4.exp index c953320e0..27f52fd56 100755 --- a/test/utils/join4.exp +++ b/test/utils/join4.exp | |||
@@ -32,7 +32,7 @@ expect { | |||
32 | "/bin/bash" | 32 | "/bin/bash" |
33 | } | 33 | } |
34 | 34 | ||
35 | send -- "exit" | 35 | send -- "exit\r" |
36 | after 100 | 36 | after 100 |
37 | 37 | ||
38 | puts "\nall done\n" | 38 | puts "\nall done\n" |