diff options
author | netblue30 <netblue30@yahoo.com> | 2016-06-13 12:04:35 -0400 |
---|---|---|
committer | netblue30 <netblue30@yahoo.com> | 2016-06-13 12:04:35 -0400 |
commit | 3cc86927c990f85326d4b6f6b8b9d8ee9d8613e5 (patch) | |
tree | 10aa4fa9e2827a08df2441b1442f40aeba4a6855 /test/environment | |
parent | configure.ac fixes (diff) | |
download | firejail-3cc86927c990f85326d4b6f6b8b9d8ee9d8613e5.tar.gz firejail-3cc86927c990f85326d4b6f6b8b9d8ee9d8613e5.tar.zst firejail-3cc86927c990f85326d4b6f6b8b9d8ee9d8613e5.zip |
testing
Diffstat (limited to 'test/environment')
-rwxr-xr-x | test/environment/dns.exp | 30 | ||||
-rwxr-xr-x | test/environment/doubledash.exp | 60 | ||||
-rwxr-xr-x | test/environment/environment.sh | 16 | ||||
-rwxr-xr-x | test/environment/extract_command.exp | 23 | ||||
-rwxr-xr-x | test/environment/output.exp | 65 | ||||
-rwxr-xr-x | test/environment/output.sh | 9 |
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 | |||
3 | set timeout 30 | ||
4 | spawn $env(SHELL) | ||
5 | match_max 100000 | ||
6 | |||
7 | # no chroot | ||
8 | send -- "firejail --trace --dns=208.67.222.222 wget -q debian.org\r" | ||
9 | expect { | ||
10 | timeout {puts "TESTING ERROR 1.1\n";exit} | ||
11 | "Child process initialized" | ||
12 | } | ||
13 | expect { | ||
14 | timeout {puts "TESTING ERROR 1.2\n";exit} | ||
15 | "connect" | ||
16 | } | ||
17 | expect { | ||
18 | timeout {puts "TESTING ERROR 1.2\n";exit} | ||
19 | "208.67.222.222" | ||
20 | } | ||
21 | expect { | ||
22 | timeout {puts "TESTING ERROR 1.2\n";exit} | ||
23 | "53" | ||
24 | } | ||
25 | |||
26 | after 100 | ||
27 | |||
28 | send -- "rm index.html\r" | ||
29 | after 100 | ||
30 | puts "\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 | |||
3 | set timeout 10 | ||
4 | spawn $env(SHELL) | ||
5 | match_max 100000 | ||
6 | |||
7 | send -- "firejail -- ls -- -testdir\r" | ||
8 | expect { | ||
9 | timeout {puts "TESTING ERROR 1\n";exit} | ||
10 | "Child process initialized" | ||
11 | } | ||
12 | expect { | ||
13 | timeout {puts "TESTING ERROR 2\n";exit} | ||
14 | "ttt" | ||
15 | } | ||
16 | expect { | ||
17 | timeout {puts "TESTING ERROR 3\n";exit} | ||
18 | "Parent is shutting down" | ||
19 | } | ||
20 | sleep 1 | ||
21 | |||
22 | |||
23 | send -- "firejail --name=testing -- -testdir/bash\r" | ||
24 | expect { | ||
25 | timeout {puts "TESTING ERROR 4\n";exit} | ||
26 | "Child process initialized" | ||
27 | } | ||
28 | sleep 3 | ||
29 | |||
30 | spawn $env(SHELL) | ||
31 | send -- "firejail --join=testing -- -testdir/bash\r" | ||
32 | expect { | ||
33 | timeout {puts "TESTING ERROR 5\n";exit} | ||
34 | "the first child process inside the sandbox" | ||
35 | } | ||
36 | sleep 3 | ||
37 | |||
38 | spawn $env(SHELL) | ||
39 | send -- "firejail --list;pwd\r" | ||
40 | expect { | ||
41 | timeout {puts "TESTING ERROR 6\n";exit} | ||
42 | "name=testing" | ||
43 | } | ||
44 | expect { | ||
45 | timeout {puts "TESTING ERROR 7\n";exit} | ||
46 | "home" | ||
47 | } | ||
48 | send -- "firejail --list;pwd\r" | ||
49 | expect { | ||
50 | timeout {puts "TESTING ERROR 8 (join)\n";exit} | ||
51 | "join=testing" | ||
52 | } | ||
53 | expect { | ||
54 | timeout {puts "TESTING ERROR 9\n";exit} | ||
55 | "home" | ||
56 | } | ||
57 | |||
58 | sleep 1 | ||
59 | |||
60 | puts "\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 @@ | |||
6 | export MALLOC_CHECK_=3 | 6 | export MALLOC_CHECK_=3 |
7 | export MALLOC_PERTURB_=$(($RANDOM % 255 + 1)) | 7 | export MALLOC_PERTURB_=$(($RANDOM % 255 + 1)) |
8 | 8 | ||
9 | echo "TESTING: DNS (test/environment/dns.exp)" | ||
10 | ./dns.exp | ||
11 | |||
12 | echo "TESTING: doubledash (test/environment/doubledash.exp" | ||
13 | mkdir -- -testdir | ||
14 | touch -- -testdir/ttt | ||
15 | cp -- /bin/bash -testdir/. | ||
16 | ./doubledash.exp | ||
17 | rm -fr -- -testdir | ||
18 | |||
19 | echo "TESTING: output (test/environment/output.exp)" | ||
20 | ./output.exp | ||
21 | |||
22 | echo "TESTING: extract command (extract_command.exp)" | ||
23 | ./extract_command.exp | ||
24 | |||
9 | echo "TESTING: environment variables (test/environment/env.exp)" | 25 | echo "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 | |||
3 | set timeout 10 | ||
4 | spawn $env(SHELL) | ||
5 | match_max 100000 | ||
6 | |||
7 | send -- "firejail --debug ls -al\r" | ||
8 | expect { | ||
9 | timeout {puts "TESTING ERROR 0\n";exit} | ||
10 | "Reading profile /etc/firejail/default.profile" | ||
11 | } | ||
12 | expect { | ||
13 | timeout {puts "TESTING ERROR 2\n";exit} | ||
14 | "Child process initialized" | ||
15 | } | ||
16 | expect { | ||
17 | timeout {puts "TESTING ERROR 2\n";exit} | ||
18 | "Parent is shutting down, bye" | ||
19 | } | ||
20 | after 100 | ||
21 | |||
22 | puts "\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 | |||
3 | set timeout 10 | ||
4 | spawn $env(SHELL) | ||
5 | match_max 100000 | ||
6 | |||
7 | send -- "rm -f logfile*\r" | ||
8 | sleep 1 | ||
9 | puts "\n" | ||
10 | |||
11 | send -- "firejail --output=logfile -- ./output.sh\r" | ||
12 | expect { | ||
13 | timeout {puts "TESTING ERROR 1\n";exit} | ||
14 | "20000" | ||
15 | } | ||
16 | expect { | ||
17 | timeout {puts "TESTING ERROR 1.1\n";exit} | ||
18 | "60000" | ||
19 | } | ||
20 | expect { | ||
21 | timeout {puts "TESTING ERROR 1.2\n";exit} | ||
22 | "100000" | ||
23 | } | ||
24 | expect { | ||
25 | timeout {puts "TESTING ERROR 1.3\n";exit} | ||
26 | "120000" | ||
27 | } | ||
28 | expect { | ||
29 | timeout {puts "TESTING ERROR 1.4\n";exit} | ||
30 | "14999" | ||
31 | } | ||
32 | sleep 2 | ||
33 | puts "\n" | ||
34 | |||
35 | |||
36 | set timeout 2 | ||
37 | send -- "ls -al logfile*\r" | ||
38 | expect { | ||
39 | timeout {puts "TESTING ERROR 2\n";exit} | ||
40 | "logfile" | ||
41 | } | ||
42 | expect { | ||
43 | timeout {puts "TESTING ERROR 3\n";exit} | ||
44 | "logfile.1" | ||
45 | } | ||
46 | expect { | ||
47 | timeout {puts "TESTING ERROR 4\n";exit} | ||
48 | "logfile.2" | ||
49 | } | ||
50 | expect { | ||
51 | timeout {puts "TESTING ERROR 5\n";exit} | ||
52 | "logfile.3" | ||
53 | } | ||
54 | expect { | ||
55 | timeout {puts "TESTING ERROR 6\n";exit} | ||
56 | "logfile.4" | ||
57 | } | ||
58 | expect { | ||
59 | timeout {puts "TESTING ERROR 7\n";exit} | ||
60 | "logfile.5" | ||
61 | } | ||
62 | after 100 | ||
63 | send -- "rm -f logfile*\r" | ||
64 | after 100 | ||
65 | puts "\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 | |||
3 | i="0" | ||
4 | |||
5 | while [ $i -lt 150000 ] | ||
6 | do | ||
7 | echo message number $i | ||
8 | i=$[$i+1] | ||
9 | done | ||