aboutsummaryrefslogtreecommitdiffstats
path: root/test/environment
diff options
context:
space:
mode:
authorLibravatar netblue30 <netblue30@yahoo.com>2016-06-13 12:04:35 -0400
committerLibravatar netblue30 <netblue30@yahoo.com>2016-06-13 12:04:35 -0400
commit3cc86927c990f85326d4b6f6b8b9d8ee9d8613e5 (patch)
tree10aa4fa9e2827a08df2441b1442f40aeba4a6855 /test/environment
parentconfigure.ac fixes (diff)
downloadfirejail-3cc86927c990f85326d4b6f6b8b9d8ee9d8613e5.tar.gz
firejail-3cc86927c990f85326d4b6f6b8b9d8ee9d8613e5.tar.zst
firejail-3cc86927c990f85326d4b6f6b8b9d8ee9d8613e5.zip
testing
Diffstat (limited to 'test/environment')
-rwxr-xr-xtest/environment/dns.exp30
-rwxr-xr-xtest/environment/doubledash.exp60
-rwxr-xr-xtest/environment/environment.sh16
-rwxr-xr-xtest/environment/extract_command.exp23
-rwxr-xr-xtest/environment/output.exp65
-rwxr-xr-xtest/environment/output.sh9
6 files changed, 203 insertions, 0 deletions
diff --git a/test/environment/dns.exp b/test/environment/dns.exp
new file mode 100755
index 000000000..6ffb124cf
--- /dev/null
+++ b/test/environment/dns.exp
@@ -0,0 +1,30 @@
1#!/usr/bin/expect -f
2
3set timeout 30
4spawn $env(SHELL)
5match_max 100000
6
7# no chroot
8send -- "firejail --trace --dns=208.67.222.222 wget -q debian.org\r"
9expect {
10 timeout {puts "TESTING ERROR 1.1\n";exit}
11 "Child process initialized"
12}
13expect {
14 timeout {puts "TESTING ERROR 1.2\n";exit}
15 "connect"
16}
17expect {
18 timeout {puts "TESTING ERROR 1.2\n";exit}
19 "208.67.222.222"
20}
21expect {
22 timeout {puts "TESTING ERROR 1.2\n";exit}
23 "53"
24}
25
26after 100
27
28send -- "rm index.html\r"
29after 100
30puts "\nall done\n"
diff --git a/test/environment/doubledash.exp b/test/environment/doubledash.exp
new file mode 100755
index 000000000..668468980
--- /dev/null
+++ b/test/environment/doubledash.exp
@@ -0,0 +1,60 @@
1#!/usr/bin/expect -f
2
3set timeout 10
4spawn $env(SHELL)
5match_max 100000
6
7send -- "firejail -- ls -- -testdir\r"
8expect {
9 timeout {puts "TESTING ERROR 1\n";exit}
10 "Child process initialized"
11}
12expect {
13 timeout {puts "TESTING ERROR 2\n";exit}
14 "ttt"
15}
16expect {
17 timeout {puts "TESTING ERROR 3\n";exit}
18 "Parent is shutting down"
19}
20sleep 1
21
22
23send -- "firejail --name=testing -- -testdir/bash\r"
24expect {
25 timeout {puts "TESTING ERROR 4\n";exit}
26 "Child process initialized"
27}
28sleep 3
29
30spawn $env(SHELL)
31send -- "firejail --join=testing -- -testdir/bash\r"
32expect {
33 timeout {puts "TESTING ERROR 5\n";exit}
34 "the first child process inside the sandbox"
35}
36sleep 3
37
38spawn $env(SHELL)
39send -- "firejail --list;pwd\r"
40expect {
41 timeout {puts "TESTING ERROR 6\n";exit}
42 "name=testing"
43}
44expect {
45 timeout {puts "TESTING ERROR 7\n";exit}
46 "home"
47}
48send -- "firejail --list;pwd\r"
49expect {
50 timeout {puts "TESTING ERROR 8 (join)\n";exit}
51 "join=testing"
52}
53expect {
54 timeout {puts "TESTING ERROR 9\n";exit}
55 "home"
56}
57
58sleep 1
59
60puts "\n"
diff --git a/test/environment/environment.sh b/test/environment/environment.sh
index 49b50797a..a6fe07a1c 100755
--- a/test/environment/environment.sh
+++ b/test/environment/environment.sh
@@ -6,6 +6,22 @@
6export MALLOC_CHECK_=3 6export MALLOC_CHECK_=3
7export MALLOC_PERTURB_=$(($RANDOM % 255 + 1)) 7export MALLOC_PERTURB_=$(($RANDOM % 255 + 1))
8 8
9echo "TESTING: DNS (test/environment/dns.exp)"
10./dns.exp
11
12echo "TESTING: doubledash (test/environment/doubledash.exp"
13mkdir -- -testdir
14touch -- -testdir/ttt
15cp -- /bin/bash -testdir/.
16./doubledash.exp
17rm -fr -- -testdir
18
19echo "TESTING: output (test/environment/output.exp)"
20./output.exp
21
22echo "TESTING: extract command (extract_command.exp)"
23./extract_command.exp
24
9echo "TESTING: environment variables (test/environment/env.exp)" 25echo "TESTING: environment variables (test/environment/env.exp)"
10./env.exp 26./env.exp
11 27
diff --git a/test/environment/extract_command.exp b/test/environment/extract_command.exp
new file mode 100755
index 000000000..266f66ff5
--- /dev/null
+++ b/test/environment/extract_command.exp
@@ -0,0 +1,23 @@
1#!/usr/bin/expect -f
2
3set timeout 10
4spawn $env(SHELL)
5match_max 100000
6
7send -- "firejail --debug ls -al\r"
8expect {
9 timeout {puts "TESTING ERROR 0\n";exit}
10 "Reading profile /etc/firejail/default.profile"
11}
12expect {
13 timeout {puts "TESTING ERROR 2\n";exit}
14 "Child process initialized"
15}
16expect {
17 timeout {puts "TESTING ERROR 2\n";exit}
18 "Parent is shutting down, bye"
19}
20after 100
21
22puts "\nall done\n"
23
diff --git a/test/environment/output.exp b/test/environment/output.exp
new file mode 100755
index 000000000..10c325832
--- /dev/null
+++ b/test/environment/output.exp
@@ -0,0 +1,65 @@
1#!/usr/bin/expect -f
2
3set timeout 10
4spawn $env(SHELL)
5match_max 100000
6
7send -- "rm -f logfile*\r"
8sleep 1
9puts "\n"
10
11send -- "firejail --output=logfile -- ./output.sh\r"
12expect {
13 timeout {puts "TESTING ERROR 1\n";exit}
14 "20000"
15}
16expect {
17 timeout {puts "TESTING ERROR 1.1\n";exit}
18 "60000"
19}
20expect {
21 timeout {puts "TESTING ERROR 1.2\n";exit}
22 "100000"
23}
24expect {
25 timeout {puts "TESTING ERROR 1.3\n";exit}
26 "120000"
27}
28expect {
29 timeout {puts "TESTING ERROR 1.4\n";exit}
30 "14999"
31}
32sleep 2
33puts "\n"
34
35
36set timeout 2
37send -- "ls -al logfile*\r"
38expect {
39 timeout {puts "TESTING ERROR 2\n";exit}
40 "logfile"
41}
42expect {
43 timeout {puts "TESTING ERROR 3\n";exit}
44 "logfile.1"
45}
46expect {
47 timeout {puts "TESTING ERROR 4\n";exit}
48 "logfile.2"
49}
50expect {
51 timeout {puts "TESTING ERROR 5\n";exit}
52 "logfile.3"
53}
54expect {
55 timeout {puts "TESTING ERROR 6\n";exit}
56 "logfile.4"
57}
58expect {
59 timeout {puts "TESTING ERROR 7\n";exit}
60 "logfile.5"
61}
62after 100
63send -- "rm -f logfile*\r"
64after 100
65puts "\nall done\n"
diff --git a/test/environment/output.sh b/test/environment/output.sh
new file mode 100755
index 000000000..2be188e3a
--- /dev/null
+++ b/test/environment/output.sh
@@ -0,0 +1,9 @@
1#!/bin/bash
2
3i="0"
4
5while [ $i -lt 150000 ]
6do
7 echo message number $i
8 i=$[$i+1]
9done