diff options
Diffstat (limited to 'test/utils')
34 files changed, 1420 insertions, 0 deletions
diff --git a/test/utils/caps-print.exp b/test/utils/caps-print.exp new file mode 100755 index 000000000..fa5239da2 --- /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 | after 100 | ||
32 | puts "\nall done\n" | ||
diff --git a/test/utils/caps1.profile b/test/utils/caps1.profile new file mode 100644 index 000000000..e14655b2e --- /dev/null +++ b/test/utils/caps1.profile | |||
@@ -0,0 +1 @@ | |||
caps.drop chown,kill \ No newline at end of file | |||
diff --git a/test/utils/caps2.profile b/test/utils/caps2.profile new file mode 100644 index 000000000..cb2258c52 --- /dev/null +++ b/test/utils/caps2.profile | |||
@@ -0,0 +1 @@ | |||
caps.keep chown,kill \ No newline at end of file | |||
diff --git a/test/utils/catchsignal-master.sh b/test/utils/catchsignal-master.sh new file mode 100755 index 000000000..62a1801cc --- /dev/null +++ b/test/utils/catchsignal-master.sh | |||
@@ -0,0 +1,4 @@ | |||
1 | #!/bin/bash | ||
2 | |||
3 | ./catchsignal.sh & | ||
4 | ./catchsignal.sh & | ||
diff --git a/test/utils/catchsignal.sh b/test/utils/catchsignal.sh new file mode 100755 index 000000000..87a1d0adf --- /dev/null +++ b/test/utils/catchsignal.sh | |||
@@ -0,0 +1,27 @@ | |||
1 | #!/bin/bash | ||
2 | |||
3 | _term() { | ||
4 | echo "Caught Signal" | ||
5 | echo 1 | ||
6 | sleep 1 | ||
7 | echo 2 | ||
8 | sleep 1 | ||
9 | echo 3 | ||
10 | sleep 1 | ||
11 | echo 4 | ||
12 | sleep 1 | ||
13 | echo 5 | ||
14 | sleep 1 | ||
15 | |||
16 | kill $pid | ||
17 | exit | ||
18 | } | ||
19 | |||
20 | trap _term SIGTERM | ||
21 | trap _term SIGINT | ||
22 | |||
23 | echo "Sleeping..." | ||
24 | |||
25 | sleep inf & | ||
26 | pid=$! | ||
27 | wait $pid | ||
diff --git a/test/utils/catchsignal2.sh b/test/utils/catchsignal2.sh new file mode 100755 index 000000000..424350397 --- /dev/null +++ b/test/utils/catchsignal2.sh | |||
@@ -0,0 +1,49 @@ | |||
1 | #!/bin/bash | ||
2 | |||
3 | _term() { | ||
4 | echo "Caught Signal" | ||
5 | echo 1 | ||
6 | sleep 1 | ||
7 | echo 2 | ||
8 | sleep 1 | ||
9 | echo 3 | ||
10 | sleep 1 | ||
11 | echo 4 | ||
12 | sleep 1 | ||
13 | echo 5 | ||
14 | sleep 1 | ||
15 | |||
16 | echo 10 | ||
17 | sleep 1 | ||
18 | echo 20 | ||
19 | sleep 1 | ||
20 | echo 30 | ||
21 | sleep 1 | ||
22 | echo 40 | ||
23 | sleep 1 | ||
24 | echo 50 | ||
25 | sleep 1 | ||
26 | |||
27 | echo 100 | ||
28 | sleep 1 | ||
29 | echo 200 | ||
30 | sleep 1 | ||
31 | echo 300 | ||
32 | sleep 1 | ||
33 | echo 400 | ||
34 | sleep 1 | ||
35 | echo 500 | ||
36 | sleep 1 | ||
37 | |||
38 | kill $pid | ||
39 | exit | ||
40 | } | ||
41 | |||
42 | trap _term SIGTERM | ||
43 | trap _term SIGINT | ||
44 | |||
45 | echo "Sleeping..." | ||
46 | |||
47 | sleep inf & | ||
48 | pid=$! | ||
49 | wait $pid | ||
diff --git a/test/utils/cpu-print.exp b/test/utils/cpu-print.exp new file mode 100755 index 000000000..ca2e57313 --- /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 | after 100 | ||
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..406ab5149 --- /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 | after 100 | ||
24 | puts "\nall done\n" | ||
diff --git a/test/utils/firemon-caps.exp b/test/utils/firemon-caps.exp new file mode 100755 index 000000000..76aa13725 --- /dev/null +++ b/test/utils/firemon-caps.exp | |||
@@ -0,0 +1,130 @@ | |||
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=bingo1 --noprofile --caps\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 -- "firejail --name=bingo2 --noprofile\r" | ||
19 | expect { | ||
20 | timeout {puts "TESTING ERROR 1\n";exit} | ||
21 | "Child process initialized" | ||
22 | } | ||
23 | sleep 1 | ||
24 | |||
25 | spawn $env(SHELL) | ||
26 | send -- "firejail --name=bingo3 --noprofile --caps.drop=all\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 --noprofile --name=bingo4 --caps.drop=chown,kill\r" | ||
35 | expect { | ||
36 | timeout {puts "TESTING ERROR 3\n";exit} | ||
37 | "Child process initialized" | ||
38 | } | ||
39 | sleep 1 | ||
40 | |||
41 | spawn $env(SHELL) | ||
42 | send -- "firejail --noprofile --name=bingo5 --caps.keep=chown,kill\r" | ||
43 | expect { | ||
44 | timeout {puts "TESTING ERROR 4\n";exit} | ||
45 | "Child process initialized" | ||
46 | } | ||
47 | sleep 1 | ||
48 | |||
49 | spawn $env(SHELL) | ||
50 | send -- "firejail --name=bingo6 --profile=caps1.profile\r" | ||
51 | expect { | ||
52 | timeout {puts "TESTING ERROR 5\n";exit} | ||
53 | "Child process initialized" | ||
54 | } | ||
55 | sleep 1 | ||
56 | |||
57 | spawn $env(SHELL) | ||
58 | send -- "firejail --name=bingo7 --profile=caps2.profile\r" | ||
59 | expect { | ||
60 | timeout {puts "TESTING ERROR 0\n";exit} | ||
61 | "Child process initialized" | ||
62 | } | ||
63 | sleep 1 | ||
64 | |||
65 | spawn $env(SHELL) | ||
66 | send -- "firemon --caps\r" | ||
67 | expect { | ||
68 | timeout {puts "TESTING ERROR 8.1\n";exit} | ||
69 | "need to be root" {puts "TESTING SKIP: /proc mounted as hidepid\n"; exit} | ||
70 | "bingo1" | ||
71 | } | ||
72 | expect { | ||
73 | timeout {puts "TESTING ERROR 8.2\n";exit} | ||
74 | "31cffff" | ||
75 | } | ||
76 | expect { | ||
77 | timeout {puts "TESTING ERROR 8.3\n";exit} | ||
78 | "bingo2" | ||
79 | } | ||
80 | expect { | ||
81 | timeout {puts "TESTING ERROR 8.4\n";exit} | ||
82 | "fffffff" | ||
83 | } | ||
84 | expect { | ||
85 | timeout {puts "TESTING ERROR 8.5\n";exit} | ||
86 | "bingo3" | ||
87 | } | ||
88 | expect { | ||
89 | timeout {puts "TESTING ERROR 8.6\n";exit} | ||
90 | "000000000000" | ||
91 | } | ||
92 | |||
93 | expect { | ||
94 | timeout {puts "TESTING ERROR 8.7\n";exit} | ||
95 | "bingo4" | ||
96 | } | ||
97 | expect { | ||
98 | timeout {puts "TESTING ERROR 8.8\n";exit} | ||
99 | "ffffffde" | ||
100 | } | ||
101 | expect { | ||
102 | timeout {puts "TESTING ERROR 8.9\n";exit} | ||
103 | "bingo5" | ||
104 | } | ||
105 | expect { | ||
106 | timeout {puts "TESTING ERROR 8.10\n";exit} | ||
107 | "0000000000000021" | ||
108 | } | ||
109 | |||
110 | expect { | ||
111 | timeout {puts "TESTING ERROR 8.11\n";exit} | ||
112 | "bingo6" | ||
113 | } | ||
114 | expect { | ||
115 | timeout {puts "TESTING ERROR 8.12\n";exit} | ||
116 | "ffffffde" | ||
117 | } | ||
118 | expect { | ||
119 | timeout {puts "TESTING ERROR 8.13\n";exit} | ||
120 | "bingo7" | ||
121 | } | ||
122 | expect { | ||
123 | timeout {puts "TESTING ERROR 8.14\n";exit} | ||
124 | "0000000000000021" | ||
125 | } | ||
126 | |||
127 | after 100 | ||
128 | |||
129 | puts "all done\n" | ||
130 | |||
diff --git a/test/utils/firemon-cgroup.exp b/test/utils/firemon-cgroup.exp new file mode 100755 index 000000000..b1ab083ae --- /dev/null +++ b/test/utils/firemon-cgroup.exp | |||
@@ -0,0 +1,41 @@ | |||
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=test1\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 -- "firejail --name=test2\r" | ||
19 | expect { | ||
20 | timeout {puts "TESTING ERROR 1\n";exit} | ||
21 | "Child process initialized" | ||
22 | } | ||
23 | sleep 1 | ||
24 | |||
25 | spawn $env(SHELL) | ||
26 | send -- "firemon --cgroup\r" | ||
27 | sleep 4 | ||
28 | expect { | ||
29 | timeout {puts "TESTING ERROR 2\n";exit} | ||
30 | "need to be root" {puts "TESTING SKIP: /proc mounted as hidepid\n"; exit} | ||
31 | "name=test1" | ||
32 | } | ||
33 | expect { | ||
34 | timeout {puts "TESTING ERROR 3\n";exit} | ||
35 | "name=test2" | ||
36 | } | ||
37 | |||
38 | after 100 | ||
39 | |||
40 | puts "\nall done\n" | ||
41 | |||
diff --git a/test/utils/firemon-cpu.exp b/test/utils/firemon-cpu.exp new file mode 100755 index 000000000..f2ecd4a5c --- /dev/null +++ b/test/utils/firemon-cpu.exp | |||
@@ -0,0 +1,45 @@ | |||
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=test1\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 -- "firejail --name=test2\r" | ||
19 | expect { | ||
20 | timeout {puts "TESTING ERROR 1\n";exit} | ||
21 | "Child process initialized" | ||
22 | } | ||
23 | sleep 1 | ||
24 | |||
25 | spawn $env(SHELL) | ||
26 | send -- "firemon --cpu\r" | ||
27 | sleep 4 | ||
28 | expect { | ||
29 | timeout {puts "TESTING ERROR 2\n";exit} | ||
30 | "need to be root" {puts "TESTING SKIP: /proc mounted as hidepid\n"; exit} | ||
31 | "name=test1" | ||
32 | } | ||
33 | expect { | ||
34 | timeout {puts "TESTING ERROR 3\n";exit} | ||
35 | "Cpus_allowed_list" | ||
36 | } | ||
37 | expect { | ||
38 | timeout {puts "TESTING ERROR 4\n";exit} | ||
39 | "name=test2" | ||
40 | } | ||
41 | |||
42 | after 100 | ||
43 | |||
44 | puts "\nall done\n" | ||
45 | |||
diff --git a/test/utils/firemon-seccomp.exp b/test/utils/firemon-seccomp.exp new file mode 100755 index 000000000..26c478344 --- /dev/null +++ b/test/utils/firemon-seccomp.exp | |||
@@ -0,0 +1,49 @@ | |||
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 --noprofile --name=bingo1 --seccomp\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 -- "firejail --noprofile --name=bingo2\r" | ||
19 | expect { | ||
20 | timeout {puts "TESTING ERROR 0.1\n";exit} | ||
21 | "Child process initialized" | ||
22 | } | ||
23 | sleep 1 | ||
24 | |||
25 | |||
26 | |||
27 | |||
28 | spawn $env(SHELL) | ||
29 | send -- "firemon --seccomp\r" | ||
30 | expect { | ||
31 | timeout {puts "TESTING ERROR 1\n";exit} | ||
32 | "need to be root" {puts "TESTING SKIP: /proc mounted as hidepid\n"; exit} | ||
33 | "bingo1" | ||
34 | } | ||
35 | expect { | ||
36 | timeout {puts "TESTING ERROR 2\n";exit} | ||
37 | "Seccomp: 2" | ||
38 | } | ||
39 | expect { | ||
40 | timeout {puts "TESTING ERROR 3\n";exit} | ||
41 | "bingo2" | ||
42 | } | ||
43 | expect { | ||
44 | timeout {puts "TESTING ERROR 4\n";exit} | ||
45 | "Seccomp: 0" | ||
46 | } | ||
47 | after 100 | ||
48 | |||
49 | puts "all done\n" | ||
diff --git a/test/utils/fs-print.exp b/test/utils/fs-print.exp new file mode 100755 index 000000000..4d4ceb718 --- /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 | after 100 | ||
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/join-profile.exp b/test/utils/join-profile.exp new file mode 100755 index 000000000..a2078c2f6 --- /dev/null +++ b/test/utils/join-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=name.profile\r" | ||
9 | expect { | ||
10 | timeout {puts "TESTING ERROR 0\n";exit} | ||
11 | "Child process initialized" | ||
12 | } | ||
13 | sleep 2 | ||
14 | |||
15 | spawn $env(SHELL) | ||
16 | send -- "firejail --join=jointesting\r" | ||
17 | expect { | ||
18 | timeout {puts "TESTING ERROR 1\n";exit} | ||
19 | "Switching to pid" | ||
20 | } | ||
21 | sleep 1 | ||
22 | send -- "ps aux\r" | ||
23 | expect { | ||
24 | timeout {puts "TESTING ERROR 2\n";exit} | ||
25 | "/bin/bash" | ||
26 | } | ||
27 | expect { | ||
28 | timeout {puts "TESTING ERROR 3\n";exit} | ||
29 | "/bin/bash" | ||
30 | } | ||
31 | |||
32 | send -- "exit" | ||
33 | after 100 | ||
34 | |||
35 | puts "\nall done\n" | ||
diff --git a/test/utils/join.exp b/test/utils/join.exp new file mode 100755 index 000000000..fc30bc6a4 --- /dev/null +++ b/test/utils/join.exp | |||
@@ -0,0 +1,38 @@ | |||
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 | cd /home | ||
8 | spawn $env(SHELL) | ||
9 | match_max 100000 | ||
10 | |||
11 | send -- "firejail --name=jointesting --cpu=0 --nice=2\r" | ||
12 | expect { | ||
13 | timeout {puts "TESTING ERROR 0\n";exit} | ||
14 | "Child process initialized" | ||
15 | } | ||
16 | sleep 2 | ||
17 | |||
18 | spawn $env(SHELL) | ||
19 | send -- "firejail --join=jointesting\r" | ||
20 | expect { | ||
21 | timeout {puts "TESTING ERROR 1\n";exit} | ||
22 | "Switching to pid" | ||
23 | } | ||
24 | sleep 1 | ||
25 | send -- "ps aux\r" | ||
26 | expect { | ||
27 | timeout {puts "TESTING ERROR 2\n";exit} | ||
28 | "/bin/bash" | ||
29 | } | ||
30 | expect { | ||
31 | timeout {puts "TESTING ERROR 3\n";exit} | ||
32 | "/bin/bash" | ||
33 | } | ||
34 | |||
35 | send -- "exit" | ||
36 | after 100 | ||
37 | |||
38 | puts "\nall done\n" | ||
diff --git a/test/utils/join2.exp b/test/utils/join2.exp new file mode 100755 index 000000000..5895eb730 --- /dev/null +++ b/test/utils/join2.exp | |||
@@ -0,0 +1,38 @@ | |||
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 | cd /home | ||
8 | spawn $env(SHELL) | ||
9 | match_max 100000 | ||
10 | |||
11 | send -- "firejail --name=\"join testing\"\r" | ||
12 | expect { | ||
13 | timeout {puts "TESTING ERROR 0\n";exit} | ||
14 | "Child process initialized" | ||
15 | } | ||
16 | sleep 2 | ||
17 | |||
18 | spawn $env(SHELL) | ||
19 | send -- "firejail --join=\"join testing\"\r" | ||
20 | expect { | ||
21 | timeout {puts "TESTING ERROR 1\n";exit} | ||
22 | "Switching to pid" | ||
23 | } | ||
24 | sleep 1 | ||
25 | send -- "ps aux\r" | ||
26 | expect { | ||
27 | timeout {puts "TESTING ERROR 2\n";exit} | ||
28 | "/bin/bash" | ||
29 | } | ||
30 | expect { | ||
31 | timeout {puts "TESTING ERROR 3\n";exit} | ||
32 | "/bin/bash" | ||
33 | } | ||
34 | |||
35 | send -- "exit" | ||
36 | after 100 | ||
37 | |||
38 | puts "\nall done\n" | ||
diff --git a/test/utils/join3.exp b/test/utils/join3.exp new file mode 100755 index 000000000..3ccc47bf9 --- /dev/null +++ b/test/utils/join3.exp | |||
@@ -0,0 +1,38 @@ | |||
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 | cd /home | ||
8 | spawn $env(SHELL) | ||
9 | match_max 100000 | ||
10 | |||
11 | send -- "firejail --name=join\\ testing\r" | ||
12 | expect { | ||
13 | timeout {puts "TESTING ERROR 0\n";exit} | ||
14 | "Child process initialized" | ||
15 | } | ||
16 | sleep 2 | ||
17 | |||
18 | spawn $env(SHELL) | ||
19 | send -- "firejail --join=join\\ testing\r" | ||
20 | expect { | ||
21 | timeout {puts "TESTING ERROR 1\n";exit} | ||
22 | "Switching to pid" | ||
23 | } | ||
24 | sleep 1 | ||
25 | send -- "ps aux\r" | ||
26 | expect { | ||
27 | timeout {puts "TESTING ERROR 2\n";exit} | ||
28 | "/bin/bash" | ||
29 | } | ||
30 | expect { | ||
31 | timeout {puts "TESTING ERROR 3\n";exit} | ||
32 | "/bin/bash" | ||
33 | } | ||
34 | |||
35 | send -- "exit" | ||
36 | after 100 | ||
37 | |||
38 | puts "\nall done\n" | ||
diff --git a/test/utils/join4.exp b/test/utils/join4.exp new file mode 100755 index 000000000..c367dd770 --- /dev/null +++ b/test/utils/join4.exp | |||
@@ -0,0 +1,38 @@ | |||
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 | cd /home | ||
8 | spawn $env(SHELL) | ||
9 | match_max 100000 | ||
10 | |||
11 | send -- "firejail --name=123test\r" | ||
12 | expect { | ||
13 | timeout {puts "TESTING ERROR 0\n";exit} | ||
14 | "Child process initialized" | ||
15 | } | ||
16 | sleep 2 | ||
17 | |||
18 | spawn $env(SHELL) | ||
19 | send -- "firejail --join=123test\r" | ||
20 | expect { | ||
21 | timeout {puts "TESTING ERROR 1\n";exit} | ||
22 | "Switching to pid" | ||
23 | } | ||
24 | sleep 1 | ||
25 | send -- "ps aux\r" | ||
26 | expect { | ||
27 | timeout {puts "TESTING ERROR 2\n";exit} | ||
28 | "/bin/bash" | ||
29 | } | ||
30 | expect { | ||
31 | timeout {puts "TESTING ERROR 3\n";exit} | ||
32 | "/bin/bash" | ||
33 | } | ||
34 | |||
35 | send -- "exit" | ||
36 | after 100 | ||
37 | |||
38 | puts "\nall done\n" | ||
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/ls.exp b/test/utils/ls.exp new file mode 100755 index 000000000..ff6867c51 --- /dev/null +++ b/test/utils/ls.exp | |||
@@ -0,0 +1,69 @@ | |||
1 | #!/usr/bin/expect -f | ||
2 | |||
3 | set timeout 10 | ||
4 | spawn $env(SHELL) | ||
5 | match_max 100000 | ||
6 | set firstspawn $spawn_id | ||
7 | |||
8 | |||
9 | send -- "rm -f lstesting\r" | ||
10 | sleep 1 | ||
11 | send -- "firejail --private --name=test\r" | ||
12 | expect { | ||
13 | timeout {puts "TESTING ERROR 0\n";exit} | ||
14 | "Child process initialized" | ||
15 | } | ||
16 | sleep 1 | ||
17 | send -- "echo my_testing > ~/lstesting\r" | ||
18 | after 100 | ||
19 | |||
20 | # ls | ||
21 | spawn $env(SHELL) | ||
22 | send -- "firejail --ls=test ~/.\r" | ||
23 | expect { | ||
24 | timeout {puts "TESTING ERROR 1\n";exit} | ||
25 | "lstesting" | ||
26 | } | ||
27 | sleep 1 | ||
28 | |||
29 | # get | ||
30 | send -- "firejail --get=test ~/lstesting\r" | ||
31 | sleep 1 | ||
32 | send -- "cat lstesting\r" | ||
33 | expect { | ||
34 | timeout {puts "TESTING ERROR 2n";exit} | ||
35 | "my_testing" | ||
36 | } | ||
37 | after 100 | ||
38 | |||
39 | # put | ||
40 | send -- "echo put_test > ~/lstesting\r" | ||
41 | after 100 | ||
42 | send -- "firejail --put=test ~/lstesting ~/lstesting_2\r" | ||
43 | sleep 1 | ||
44 | |||
45 | set spawn_id $firstspawn | ||
46 | send -- "ls -al ~\r" | ||
47 | expect { | ||
48 | timeout {puts "TESTING ERROR 3\n";exit} | ||
49 | "lstesting_2" | ||
50 | } | ||
51 | |||
52 | after 100 | ||
53 | send -- "cat ~/lstesting_2\r" | ||
54 | expect { | ||
55 | timeout {puts "TESTING ERROR 4\n";exit} | ||
56 | "put_test" | ||
57 | } | ||
58 | after 100 | ||
59 | send -- "exit\r" | ||
60 | sleep 1 | ||
61 | |||
62 | |||
63 | |||
64 | |||
65 | |||
66 | send -- "rm -f lstesting\r" | ||
67 | |||
68 | after 100 | ||
69 | puts "\nall done\n" | ||
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/name.profile b/test/utils/name.profile new file mode 100644 index 000000000..1aa9f2d64 --- /dev/null +++ b/test/utils/name.profile | |||
@@ -0,0 +1 @@ | |||
name jointesting | |||
diff --git a/test/utils/protocol-print.exp b/test/utils/protocol-print.exp new file mode 100755 index 000000000..b4b94ea93 --- /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 | after 100 | ||
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..f6ff1e721 --- /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 | after 100 | ||
36 | puts "\nall done\n" | ||
diff --git a/test/utils/shutdown.exp b/test/utils/shutdown.exp new file mode 100755 index 000000000..15a9a62c8 --- /dev/null +++ b/test/utils/shutdown.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 | cd /home | ||
8 | spawn $env(SHELL) | ||
9 | match_max 100000 | ||
10 | |||
11 | send -- "firejail --name=shutdowntesting\r" | ||
12 | expect { | ||
13 | timeout {puts "TESTING ERROR 0\n";exit} | ||
14 | "Child process initialized" | ||
15 | } | ||
16 | sleep 2 | ||
17 | |||
18 | spawn $env(SHELL) | ||
19 | send -- "firejail --shutdown=shutdowntesting; echo done\r" | ||
20 | expect { | ||
21 | timeout {puts "TESTING ERROR 4\n";exit} | ||
22 | "done" | ||
23 | } | ||
24 | sleep 5 | ||
25 | |||
26 | spawn $env(SHELL) | ||
27 | send -- "firejail --list;echo done\r" | ||
28 | expect { | ||
29 | timeout {puts "TESTING ERROR 5\n";exit} | ||
30 | "shutdowntesting" {puts "TESTING ERROR 6\n";exit} | ||
31 | "done" | ||
32 | } | ||
33 | sleep 1 | ||
34 | |||
35 | puts "\nall done\n" | ||
diff --git a/test/utils/shutdown2.exp b/test/utils/shutdown2.exp new file mode 100755 index 000000000..777a73ec9 --- /dev/null +++ b/test/utils/shutdown2.exp | |||
@@ -0,0 +1,45 @@ | |||
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 | set firstspawn $spawn_id | ||
11 | |||
12 | send -- "firejail --name=shutdowntesting ./catchsignal.sh\r" | ||
13 | expect { | ||
14 | timeout {puts "TESTING ERROR 0\n";exit} | ||
15 | "Child process initialized" | ||
16 | } | ||
17 | sleep 2 | ||
18 | |||
19 | spawn $env(SHELL) | ||
20 | send -- "firejail --shutdown=shutdowntesting\r" | ||
21 | |||
22 | set spawn_id $firstspawn | ||
23 | expect { | ||
24 | timeout {puts "TESTING ERROR 1\n";exit} | ||
25 | "1" | ||
26 | } | ||
27 | expect { | ||
28 | timeout {puts "TESTING ERROR 2\n";exit} | ||
29 | "2" | ||
30 | } | ||
31 | expect { | ||
32 | timeout {puts "TESTING ERROR 3\n";exit} | ||
33 | "3" | ||
34 | } | ||
35 | expect { | ||
36 | timeout {puts "TESTING ERROR 4\n";exit} | ||
37 | "4" | ||
38 | } | ||
39 | expect { | ||
40 | timeout {puts "TESTING ERROR 5\n";exit} | ||
41 | "5" | ||
42 | } | ||
43 | after 100 | ||
44 | |||
45 | puts "\nalldone\n" | ||
diff --git a/test/utils/shutdown3.exp b/test/utils/shutdown3.exp new file mode 100755 index 000000000..a74fb3386 --- /dev/null +++ b/test/utils/shutdown3.exp | |||
@@ -0,0 +1,65 @@ | |||
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 | set firstspawn $spawn_id | ||
11 | |||
12 | send -- "firejail --name=shutdowntesting ./catchsignal-master.sh\r" | ||
13 | expect { | ||
14 | timeout {puts "TESTING ERROR 0\n";exit} | ||
15 | "Child process initialized" | ||
16 | } | ||
17 | sleep 2 | ||
18 | |||
19 | spawn $env(SHELL) | ||
20 | send -- "firejail --shutdown=shutdowntesting\r" | ||
21 | |||
22 | set spawn_id $firstspawn | ||
23 | expect { | ||
24 | timeout {puts "TESTING ERROR 1\n";exit} | ||
25 | "1" | ||
26 | } | ||
27 | expect { | ||
28 | timeout {puts "TESTING ERROR 2\n";exit} | ||
29 | "1" | ||
30 | } | ||
31 | expect { | ||
32 | timeout {puts "TESTING ERROR 3\n";exit} | ||
33 | "2" | ||
34 | } | ||
35 | expect { | ||
36 | timeout {puts "TESTING ERROR 4\n";exit} | ||
37 | "2" | ||
38 | } | ||
39 | expect { | ||
40 | timeout {puts "TESTING ERROR 5\n";exit} | ||
41 | "3" | ||
42 | } | ||
43 | expect { | ||
44 | timeout {puts "TESTING ERROR 6\n";exit} | ||
45 | "3" | ||
46 | } | ||
47 | expect { | ||
48 | timeout {puts "TESTING ERROR 7\n";exit} | ||
49 | "4" | ||
50 | } | ||
51 | expect { | ||
52 | timeout {puts "TESTING ERROR 8\n";exit} | ||
53 | "4" | ||
54 | } | ||
55 | expect { | ||
56 | timeout {puts "TESTING ERROR 9\n";exit} | ||
57 | "5" | ||
58 | } | ||
59 | expect { | ||
60 | timeout {puts "TESTING ERROR 10\n";exit} | ||
61 | "5" | ||
62 | } | ||
63 | after 100 | ||
64 | |||
65 | puts "\nalldone\n" | ||
diff --git a/test/utils/shutdown4.exp b/test/utils/shutdown4.exp new file mode 100755 index 000000000..2942ba3d5 --- /dev/null +++ b/test/utils/shutdown4.exp | |||
@@ -0,0 +1,65 @@ | |||
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 | set firstspawn $spawn_id | ||
11 | |||
12 | send -- "firejail --name=shutdowntesting ./catchsignal2.sh\r" | ||
13 | expect { | ||
14 | timeout {puts "TESTING ERROR 0\n";exit} | ||
15 | "Child process initialized" | ||
16 | } | ||
17 | sleep 2 | ||
18 | |||
19 | spawn $env(SHELL) | ||
20 | send -- "firejail --shutdown=shutdowntesting\r" | ||
21 | |||
22 | set spawn_id $firstspawn | ||
23 | expect { | ||
24 | timeout {puts "TESTING ERROR 1\n";exit} | ||
25 | "1" | ||
26 | } | ||
27 | expect { | ||
28 | timeout {puts "TESTING ERROR 2\n";exit} | ||
29 | "2" | ||
30 | } | ||
31 | expect { | ||
32 | timeout {puts "TESTING ERROR 3\n";exit} | ||
33 | "3" | ||
34 | } | ||
35 | expect { | ||
36 | timeout {puts "TESTING ERROR 4\n";exit} | ||
37 | "4" | ||
38 | } | ||
39 | expect { | ||
40 | timeout {puts "TESTING ERROR 5\n";exit} | ||
41 | "5" | ||
42 | } | ||
43 | expect { | ||
44 | timeout {puts "TESTING ERROR 10\n";exit} | ||
45 | "10" | ||
46 | } | ||
47 | expect { | ||
48 | timeout {puts "TESTING ERROR 20\n";exit} | ||
49 | "20" | ||
50 | } | ||
51 | expect { | ||
52 | timeout {puts "TESTING ERROR 30\n";exit} | ||
53 | "30" | ||
54 | } | ||
55 | expect { | ||
56 | timeout {puts "TESTING ERROR 40\n";exit} | ||
57 | "40" | ||
58 | } | ||
59 | expect { | ||
60 | timeout {puts "TESTING ERROR 50\n";exit} | ||
61 | "50" | ||
62 | } | ||
63 | after 100 | ||
64 | |||
65 | puts "\nalldone\n" | ||
diff --git a/test/utils/top.exp b/test/utils/top.exp new file mode 100755 index 000000000..d530e5a85 --- /dev/null +++ b/test/utils/top.exp | |||
@@ -0,0 +1,40 @@ | |||
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=test1\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 -- "firejail --name=test2\r" | ||
19 | expect { | ||
20 | timeout {puts "TESTING ERROR 1\n";exit} | ||
21 | "Child process initialized" | ||
22 | } | ||
23 | sleep 1 | ||
24 | |||
25 | spawn $env(SHELL) | ||
26 | send -- "firejail --top\r" | ||
27 | sleep 4 | ||
28 | expect { | ||
29 | timeout {puts "TESTING ERROR 2\n";exit} | ||
30 | "name=test1" | ||
31 | } | ||
32 | expect { | ||
33 | timeout {puts "TESTING ERROR 2\n";exit} | ||
34 | "name=test2" | ||
35 | } | ||
36 | |||
37 | after 100 | ||
38 | |||
39 | puts "\nall done\n" | ||
40 | |||
diff --git a/test/utils/trace.exp b/test/utils/trace.exp new file mode 100755 index 000000000..78a04b273 --- /dev/null +++ b/test/utils/trace.exp | |||
@@ -0,0 +1,115 @@ | |||
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 30 | ||
7 | spawn $env(SHELL) | ||
8 | match_max 100000 | ||
9 | |||
10 | send -- "firejail --trace mkdir ttt\r" | ||
11 | expect { | ||
12 | timeout {puts "TESTING ERROR 0\n";exit} | ||
13 | "Child process initialized" | ||
14 | } | ||
15 | expect { | ||
16 | timeout {puts "TESTING ERROR 1\n";exit} | ||
17 | "mkdir:mkdir ttt" | ||
18 | } | ||
19 | sleep 1 | ||
20 | |||
21 | send -- "firejail --trace rmdir ttt\r" | ||
22 | expect { | ||
23 | timeout {puts "TESTING ERROR 2\n";exit} | ||
24 | "Child process initialized" | ||
25 | } | ||
26 | expect { | ||
27 | timeout {puts "TESTING ERROR 3\n";exit} | ||
28 | "rmdir:rmdir ttt" | ||
29 | } | ||
30 | sleep 1 | ||
31 | |||
32 | send -- "firejail --trace touch ttt\r" | ||
33 | expect { | ||
34 | timeout {puts "TESTING ERROR 4\n";exit} | ||
35 | "Child process initialized" | ||
36 | } | ||
37 | expect { | ||
38 | timeout {puts "TESTING ERROR 5\n";exit} | ||
39 | "touch:open ttt" {puts "OK\n";} | ||
40 | "touch:open64 ttt" {puts "OK\n";} | ||
41 | } | ||
42 | sleep 1 | ||
43 | |||
44 | send -- "firejail --trace rm ttt\r" | ||
45 | expect { | ||
46 | timeout {puts "TESTING ERROR 6\n";exit} | ||
47 | "Child process initialized" | ||
48 | } | ||
49 | expect { | ||
50 | timeout {puts "TESTING ERROR 7\n";exit} | ||
51 | "rm:unlinkat ttt" | ||
52 | } | ||
53 | sleep 1 | ||
54 | |||
55 | send -- "firejail --trace wget -q debian.org\r" | ||
56 | expect { | ||
57 | timeout {puts "TESTING ERROR 8.1\n";exit} | ||
58 | "Child process initialized" | ||
59 | } | ||
60 | expect { | ||
61 | timeout {puts "TESTING ERROR 8.2\n";exit} | ||
62 | "bash:open /dev/tty" {puts "OK\n";} | ||
63 | "bash:open64 /dev/tty" {puts "OK\n";} | ||
64 | } | ||
65 | expect { | ||
66 | timeout {puts "TESTING ERROR 8.3\n";exit} | ||
67 | "wget:fopen64 /etc/wgetrc" {puts "OK\n";} | ||
68 | "wget:fopen /etc/wgetrc" {puts "OK\n";} | ||
69 | } | ||
70 | expect { | ||
71 | timeout {puts "TESTING ERROR 8.4\n";exit} | ||
72 | "wget:fopen /etc/hosts" | ||
73 | } | ||
74 | expect { | ||
75 | timeout {puts "TESTING ERROR 8.5\n";exit} | ||
76 | "wget:connect" | ||
77 | } | ||
78 | expect { | ||
79 | timeout {puts "TESTING ERROR 8.6\n";exit} | ||
80 | "wget:fopen64 index.html" {puts "OK\n";} | ||
81 | "wget:fopen index.html" {puts "OK\n";} | ||
82 | "Parent is shutting down" {puts "OK\n";} | ||
83 | } | ||
84 | sleep 1 | ||
85 | |||
86 | send -- "firejail --trace rm index.html\r" | ||
87 | expect { | ||
88 | timeout {puts "TESTING ERROR 9\n";exit} | ||
89 | "Child process initialized" | ||
90 | } | ||
91 | expect { | ||
92 | timeout {puts "TESTING ERROR 10\n";exit} | ||
93 | "rm:unlinkat index.html" {puts "OK\n";} | ||
94 | "Parent is shutting down" {puts "OK\n";} | ||
95 | } | ||
96 | sleep 1 | ||
97 | |||
98 | send -- "firejail --trace\r" | ||
99 | expect { | ||
100 | timeout {puts "TESTING ERROR 11\n";exit} | ||
101 | "Child process initialized" | ||
102 | } | ||
103 | expect { | ||
104 | timeout {puts "TESTING ERROR 12\n";exit} | ||
105 | "bash:open /dev/tty" {puts "64bit\n"} | ||
106 | "bash:open64 /dev/tty" {puts "32bit\n"} | ||
107 | } | ||
108 | expect { | ||
109 | timeout {puts "TESTING ERROR 13\n";exit} | ||
110 | "bash:access /etc/terminfo/" {puts "debian\n"} | ||
111 | "bash:access /usr/share/terminfo/" {puts "arch\n"} | ||
112 | } | ||
113 | after 100 | ||
114 | |||
115 | 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..bd91110f7 --- /dev/null +++ b/test/utils/utils.sh | |||
@@ -0,0 +1,102 @@ | |||
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 | which man | ||
16 | if [ "$?" -eq 0 ]; | ||
17 | then | ||
18 | echo "TESTING: man (test/utils/man.exp)" | ||
19 | ./man.exp | ||
20 | else | ||
21 | echo "TESTING SKIP: man not found" | ||
22 | fi | ||
23 | |||
24 | echo "TESTING: list (test/utils/list.exp)" | ||
25 | ./list.exp | ||
26 | |||
27 | echo "TESTING: tree (test/utils/tree.exp)" | ||
28 | ./tree.exp | ||
29 | |||
30 | if [ $(grep -c ^processor /proc/cpuinfo) -gt 1 ]; | ||
31 | then | ||
32 | echo "TESTING: cpu.print (test/utils/cpu-print.exp)" | ||
33 | ./cpu-print.exp | ||
34 | else | ||
35 | echo "TESTING SKIP: cpu.print, not enough CPUs" | ||
36 | fi | ||
37 | |||
38 | echo "TESTING: fs.print (test/utils/fs-print.exp)" | ||
39 | ./fs-print.exp | ||
40 | |||
41 | echo "TESTING: dns.print (test/utils/dns-print.exp)" | ||
42 | ./dns-print.exp | ||
43 | |||
44 | echo "TESTING: caps.print (test/utils/caps-print.exp)" | ||
45 | ./caps-print.exp | ||
46 | |||
47 | echo "TESTING: seccomp.print (test/utils/seccomp-print.exp)" | ||
48 | ./seccomp-print.exp | ||
49 | |||
50 | echo "TESTING: protocol.print (test/utils/protocol-print.exp)" | ||
51 | ./protocol-print.exp | ||
52 | |||
53 | echo "TESTING: shutdown (test/utils/shutdown.exp)" | ||
54 | ./shutdown.exp | ||
55 | |||
56 | echo "TESTING: shutdown2 (test/utils/shutdown2.exp)" | ||
57 | ./shutdown2.exp | ||
58 | |||
59 | echo "TESTING: shutdown3 (test/utils/shutdown3.exp)" | ||
60 | ./shutdown3.exp | ||
61 | |||
62 | echo "TESTING: shutdown4 (test/utils/shutdown4.exp)" | ||
63 | ./shutdown4.exp | ||
64 | |||
65 | echo "TESTING: join (test/utils/join.exp)" | ||
66 | ./join.exp | ||
67 | |||
68 | echo "TESTING: join2 (test/utils/join2.exp)" | ||
69 | ./join2.exp | ||
70 | |||
71 | echo "TESTING: join3 (test/utils/join3.exp)" | ||
72 | ./join3.exp | ||
73 | |||
74 | echo "TESTING: join3 (test/utils/join4.exp)" | ||
75 | ./join4.exp | ||
76 | |||
77 | echo "TESTING: join profile (test/utils/join-profile.exp)" | ||
78 | ./join-profile.exp | ||
79 | |||
80 | echo "TESTING: trace (test/utils/trace.exp)" | ||
81 | rm -f index.html* | ||
82 | ./trace.exp | ||
83 | rm -f index.html* | ||
84 | |||
85 | echo "TESTING: top (test/utils/top.exp)" | ||
86 | ./top.exp | ||
87 | |||
88 | echo "TESTING: file transfer (test/utils/ls.exp)" | ||
89 | ./ls.exp | ||
90 | |||
91 | echo "TESTING: firemon seccomp (test/utils/firemon-seccomp.exp)" | ||
92 | ./firemon-seccomp.exp | ||
93 | |||
94 | echo "TESTING: firemon caps (test/utils/firemon-caps.exp)" | ||
95 | ./firemon-caps.exp | ||
96 | |||
97 | echo "TESTING: firemon cpu (test/utils/firemon-cpu.exp)" | ||
98 | ./firemon-cpu.exp | ||
99 | |||
100 | echo "TESTING: firemon cgroup (test/utils/firemon-cgroup.exp)" | ||
101 | ./firemon-cgroup.exp | ||
102 | |||
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 | |||