aboutsummaryrefslogtreecommitdiffstats
path: root/test/utils
diff options
context:
space:
mode:
Diffstat (limited to 'test/utils')
-rwxr-xr-xtest/utils/caps-print.exp32
-rwxr-xr-xtest/utils/cpu-print.exp24
-rwxr-xr-xtest/utils/dns-print.exp24
-rwxr-xr-xtest/utils/fs-print.exp32
-rwxr-xr-xtest/utils/help.exp25
-rwxr-xr-xtest/utils/list.exp51
-rwxr-xr-xtest/utils/man.exp20
-rwxr-xr-xtest/utils/protocol-print.exp24
-rwxr-xr-xtest/utils/seccomp-print.exp36
-rwxr-xr-xtest/utils/tree.exp63
-rwxr-xr-xtest/utils/utils.sh42
-rwxr-xr-xtest/utils/version.exp18
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
6set timeout 10
7spawn $env(SHELL)
8match_max 100000
9
10send -- "firejail --name=test\r"
11expect {
12 timeout {puts "TESTING ERROR 0\n";exit}
13 "Child process initialized"
14}
15sleep 2
16
17spawn $env(SHELL)
18send -- "firejail --caps.print=test\r"
19expect {
20 timeout {puts "TESTING ERROR 1\n";exit}
21 "setgid - disabled"
22}
23expect {
24 timeout {puts "TESTING ERROR 2\n";exit}
25 "setuid - disabled"
26}
27expect {
28 timeout {puts "TESTING ERROR 3\n";exit}
29 "net_raw - disabled"
30}
31sleep 1
32puts "\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
6set timeout 10
7spawn $env(SHELL)
8match_max 100000
9
10send -- "firejail --name=test --cpu=1,2\r"
11expect {
12 timeout {puts "TESTING ERROR 0\n";exit}
13 "Child process initialized"
14}
15sleep 2
16
17spawn $env(SHELL)
18send -- "firejail --cpu.print=test\r"
19expect {
20 timeout {puts "TESTING ERROR 1\n";exit}
21 "Cpus_allowed_list: 1-2"
22}
23sleep 1
24puts "\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
6set timeout 10
7spawn $env(SHELL)
8match_max 100000
9
10send -- "firejail --name=test --dns=1.2.3.4\r"
11expect {
12 timeout {puts "TESTING ERROR 0\n";exit}
13 "Child process initialized"
14}
15sleep 2
16
17spawn $env(SHELL)
18send -- "firejail --dns.print=test\r"
19expect {
20 timeout {puts "TESTING ERROR 1\n";exit}
21 "nameserver 1.2.3.4"
22}
23sleep 1
24puts "\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
6set timeout 10
7spawn $env(SHELL)
8match_max 100000
9
10send -- "firejail --name=test\r"
11expect {
12 timeout {puts "TESTING ERROR 0\n";exit}
13 "Child process initialized"
14}
15sleep 2
16
17spawn $env(SHELL)
18send -- "firejail --fs.print=test\r"
19expect {
20 timeout {puts "TESTING ERROR 1\n";exit}
21 "blacklist /boot"
22}
23expect {
24 timeout {puts "TESTING ERROR 2\n";exit}
25 "blacklist /dev/kmsg"
26}
27expect {
28 timeout {puts "TESTING ERROR 3\n";exit}
29 "blacklist /proc/kmsg"
30}
31sleep 1
32puts "\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
6set timeout 10
7spawn $env(SHELL)
8match_max 100000
9
10send -- "firejail --help\r"
11expect {
12 timeout {puts "TESTING ERROR 0\n";exit}
13 "License GPL version 2 or later"
14}
15after 100
16
17send -- "firejail -?\r"
18expect {
19 timeout {puts "TESTING ERROR 0\n";exit}
20 "License GPL version 2 or later"
21}
22after 100
23
24puts "\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
6set timeout 10
7spawn $env(SHELL)
8match_max 100000
9
10send -- "firejail\r"
11expect {
12 timeout {puts "TESTING ERROR 0\n";exit}
13 "Child process initialized"
14}
15after 100
16
17spawn $env(SHELL)
18send -- "firejail\r"
19expect {
20 timeout {puts "TESTING ERROR 1\n";exit}
21 "Child process initialized"
22}
23after 100
24
25spawn $env(SHELL)
26send -- "firejail\r"
27expect {
28 timeout {puts "TESTING ERROR 2\n";exit}
29 "Child process initialized"
30}
31sleep 1
32
33spawn $env(SHELL)
34send -- "firejail --list\r"
35expect {
36 timeout {puts "TESTING ERROR 3\n";exit}
37 ":firejail"
38}
39expect {
40 timeout {puts "TESTING ERROR 4\n";exit}
41 ":firejail"
42}
43expect {
44 timeout {puts "TESTING ERROR 5\n";exit}
45 ":firejail"
46}
47after 100
48
49
50puts "\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
6set timeout 10
7spawn $env(SHELL)
8match_max 100000
9
10send -- "man firejail\r"
11expect {
12 timeout {puts "TESTING ERROR 0\n";exit}
13 "Linux namespaces sandbox program"
14}
15after 100
16
17send -- "q\r"
18after 100
19puts "\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
6set timeout 10
7spawn $env(SHELL)
8match_max 100000
9
10send -- "firejail --name=test\r"
11expect {
12 timeout {puts "TESTING ERROR 0\n";exit}
13 "Child process initialized"
14}
15sleep 2
16
17spawn $env(SHELL)
18send -- "firejail --protocol.print=test\r"
19expect {
20 timeout {puts "TESTING ERROR 1\n";exit}
21 "unix,inet,inet6"
22}
23sleep 1
24puts "\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
6set timeout 10
7spawn $env(SHELL)
8match_max 100000
9
10send -- "firejail --name=test\r"
11expect {
12 timeout {puts "TESTING ERROR 0\n";exit}
13 "Child process initialized"
14}
15sleep 2
16
17spawn $env(SHELL)
18send -- "firejail --seccomp.print=test\r"
19expect {
20 timeout {puts "TESTING ERROR 1\n";exit}
21 "EXAMINE_SYSCAL"
22}
23expect {
24 timeout {puts "TESTING ERROR 2\n";exit}
25 "init_module"
26}
27expect {
28 timeout {puts "TESTING ERROR 3\n";exit}
29 "delete_module"
30}
31expect {
32 timeout {puts "TESTING ERROR 4\n";exit}
33 "RETURN_ALLOW"
34}
35sleep 1
36puts "\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
6set timeout 10
7spawn $env(SHELL)
8match_max 100000
9
10send -- "firejail\r"
11expect {
12 timeout {puts "TESTING ERROR 0\n";exit}
13 "Child process initialized"
14}
15after 100
16
17spawn $env(SHELL)
18send -- "firejail\r"
19expect {
20 timeout {puts "TESTING ERROR 1\n";exit}
21 "Child process initialized"
22}
23after 100
24
25spawn $env(SHELL)
26send -- "firejail\r"
27expect {
28 timeout {puts "TESTING ERROR 2\n";exit}
29 "Child process initialized"
30}
31sleep 1
32
33spawn $env(SHELL)
34send -- "firejail --tree\r"
35expect {
36 timeout {puts "TESTING ERROR 3\n";exit}
37 ":firejail"
38}
39expect {
40 timeout {puts "TESTING ERROR 3.1\n";exit}
41 ":/bin/bash"
42}
43expect {
44 timeout {puts "TESTING ERROR 4\n";exit}
45 ":firejail"
46}
47expect {
48 timeout {puts "TESTING ERROR 4.1\n";exit}
49 ":/bin/bash"
50}
51expect {
52 timeout {puts "TESTING ERROR 5\n";exit}
53 ":firejail"
54}
55expect {
56 timeout {puts "TESTING ERROR 5.1\n";exit}
57 ":/bin/bash"
58}
59after 100
60
61
62puts "\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
6export MALLOC_CHECK_=3
7export MALLOC_PERTURB_=$(($RANDOM % 255 + 1))
8
9echo "TESTING: version (test/utils/version.exp)"
10./version.exp
11
12echo "TESTING: help (test/utils/help.exp)"
13./help.exp
14
15echo "TESTING: man (test/utils/man.exp)"
16./man.exp
17
18echo "TESTING: list (test/utils/list.exp)"
19./list.exp
20
21echo "TESTING: tree (test/utils/tree.exp)"
22./tree.exp
23
24echo "TESTING: cpu.print (test/utils/cpu-print.exp)"
25echo "TESTING: failing under VirtualBox where there is only one CPU"
26./cpu-print.exp
27
28echo "TESTING: fs.print (test/utils/fs-print.exp)"
29./fs-print.exp
30
31echo "TESTING: dns.print (test/utils/dns-print.exp)"
32./dns-print.exp
33
34echo "TESTING: caps.print (test/utils/caps-print.exp)"
35./caps-print.exp
36
37echo "TESTING: seccomp.print (test/utils/seccomp-print.exp)"
38./seccomp-print.exp
39
40echo "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
6set timeout 10
7spawn $env(SHELL)
8match_max 100000
9
10send -- "firejail --version\r"
11expect {
12 timeout {puts "TESTING ERROR 0\n";exit}
13 "firejail version "
14}
15after 100
16
17puts "\n"
18