diff options
author | netblue30 <netblue30@yahoo.com> | 2016-04-23 08:53:07 -0400 |
---|---|---|
committer | netblue30 <netblue30@yahoo.com> | 2016-04-23 08:53:07 -0400 |
commit | 2905b9f9ab5c5ed6f9210d1d843a8bcf41451854 (patch) | |
tree | d3bb968dbcb9f22856de345d0df5ecf2a44d594f /test/utils | |
parent | quiterss profile (diff) | |
download | firejail-2905b9f9ab5c5ed6f9210d1d843a8bcf41451854.tar.gz firejail-2905b9f9ab5c5ed6f9210d1d843a8bcf41451854.tar.zst firejail-2905b9f9ab5c5ed6f9210d1d843a8bcf41451854.zip |
make test-utils
Diffstat (limited to 'test/utils')
-rwxr-xr-x | test/utils/caps-print.exp | 32 | ||||
-rwxr-xr-x | test/utils/cpu-print.exp | 24 | ||||
-rwxr-xr-x | test/utils/dns-print.exp | 24 | ||||
-rwxr-xr-x | test/utils/fs-print.exp | 32 | ||||
-rwxr-xr-x | test/utils/help.exp | 25 | ||||
-rwxr-xr-x | test/utils/list.exp | 51 | ||||
-rwxr-xr-x | test/utils/man.exp | 20 | ||||
-rwxr-xr-x | test/utils/protocol-print.exp | 24 | ||||
-rwxr-xr-x | test/utils/seccomp-print.exp | 36 | ||||
-rwxr-xr-x | test/utils/tree.exp | 63 | ||||
-rwxr-xr-x | test/utils/utils.sh | 42 | ||||
-rwxr-xr-x | test/utils/version.exp | 18 |
12 files changed, 391 insertions, 0 deletions
diff --git a/test/utils/caps-print.exp b/test/utils/caps-print.exp new file mode 100755 index 000000000..9cc4b1872 --- /dev/null +++ b/test/utils/caps-print.exp | |||
@@ -0,0 +1,32 @@ | |||
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 2 | ||
16 | |||
17 | spawn $env(SHELL) | ||
18 | send -- "firejail --caps.print=test\r" | ||
19 | expect { | ||
20 | timeout {puts "TESTING ERROR 1\n";exit} | ||
21 | "setgid - disabled" | ||
22 | } | ||
23 | expect { | ||
24 | timeout {puts "TESTING ERROR 2\n";exit} | ||
25 | "setuid - disabled" | ||
26 | } | ||
27 | expect { | ||
28 | timeout {puts "TESTING ERROR 3\n";exit} | ||
29 | "net_raw - disabled" | ||
30 | } | ||
31 | sleep 1 | ||
32 | puts "\nall done\n" | ||
diff --git a/test/utils/cpu-print.exp b/test/utils/cpu-print.exp new file mode 100755 index 000000000..4a9ffa0ac --- /dev/null +++ b/test/utils/cpu-print.exp | |||
@@ -0,0 +1,24 @@ | |||
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 --cpu=1,2\r" | ||
11 | expect { | ||
12 | timeout {puts "TESTING ERROR 0\n";exit} | ||
13 | "Child process initialized" | ||
14 | } | ||
15 | sleep 2 | ||
16 | |||
17 | spawn $env(SHELL) | ||
18 | send -- "firejail --cpu.print=test\r" | ||
19 | expect { | ||
20 | timeout {puts "TESTING ERROR 1\n";exit} | ||
21 | "Cpus_allowed_list: 1-2" | ||
22 | } | ||
23 | sleep 1 | ||
24 | puts "\nall done\n" | ||
diff --git a/test/utils/dns-print.exp b/test/utils/dns-print.exp new file mode 100755 index 000000000..51dcab508 --- /dev/null +++ b/test/utils/dns-print.exp | |||
@@ -0,0 +1,24 @@ | |||
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 --dns=1.2.3.4\r" | ||
11 | expect { | ||
12 | timeout {puts "TESTING ERROR 0\n";exit} | ||
13 | "Child process initialized" | ||
14 | } | ||
15 | sleep 2 | ||
16 | |||
17 | spawn $env(SHELL) | ||
18 | send -- "firejail --dns.print=test\r" | ||
19 | expect { | ||
20 | timeout {puts "TESTING ERROR 1\n";exit} | ||
21 | "nameserver 1.2.3.4" | ||
22 | } | ||
23 | sleep 1 | ||
24 | puts "\nall done\n" | ||
diff --git a/test/utils/fs-print.exp b/test/utils/fs-print.exp new file mode 100755 index 000000000..fa0eab95b --- /dev/null +++ b/test/utils/fs-print.exp | |||
@@ -0,0 +1,32 @@ | |||
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 2 | ||
16 | |||
17 | spawn $env(SHELL) | ||
18 | send -- "firejail --fs.print=test\r" | ||
19 | expect { | ||
20 | timeout {puts "TESTING ERROR 1\n";exit} | ||
21 | "blacklist /boot" | ||
22 | } | ||
23 | expect { | ||
24 | timeout {puts "TESTING ERROR 2\n";exit} | ||
25 | "blacklist /dev/kmsg" | ||
26 | } | ||
27 | expect { | ||
28 | timeout {puts "TESTING ERROR 3\n";exit} | ||
29 | "blacklist /proc/kmsg" | ||
30 | } | ||
31 | sleep 1 | ||
32 | puts "\nall done\n" | ||
diff --git a/test/utils/help.exp b/test/utils/help.exp new file mode 100755 index 000000000..5b9864578 --- /dev/null +++ b/test/utils/help.exp | |||
@@ -0,0 +1,25 @@ | |||
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 --help\r" | ||
11 | expect { | ||
12 | timeout {puts "TESTING ERROR 0\n";exit} | ||
13 | "License GPL version 2 or later" | ||
14 | } | ||
15 | after 100 | ||
16 | |||
17 | send -- "firejail -?\r" | ||
18 | expect { | ||
19 | timeout {puts "TESTING ERROR 0\n";exit} | ||
20 | "License GPL version 2 or later" | ||
21 | } | ||
22 | after 100 | ||
23 | |||
24 | puts "\n" | ||
25 | |||
diff --git a/test/utils/list.exp b/test/utils/list.exp new file mode 100755 index 000000000..69db1f568 --- /dev/null +++ b/test/utils/list.exp | |||
@@ -0,0 +1,51 @@ | |||
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\r" | ||
11 | expect { | ||
12 | timeout {puts "TESTING ERROR 0\n";exit} | ||
13 | "Child process initialized" | ||
14 | } | ||
15 | after 100 | ||
16 | |||
17 | spawn $env(SHELL) | ||
18 | send -- "firejail\r" | ||
19 | expect { | ||
20 | timeout {puts "TESTING ERROR 1\n";exit} | ||
21 | "Child process initialized" | ||
22 | } | ||
23 | after 100 | ||
24 | |||
25 | spawn $env(SHELL) | ||
26 | send -- "firejail\r" | ||
27 | expect { | ||
28 | timeout {puts "TESTING ERROR 2\n";exit} | ||
29 | "Child process initialized" | ||
30 | } | ||
31 | sleep 1 | ||
32 | |||
33 | spawn $env(SHELL) | ||
34 | send -- "firejail --list\r" | ||
35 | expect { | ||
36 | timeout {puts "TESTING ERROR 3\n";exit} | ||
37 | ":firejail" | ||
38 | } | ||
39 | expect { | ||
40 | timeout {puts "TESTING ERROR 4\n";exit} | ||
41 | ":firejail" | ||
42 | } | ||
43 | expect { | ||
44 | timeout {puts "TESTING ERROR 5\n";exit} | ||
45 | ":firejail" | ||
46 | } | ||
47 | after 100 | ||
48 | |||
49 | |||
50 | puts "\n" | ||
51 | |||
diff --git a/test/utils/man.exp b/test/utils/man.exp new file mode 100755 index 000000000..d29f760b0 --- /dev/null +++ b/test/utils/man.exp | |||
@@ -0,0 +1,20 @@ | |||
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 -- "man firejail\r" | ||
11 | expect { | ||
12 | timeout {puts "TESTING ERROR 0\n";exit} | ||
13 | "Linux namespaces sandbox program" | ||
14 | } | ||
15 | after 100 | ||
16 | |||
17 | send -- "q\r" | ||
18 | after 100 | ||
19 | puts "\n" | ||
20 | |||
diff --git a/test/utils/protocol-print.exp b/test/utils/protocol-print.exp new file mode 100755 index 000000000..152a64467 --- /dev/null +++ b/test/utils/protocol-print.exp | |||
@@ -0,0 +1,24 @@ | |||
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 2 | ||
16 | |||
17 | spawn $env(SHELL) | ||
18 | send -- "firejail --protocol.print=test\r" | ||
19 | expect { | ||
20 | timeout {puts "TESTING ERROR 1\n";exit} | ||
21 | "unix,inet,inet6" | ||
22 | } | ||
23 | sleep 1 | ||
24 | puts "\nall done\n" | ||
diff --git a/test/utils/seccomp-print.exp b/test/utils/seccomp-print.exp new file mode 100755 index 000000000..d0531a9c3 --- /dev/null +++ b/test/utils/seccomp-print.exp | |||
@@ -0,0 +1,36 @@ | |||
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 2 | ||
16 | |||
17 | spawn $env(SHELL) | ||
18 | send -- "firejail --seccomp.print=test\r" | ||
19 | expect { | ||
20 | timeout {puts "TESTING ERROR 1\n";exit} | ||
21 | "EXAMINE_SYSCAL" | ||
22 | } | ||
23 | expect { | ||
24 | timeout {puts "TESTING ERROR 2\n";exit} | ||
25 | "init_module" | ||
26 | } | ||
27 | expect { | ||
28 | timeout {puts "TESTING ERROR 3\n";exit} | ||
29 | "delete_module" | ||
30 | } | ||
31 | expect { | ||
32 | timeout {puts "TESTING ERROR 4\n";exit} | ||
33 | "RETURN_ALLOW" | ||
34 | } | ||
35 | sleep 1 | ||
36 | puts "\nall done\n" | ||
diff --git a/test/utils/tree.exp b/test/utils/tree.exp new file mode 100755 index 000000000..a8ef763f1 --- /dev/null +++ b/test/utils/tree.exp | |||
@@ -0,0 +1,63 @@ | |||
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\r" | ||
11 | expect { | ||
12 | timeout {puts "TESTING ERROR 0\n";exit} | ||
13 | "Child process initialized" | ||
14 | } | ||
15 | after 100 | ||
16 | |||
17 | spawn $env(SHELL) | ||
18 | send -- "firejail\r" | ||
19 | expect { | ||
20 | timeout {puts "TESTING ERROR 1\n";exit} | ||
21 | "Child process initialized" | ||
22 | } | ||
23 | after 100 | ||
24 | |||
25 | spawn $env(SHELL) | ||
26 | send -- "firejail\r" | ||
27 | expect { | ||
28 | timeout {puts "TESTING ERROR 2\n";exit} | ||
29 | "Child process initialized" | ||
30 | } | ||
31 | sleep 1 | ||
32 | |||
33 | spawn $env(SHELL) | ||
34 | send -- "firejail --tree\r" | ||
35 | expect { | ||
36 | timeout {puts "TESTING ERROR 3\n";exit} | ||
37 | ":firejail" | ||
38 | } | ||
39 | expect { | ||
40 | timeout {puts "TESTING ERROR 3.1\n";exit} | ||
41 | ":/bin/bash" | ||
42 | } | ||
43 | expect { | ||
44 | timeout {puts "TESTING ERROR 4\n";exit} | ||
45 | ":firejail" | ||
46 | } | ||
47 | expect { | ||
48 | timeout {puts "TESTING ERROR 4.1\n";exit} | ||
49 | ":/bin/bash" | ||
50 | } | ||
51 | expect { | ||
52 | timeout {puts "TESTING ERROR 5\n";exit} | ||
53 | ":firejail" | ||
54 | } | ||
55 | expect { | ||
56 | timeout {puts "TESTING ERROR 5.1\n";exit} | ||
57 | ":/bin/bash" | ||
58 | } | ||
59 | after 100 | ||
60 | |||
61 | |||
62 | puts "\n" | ||
63 | |||
diff --git a/test/utils/utils.sh b/test/utils/utils.sh new file mode 100755 index 000000000..02aaa57c0 --- /dev/null +++ b/test/utils/utils.sh | |||
@@ -0,0 +1,42 @@ | |||
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: version (test/utils/version.exp)" | ||
10 | ./version.exp | ||
11 | |||
12 | echo "TESTING: help (test/utils/help.exp)" | ||
13 | ./help.exp | ||
14 | |||
15 | echo "TESTING: man (test/utils/man.exp)" | ||
16 | ./man.exp | ||
17 | |||
18 | echo "TESTING: list (test/utils/list.exp)" | ||
19 | ./list.exp | ||
20 | |||
21 | echo "TESTING: tree (test/utils/tree.exp)" | ||
22 | ./tree.exp | ||
23 | |||
24 | echo "TESTING: cpu.print (test/utils/cpu-print.exp)" | ||
25 | echo "TESTING: failing under VirtualBox where there is only one CPU" | ||
26 | ./cpu-print.exp | ||
27 | |||
28 | echo "TESTING: fs.print (test/utils/fs-print.exp)" | ||
29 | ./fs-print.exp | ||
30 | |||
31 | echo "TESTING: dns.print (test/utils/dns-print.exp)" | ||
32 | ./dns-print.exp | ||
33 | |||
34 | echo "TESTING: caps.print (test/utils/caps-print.exp)" | ||
35 | ./caps-print.exp | ||
36 | |||
37 | echo "TESTING: seccomp.print (test/utils/seccomp-print.exp)" | ||
38 | ./seccomp-print.exp | ||
39 | |||
40 | echo "TESTING: protocol.print (test/utils/protocol-print.exp)" | ||
41 | ./protocol-print.exp | ||
42 | |||
diff --git a/test/utils/version.exp b/test/utils/version.exp new file mode 100755 index 000000000..2ce6f1680 --- /dev/null +++ b/test/utils/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 -- "firejail --version\r" | ||
11 | expect { | ||
12 | timeout {puts "TESTING ERROR 0\n";exit} | ||
13 | "firejail version " | ||
14 | } | ||
15 | after 100 | ||
16 | |||
17 | puts "\n" | ||
18 | |||