aboutsummaryrefslogtreecommitdiffstats
path: root/test/environment
diff options
context:
space:
mode:
authorLibravatar netblue30 <netblue30@yahoo.com>2016-04-24 06:32:15 -0400
committerLibravatar netblue30 <netblue30@yahoo.com>2016-04-24 06:32:15 -0400
commit020c5449036c461ea1829e854da43429322059d6 (patch)
tree46ca4f358fcc1c50be77586ccdb0e02170d81e1d /test/environment
parenttesting (diff)
downloadfirejail-020c5449036c461ea1829e854da43429322059d6.tar.gz
firejail-020c5449036c461ea1829e854da43429322059d6.tar.zst
firejail-020c5449036c461ea1829e854da43429322059d6.zip
testing
Diffstat (limited to 'test/environment')
-rwxr-xr-xtest/environment/csh.exp43
-rwxr-xr-xtest/environment/dash.exp41
-rwxr-xr-xtest/environment/env.exp58
-rw-r--r--test/environment/env.profile2
-rwxr-xr-xtest/environment/environment.sh47
-rwxr-xr-xtest/environment/firejail-in-firejail.exp24
-rwxr-xr-xtest/environment/firejail-in-firejail2.exp24
-rwxr-xr-xtest/environment/rlimit-profile.exp36
-rwxr-xr-xtest/environment/rlimit.exp36
-rw-r--r--test/environment/rlimit.profile4
-rwxr-xr-xtest/environment/shell-none.exp48
-rw-r--r--test/environment/shell-none.profile1
-rwxr-xr-xtest/environment/zsh.exp43
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
6set timeout 10
7spawn $env(SHELL)
8match_max 100000
9
10send -- "firejail --private --tracelog --csh\r"
11expect {
12 timeout {puts "TESTING ERROR 0\n";exit}
13 "Child process initialized"
14}
15sleep 1
16
17send -- "ls -al;pwd\r"
18expect {
19 timeout {puts "TESTING ERROR 1\n";exit}
20 ".cshrc"
21}
22expect {
23 timeout {puts "TESTING ERROR 1.1\n";exit}
24 "home"
25}
26send -- "env | grep SHELL;pwd\r"
27expect {
28 timeout {puts "TESTING ERROR 2\n";exit}
29 "SHELL"
30}
31expect {
32 timeout {puts "TESTING ERROR 2.1\n";exit}
33 "/bin/csh"
34}
35expect {
36 timeout {puts "TESTING ERROR 2.2\n";exit}
37 "home"
38}
39send -- "exit\r"
40sleep 1
41
42puts "\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
3set timeout 10
4spawn $env(SHELL)
5match_max 100000
6
7send -- "firejail --private --tracelog --shell=/bin/dash\r"
8expect {
9 timeout {puts "TESTING ERROR 0\n";exit}
10 "Child process initialized"
11}
12sleep 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
24send -- "env | grep SHELL;pwd\r"
25expect {
26 timeout {puts "TESTING ERROR 2\n";exit}
27 "SHELL"
28}
29expect {
30 timeout {puts "TESTING ERROR 2.1\n";exit}
31 "/bin/dash"
32}
33expect {
34 timeout {puts "TESTING ERROR 2.2\n";exit}
35 "home"
36}
37send -- "exit\r"
38sleep 1
39
40puts "\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
6set timeout 10
7spawn $env(SHELL)
8match_max 100000
9
10#***********************************************
11send -- "firejail --env=ENV1=env1 --env=ENV2=env2 --env=ENV3=env3\r"
12expect {
13 timeout {puts "TESTING ERROR 0\n";exit}
14 "Child process initialized"
15}
16sleep 1
17
18send -- "env | grep ENV1\r"
19expect {
20 timeout {puts "TESTING ERROR 1\n";exit}
21 "ENV1"
22}
23send -- "env | grep ENV2\r"
24expect {
25 timeout {puts "TESTING ERROR 2\n";exit}
26 "ENV2"
27}
28send -- "env | grep ENV3\r"
29expect {
30 timeout {puts "TESTING ERROR 3\n";exit}
31 "ENV3"
32}
33send -- "exit\r"
34sleep 1
35
36#***********************************************
37send -- "firejail --profile=env.profile\r"
38expect {
39 timeout {puts "TESTING ERROR 4\n";exit}
40 "Child process initialized"
41}
42sleep 1
43send -- "env | grep LD_LIBRARY_PATH\r"
44expect {
45 timeout {puts "TESTING ERROR 5\n";exit}
46 "/opt/test/lib"
47}
48send -- "env | grep CFLAGS\r"
49expect {
50 timeout {puts "TESTING ERROR 6\n";exit}
51 "Wall"
52}
53expect {
54 timeout {puts "TESTING ERROR 7\n";exit}
55 "Werror"
56}
57
58puts "\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 @@
1env LD_LIBRARY_PATH=/opt/test/lib
2env 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
6export MALLOC_CHECK_=3
7export MALLOC_PERTURB_=$(($RANDOM % 255 + 1))
8
9echo "TESTING: environment variables (test/environment/env.exp)"
10./env.exp
11
12echo "TESTING: shell none(test/environment/shell-none.exp)"
13./shell-none.exp
14
15which dash
16if [ "$?" -eq 0 ];
17then
18 echo "TESTING: dash (test/environment/dash.exp)"
19 ./dash.exp
20else
21 echo "TESTING: dash not found"
22fi
23
24which csh
25if [ "$?" -eq 0 ];
26then
27 echo "TESTING: csh (test/environment/csh.exp)"
28 ./csh.exp
29else
30 echo "TESTING: csh not found"
31fi
32
33which zsh
34if [ "$?" -eq 0 ];
35then
36 echo "TESTING: zsh (test/environment/zsh.exp)"
37 ./csh.exp
38else
39 echo "TESTING: zsh not found"
40fi
41
42echo "TESTING: rlimit (test/environment/rlimit.exp)"
43./rlimit.exp
44
45echo "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
6set timeout 10
7spawn $env(SHELL)
8match_max 100000
9
10send -- "firejail\r"
11expect {
12 timeout {puts "TESTING ERROR 1\n";exit}
13 "Child process initialized"
14}
15sleep 1
16
17send -- "firejail\r"
18expect {
19 timeout {puts "TESTING ERROR 1\n";exit}
20 "Warning: an existing sandbox was detected"
21}
22sleep 1
23
24puts "\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
6set timeout 10
7spawn $env(SHELL)
8match_max 100000
9
10send -- "firejail --noprofile\r"
11expect {
12 timeout {puts "TESTING ERROR 1\n";exit}
13 "Child process initialized"
14}
15sleep 1
16
17send -- "firejail --force\r"
18expect {
19 timeout {puts "TESTING ERROR 1\n";exit}
20 "Child process initialized"
21}
22sleep 1
23
24puts "\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
3set timeout 10
4spawn $env(SHELL)
5match_max 100000
6
7send -- "firejail --profile=rlimit.profile\r"
8expect {
9 timeout {puts "TESTING ERROR 0\n";exit}
10 "Child process initialized"
11}
12sleep 1
13
14send -- "cat /proc/self/limits; pwd\r"
15expect {
16 timeout {puts "TESTING ERROR 1.1\n";exit}
17 "Max file size 1024 1024"
18}
19expect {
20 timeout {puts "TESTING ERROR 1.2\n";exit}
21 "Max processes 1000 1000"
22}
23expect {
24 timeout {puts "TESTING ERROR 1.3\n";exit}
25 "Max open files 500 500"
26}
27expect {
28 timeout {puts "TESTING ERROR 1.4\n";exit}
29 "Max pending signals 200 200"
30}
31expect {
32 timeout {puts "TESTING ERROR 1.5\n";exit}
33 "home"
34}
35sleep 1
36puts "\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
3set timeout 10
4spawn $env(SHELL)
5match_max 100000
6
7send -- "firejail --rlimit-fsize=1024 --rlimit-nproc=1000 --rlimit-nofile=500 --rlimit-sigpending=200\r"
8expect {
9 timeout {puts "TESTING ERROR 0\n";exit}
10 "Child process initialized"
11}
12sleep 1
13
14send -- "cat /proc/self/limits; pwd\r"
15expect {
16 timeout {puts "TESTING ERROR 1.1\n";exit}
17 "Max file size 1024 1024"
18}
19expect {
20 timeout {puts "TESTING ERROR 1.2\n";exit}
21 "Max processes 1000 1000"
22}
23expect {
24 timeout {puts "TESTING ERROR 1.3\n";exit}
25 "Max open files 500 500"
26}
27expect {
28 timeout {puts "TESTING ERROR 1.4\n";exit}
29 "Max pending signals 200 200"
30}
31expect {
32 timeout {puts "TESTING ERROR 1.5\n";exit}
33 "home"
34}
35sleep 1
36puts "\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
2rlimit-nproc 1000
3 rlimit-nofile 500
4rlimit-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
6set timeout 10
7spawn $env(SHELL)
8match_max 100000
9
10send -- "firejail --shell=none\r"
11expect {
12 timeout {puts "TESTING ERROR 0\n";exit}
13 "shell=none configured, but no program specified"
14}
15sleep 1
16
17send -- "firejail --profile=shell-none.profile\r"
18expect {
19 timeout {puts "TESTING ERROR 1\n";exit}
20 "shell=none configured, but no program specified"
21}
22sleep 1
23
24send -- "firejail --shell=none ls\r"
25expect {
26 timeout {puts "TESTING ERROR 2\n";exit}
27 "Child process initialized"
28}
29expect {
30 timeout {puts "TESTING ERROR 3\n";exit}
31 "environment.sh"
32}
33sleep 1
34
35send -- "firejail --profile=shell-none.profile ls\r"
36expect {
37 timeout {puts "TESTING ERROR 4\n";exit}
38 "Child process initialized"
39}
40expect {
41 timeout {puts "TESTING ERROR 5\n";exit}
42 "environment.sh"
43}
44sleep 1
45
46
47puts "\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
6set timeout 10
7spawn $env(SHELL)
8match_max 100000
9
10send -- "firejail --private --tracelog --zsh\r"
11expect {
12 timeout {puts "TESTING ERROR 0\n";exit}
13 "Child process initialized"
14}
15sleep 1
16
17send -- "ls -al;pwd\r"
18expect {
19 timeout {puts "TESTING ERROR 1\n";exit}
20 ".zshrc"
21}
22expect {
23 timeout {puts "TESTING ERROR 1.1\n";exit}
24 "home"
25}
26send -- "env | grep SHELL;pwd\r"
27expect {
28 timeout {puts "TESTING ERROR 2\n";exit}
29 "SHELL"
30}
31expect {
32 timeout {puts "TESTING ERROR 2.1\n";exit}
33 "/usr/bin/zsh"
34}
35expect {
36 timeout {puts "TESTING ERROR 2.2\n";exit}
37 "home"
38}
39send -- "exit\r"
40sleep 1
41
42puts "\n"
43