diff options
Diffstat (limited to 'test/environment')
-rwxr-xr-x | test/environment/csh.exp | 43 | ||||
-rwxr-xr-x | test/environment/dash.exp | 41 | ||||
-rwxr-xr-x | test/environment/env.exp | 58 | ||||
-rw-r--r-- | test/environment/env.profile | 2 | ||||
-rwxr-xr-x | test/environment/environment.sh | 47 | ||||
-rwxr-xr-x | test/environment/firejail-in-firejail.exp | 24 | ||||
-rwxr-xr-x | test/environment/firejail-in-firejail2.exp | 24 | ||||
-rwxr-xr-x | test/environment/rlimit-profile.exp | 36 | ||||
-rwxr-xr-x | test/environment/rlimit.exp | 36 | ||||
-rw-r--r-- | test/environment/rlimit.profile | 4 | ||||
-rwxr-xr-x | test/environment/shell-none.exp | 48 | ||||
-rw-r--r-- | test/environment/shell-none.profile | 1 | ||||
-rwxr-xr-x | test/environment/zsh.exp | 43 |
13 files changed, 407 insertions, 0 deletions
diff --git a/test/environment/csh.exp b/test/environment/csh.exp new file mode 100755 index 000000000..10ad3607e --- /dev/null +++ b/test/environment/csh.exp | |||
@@ -0,0 +1,43 @@ | |||
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 --private --tracelog --csh\r" | ||
11 | expect { | ||
12 | timeout {puts "TESTING ERROR 0\n";exit} | ||
13 | "Child process initialized" | ||
14 | } | ||
15 | sleep 1 | ||
16 | |||
17 | send -- "ls -al;pwd\r" | ||
18 | expect { | ||
19 | timeout {puts "TESTING ERROR 1\n";exit} | ||
20 | ".cshrc" | ||
21 | } | ||
22 | expect { | ||
23 | timeout {puts "TESTING ERROR 1.1\n";exit} | ||
24 | "home" | ||
25 | } | ||
26 | send -- "env | grep SHELL;pwd\r" | ||
27 | expect { | ||
28 | timeout {puts "TESTING ERROR 2\n";exit} | ||
29 | "SHELL" | ||
30 | } | ||
31 | expect { | ||
32 | timeout {puts "TESTING ERROR 2.1\n";exit} | ||
33 | "/bin/csh" | ||
34 | } | ||
35 | expect { | ||
36 | timeout {puts "TESTING ERROR 2.2\n";exit} | ||
37 | "home" | ||
38 | } | ||
39 | send -- "exit\r" | ||
40 | sleep 1 | ||
41 | |||
42 | puts "\n" | ||
43 | |||
diff --git a/test/environment/dash.exp b/test/environment/dash.exp new file mode 100755 index 000000000..f5a60719e --- /dev/null +++ b/test/environment/dash.exp | |||
@@ -0,0 +1,41 @@ | |||
1 | #!/usr/bin/expect -f | ||
2 | |||
3 | set timeout 10 | ||
4 | spawn $env(SHELL) | ||
5 | match_max 100000 | ||
6 | |||
7 | send -- "firejail --private --tracelog --shell=/bin/dash\r" | ||
8 | expect { | ||
9 | timeout {puts "TESTING ERROR 0\n";exit} | ||
10 | "Child process initialized" | ||
11 | } | ||
12 | sleep 1 | ||
13 | |||
14 | #send -- "ls -al;pwd\r" | ||
15 | #expect { | ||
16 | # timeout {puts "TESTING ERROR 1\n";exit} | ||
17 | # ".zshrc" | ||
18 | #} | ||
19 | #expect { | ||
20 | # timeout {puts "TESTING ERROR 1.1\n";exit} | ||
21 | # "home" | ||
22 | #} | ||
23 | |||
24 | send -- "env | grep SHELL;pwd\r" | ||
25 | expect { | ||
26 | timeout {puts "TESTING ERROR 2\n";exit} | ||
27 | "SHELL" | ||
28 | } | ||
29 | expect { | ||
30 | timeout {puts "TESTING ERROR 2.1\n";exit} | ||
31 | "/bin/dash" | ||
32 | } | ||
33 | expect { | ||
34 | timeout {puts "TESTING ERROR 2.2\n";exit} | ||
35 | "home" | ||
36 | } | ||
37 | send -- "exit\r" | ||
38 | sleep 1 | ||
39 | |||
40 | puts "\n" | ||
41 | |||
diff --git a/test/environment/env.exp b/test/environment/env.exp new file mode 100755 index 000000000..a09c3f9c5 --- /dev/null +++ b/test/environment/env.exp | |||
@@ -0,0 +1,58 @@ | |||
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 | #*********************************************** | ||
11 | send -- "firejail --env=ENV1=env1 --env=ENV2=env2 --env=ENV3=env3\r" | ||
12 | expect { | ||
13 | timeout {puts "TESTING ERROR 0\n";exit} | ||
14 | "Child process initialized" | ||
15 | } | ||
16 | sleep 1 | ||
17 | |||
18 | send -- "env | grep ENV1\r" | ||
19 | expect { | ||
20 | timeout {puts "TESTING ERROR 1\n";exit} | ||
21 | "ENV1" | ||
22 | } | ||
23 | send -- "env | grep ENV2\r" | ||
24 | expect { | ||
25 | timeout {puts "TESTING ERROR 2\n";exit} | ||
26 | "ENV2" | ||
27 | } | ||
28 | send -- "env | grep ENV3\r" | ||
29 | expect { | ||
30 | timeout {puts "TESTING ERROR 3\n";exit} | ||
31 | "ENV3" | ||
32 | } | ||
33 | send -- "exit\r" | ||
34 | sleep 1 | ||
35 | |||
36 | #*********************************************** | ||
37 | send -- "firejail --profile=env.profile\r" | ||
38 | expect { | ||
39 | timeout {puts "TESTING ERROR 4\n";exit} | ||
40 | "Child process initialized" | ||
41 | } | ||
42 | sleep 1 | ||
43 | send -- "env | grep LD_LIBRARY_PATH\r" | ||
44 | expect { | ||
45 | timeout {puts "TESTING ERROR 5\n";exit} | ||
46 | "/opt/test/lib" | ||
47 | } | ||
48 | send -- "env | grep CFLAGS\r" | ||
49 | expect { | ||
50 | timeout {puts "TESTING ERROR 6\n";exit} | ||
51 | "Wall" | ||
52 | } | ||
53 | expect { | ||
54 | timeout {puts "TESTING ERROR 7\n";exit} | ||
55 | "Werror" | ||
56 | } | ||
57 | |||
58 | puts "\nall done\n" | ||
diff --git a/test/environment/env.profile b/test/environment/env.profile new file mode 100644 index 000000000..ba66e6210 --- /dev/null +++ b/test/environment/env.profile | |||
@@ -0,0 +1,2 @@ | |||
1 | env LD_LIBRARY_PATH=/opt/test/lib | ||
2 | env CFLAGS="-W -Wall -Werror" | ||
diff --git a/test/environment/environment.sh b/test/environment/environment.sh new file mode 100755 index 000000000..3041fcc12 --- /dev/null +++ b/test/environment/environment.sh | |||
@@ -0,0 +1,47 @@ | |||
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: environment variables (test/environment/env.exp)" | ||
10 | ./env.exp | ||
11 | |||
12 | echo "TESTING: shell none(test/environment/shell-none.exp)" | ||
13 | ./shell-none.exp | ||
14 | |||
15 | which dash | ||
16 | if [ "$?" -eq 0 ]; | ||
17 | then | ||
18 | echo "TESTING: dash (test/environment/dash.exp)" | ||
19 | ./dash.exp | ||
20 | else | ||
21 | echo "TESTING: dash not found" | ||
22 | fi | ||
23 | |||
24 | which csh | ||
25 | if [ "$?" -eq 0 ]; | ||
26 | then | ||
27 | echo "TESTING: csh (test/environment/csh.exp)" | ||
28 | ./csh.exp | ||
29 | else | ||
30 | echo "TESTING: csh not found" | ||
31 | fi | ||
32 | |||
33 | which zsh | ||
34 | if [ "$?" -eq 0 ]; | ||
35 | then | ||
36 | echo "TESTING: zsh (test/environment/zsh.exp)" | ||
37 | ./csh.exp | ||
38 | else | ||
39 | echo "TESTING: zsh not found" | ||
40 | fi | ||
41 | |||
42 | echo "TESTING: rlimit (test/environment/rlimit.exp)" | ||
43 | ./rlimit.exp | ||
44 | |||
45 | echo "TESTING: rlimit profile (test/environment/rlimit-profile.exp)" | ||
46 | ./rlimit-profile.exp | ||
47 | |||
diff --git a/test/environment/firejail-in-firejail.exp b/test/environment/firejail-in-firejail.exp new file mode 100755 index 000000000..7e7f4fd17 --- /dev/null +++ b/test/environment/firejail-in-firejail.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\r" | ||
11 | expect { | ||
12 | timeout {puts "TESTING ERROR 1\n";exit} | ||
13 | "Child process initialized" | ||
14 | } | ||
15 | sleep 1 | ||
16 | |||
17 | send -- "firejail\r" | ||
18 | expect { | ||
19 | timeout {puts "TESTING ERROR 1\n";exit} | ||
20 | "Warning: an existing sandbox was detected" | ||
21 | } | ||
22 | sleep 1 | ||
23 | |||
24 | puts "\nall done\n" | ||
diff --git a/test/environment/firejail-in-firejail2.exp b/test/environment/firejail-in-firejail2.exp new file mode 100755 index 000000000..5a2213074 --- /dev/null +++ b/test/environment/firejail-in-firejail2.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 --noprofile\r" | ||
11 | expect { | ||
12 | timeout {puts "TESTING ERROR 1\n";exit} | ||
13 | "Child process initialized" | ||
14 | } | ||
15 | sleep 1 | ||
16 | |||
17 | send -- "firejail --force\r" | ||
18 | expect { | ||
19 | timeout {puts "TESTING ERROR 1\n";exit} | ||
20 | "Child process initialized" | ||
21 | } | ||
22 | sleep 1 | ||
23 | |||
24 | puts "\nall done\n" | ||
diff --git a/test/environment/rlimit-profile.exp b/test/environment/rlimit-profile.exp new file mode 100755 index 000000000..7d2637444 --- /dev/null +++ b/test/environment/rlimit-profile.exp | |||
@@ -0,0 +1,36 @@ | |||
1 | #!/usr/bin/expect -f | ||
2 | |||
3 | set timeout 10 | ||
4 | spawn $env(SHELL) | ||
5 | match_max 100000 | ||
6 | |||
7 | send -- "firejail --profile=rlimit.profile\r" | ||
8 | expect { | ||
9 | timeout {puts "TESTING ERROR 0\n";exit} | ||
10 | "Child process initialized" | ||
11 | } | ||
12 | sleep 1 | ||
13 | |||
14 | send -- "cat /proc/self/limits; pwd\r" | ||
15 | expect { | ||
16 | timeout {puts "TESTING ERROR 1.1\n";exit} | ||
17 | "Max file size 1024 1024" | ||
18 | } | ||
19 | expect { | ||
20 | timeout {puts "TESTING ERROR 1.2\n";exit} | ||
21 | "Max processes 1000 1000" | ||
22 | } | ||
23 | expect { | ||
24 | timeout {puts "TESTING ERROR 1.3\n";exit} | ||
25 | "Max open files 500 500" | ||
26 | } | ||
27 | expect { | ||
28 | timeout {puts "TESTING ERROR 1.4\n";exit} | ||
29 | "Max pending signals 200 200" | ||
30 | } | ||
31 | expect { | ||
32 | timeout {puts "TESTING ERROR 1.5\n";exit} | ||
33 | "home" | ||
34 | } | ||
35 | sleep 1 | ||
36 | puts "\n" | ||
diff --git a/test/environment/rlimit.exp b/test/environment/rlimit.exp new file mode 100755 index 000000000..17d2bd9d1 --- /dev/null +++ b/test/environment/rlimit.exp | |||
@@ -0,0 +1,36 @@ | |||
1 | #!/usr/bin/expect -f | ||
2 | |||
3 | set timeout 10 | ||
4 | spawn $env(SHELL) | ||
5 | match_max 100000 | ||
6 | |||
7 | send -- "firejail --rlimit-fsize=1024 --rlimit-nproc=1000 --rlimit-nofile=500 --rlimit-sigpending=200\r" | ||
8 | expect { | ||
9 | timeout {puts "TESTING ERROR 0\n";exit} | ||
10 | "Child process initialized" | ||
11 | } | ||
12 | sleep 1 | ||
13 | |||
14 | send -- "cat /proc/self/limits; pwd\r" | ||
15 | expect { | ||
16 | timeout {puts "TESTING ERROR 1.1\n";exit} | ||
17 | "Max file size 1024 1024" | ||
18 | } | ||
19 | expect { | ||
20 | timeout {puts "TESTING ERROR 1.2\n";exit} | ||
21 | "Max processes 1000 1000" | ||
22 | } | ||
23 | expect { | ||
24 | timeout {puts "TESTING ERROR 1.3\n";exit} | ||
25 | "Max open files 500 500" | ||
26 | } | ||
27 | expect { | ||
28 | timeout {puts "TESTING ERROR 1.4\n";exit} | ||
29 | "Max pending signals 200 200" | ||
30 | } | ||
31 | expect { | ||
32 | timeout {puts "TESTING ERROR 1.5\n";exit} | ||
33 | "home" | ||
34 | } | ||
35 | sleep 1 | ||
36 | puts "\n" | ||
diff --git a/test/environment/rlimit.profile b/test/environment/rlimit.profile new file mode 100644 index 000000000..271891c03 --- /dev/null +++ b/test/environment/rlimit.profile | |||
@@ -0,0 +1,4 @@ | |||
1 | rlimit-fsize 1024 | ||
2 | rlimit-nproc 1000 | ||
3 | rlimit-nofile 500 | ||
4 | rlimit-sigpending 200 \ No newline at end of file | ||
diff --git a/test/environment/shell-none.exp b/test/environment/shell-none.exp new file mode 100755 index 000000000..e30008f83 --- /dev/null +++ b/test/environment/shell-none.exp | |||
@@ -0,0 +1,48 @@ | |||
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 --shell=none\r" | ||
11 | expect { | ||
12 | timeout {puts "TESTING ERROR 0\n";exit} | ||
13 | "shell=none configured, but no program specified" | ||
14 | } | ||
15 | sleep 1 | ||
16 | |||
17 | send -- "firejail --profile=shell-none.profile\r" | ||
18 | expect { | ||
19 | timeout {puts "TESTING ERROR 1\n";exit} | ||
20 | "shell=none configured, but no program specified" | ||
21 | } | ||
22 | sleep 1 | ||
23 | |||
24 | send -- "firejail --shell=none ls\r" | ||
25 | expect { | ||
26 | timeout {puts "TESTING ERROR 2\n";exit} | ||
27 | "Child process initialized" | ||
28 | } | ||
29 | expect { | ||
30 | timeout {puts "TESTING ERROR 3\n";exit} | ||
31 | "environment.sh" | ||
32 | } | ||
33 | sleep 1 | ||
34 | |||
35 | send -- "firejail --profile=shell-none.profile ls\r" | ||
36 | expect { | ||
37 | timeout {puts "TESTING ERROR 4\n";exit} | ||
38 | "Child process initialized" | ||
39 | } | ||
40 | expect { | ||
41 | timeout {puts "TESTING ERROR 5\n";exit} | ||
42 | "environment.sh" | ||
43 | } | ||
44 | sleep 1 | ||
45 | |||
46 | |||
47 | puts "\nall done\n" | ||
48 | |||
diff --git a/test/environment/shell-none.profile b/test/environment/shell-none.profile new file mode 100644 index 000000000..f16ebe3a0 --- /dev/null +++ b/test/environment/shell-none.profile | |||
@@ -0,0 +1 @@ | |||
shell none | |||
diff --git a/test/environment/zsh.exp b/test/environment/zsh.exp new file mode 100755 index 000000000..2604b2be5 --- /dev/null +++ b/test/environment/zsh.exp | |||
@@ -0,0 +1,43 @@ | |||
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 --private --tracelog --zsh\r" | ||
11 | expect { | ||
12 | timeout {puts "TESTING ERROR 0\n";exit} | ||
13 | "Child process initialized" | ||
14 | } | ||
15 | sleep 1 | ||
16 | |||
17 | send -- "ls -al;pwd\r" | ||
18 | expect { | ||
19 | timeout {puts "TESTING ERROR 1\n";exit} | ||
20 | ".zshrc" | ||
21 | } | ||
22 | expect { | ||
23 | timeout {puts "TESTING ERROR 1.1\n";exit} | ||
24 | "home" | ||
25 | } | ||
26 | send -- "env | grep SHELL;pwd\r" | ||
27 | expect { | ||
28 | timeout {puts "TESTING ERROR 2\n";exit} | ||
29 | "SHELL" | ||
30 | } | ||
31 | expect { | ||
32 | timeout {puts "TESTING ERROR 2.1\n";exit} | ||
33 | "/usr/bin/zsh" | ||
34 | } | ||
35 | expect { | ||
36 | timeout {puts "TESTING ERROR 2.2\n";exit} | ||
37 | "home" | ||
38 | } | ||
39 | send -- "exit\r" | ||
40 | sleep 1 | ||
41 | |||
42 | puts "\n" | ||
43 | |||