aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rwxr-xr-xtest/environment/environment.sh5
-rwxr-xr-xtest/environment/quiet.exp21
-rwxr-xr-xtest/fs/fs.sh50
-rwxr-xr-xtest/fs/fs_dev_shm.exp (renamed from test/fs_dev_shm.exp)61
-rwxr-xr-xtest/fs/fs_var_lock.exp (renamed from test/fs_var_lock.exp)61
-rwxr-xr-xtest/fs/fs_var_tmp.exp (renamed from test/fs_var_tmp.exp)61
-rwxr-xr-xtest/fs/invalid_filename.exp (renamed from test/invalid_filename.exp)24
-rwxr-xr-xtest/fs/kmsg.exp (renamed from test/kmsg.exp)7
-rwxr-xr-xtest/fs/option_bind_user.exp (renamed from test/option_bind_user.exp)0
-rwxr-xr-xtest/fs/option_blacklist.exp (renamed from test/option_blacklist.exp)11
-rwxr-xr-xtest/fs/option_blacklist_file.exp (renamed from test/option_blacklist_file.exp)4
-rwxr-xr-xtest/fs/private-bin.exp (renamed from test/private-bin.exp)6
-rw-r--r--test/fs/private-bin.profile (renamed from test/private-bin.profile)0
-rwxr-xr-xtest/fs/private-etc.exp (renamed from test/private-etc.exp)3
-rwxr-xr-xtest/fs/private-whitelist.exp (renamed from test/private-whitelist.exp)3
-rwxr-xr-xtest/fs/private.exp (renamed from test/private.exp)41
-rwxr-xr-xtest/fs/whitelist-empty.exp (renamed from test/whitelist-empty.exp)3
-rwxr-xr-xtest/pid.exp49
-rwxr-xr-xtest/quiet.exp17
-rwxr-xr-xtest/test-nonet.sh44
-rwxr-xr-xtest/test.sh112
21 files changed, 223 insertions, 360 deletions
diff --git a/test/environment/environment.sh b/test/environment/environment.sh
index 7b29a3482..49b50797a 100755
--- a/test/environment/environment.sh
+++ b/test/environment/environment.sh
@@ -62,3 +62,8 @@ fi
62 62
63echo "TESTING: nice (test/environment/nice.exp)" 63echo "TESTING: nice (test/environment/nice.exp)"
64./nice.exp 64./nice.exp
65
66echo "TESTING: quiet (test/environment/quiet.exp)"
67./quiet.exp
68
69
diff --git a/test/environment/quiet.exp b/test/environment/quiet.exp
new file mode 100755
index 000000000..38da4673e
--- /dev/null
+++ b/test/environment/quiet.exp
@@ -0,0 +1,21 @@
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 4
7spawn $env(SHELL)
8match_max 100000
9
10# check ip address
11send -- "firejail --quiet echo done\r"
12expect {
13 timeout {puts "TESTING ERROR 1\n";exit}
14 "Reading profile" {puts "TESTING ERROR 2\n";exit}
15 "Child process initialized" {puts "TESTING ERROR 3\n";exit}
16 "done"
17}
18sleep 1
19
20puts "\nall done\n"
21
diff --git a/test/fs/fs.sh b/test/fs/fs.sh
new file mode 100755
index 000000000..425af45a6
--- /dev/null
+++ b/test/fs/fs.sh
@@ -0,0 +1,50 @@
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: kmsg access (test/fs/kmsg.exp)"
10./kmsg.exp
11
12echo "TESTING: read/write /var/tmp (test/fs/fs_var_tmp.exp)"
13./fs_var_tmp.exp
14
15echo "TESTING: read/write /var/lock (test/fs/fs_var_lock.exp)"
16./fs_var_lock.exp
17
18echo "TESTING: read/write /dev/shm (test/fs/fs_dev_shm.exp)"
19./fs_dev_shm.exp
20
21echo "TESTING: private (test/fs/private.exp)"
22./private.exp `whoami`
23
24echo "TESTING: private-etc (test/fs/private-etc.exp)"
25./private-etc.exp
26
27echo "TESTING: private-bin (test/fs/private-bin.exp)"
28./private-bin.exp
29
30echo "TESTING: whitelist empty (test/fs/whitelist-empty.exp)"
31./whitelist-empty.exp
32
33echo "TESTING: private whitelist (test/fs/private-whitelist.exp)"
34echo "TESTING: (failing on OpenSUSE)"
35./private-whitelist.exp
36
37echo "TESTING: invalid filename (test/fs/invalid_filename.exp)"
38./invalid_filename.exp
39
40echo "TESTING: blacklist directory (test/fs/option_blacklist.exp)"
41./option_blacklist.exp
42
43echo "TESTING: blacklist file (test/fs/option_blacklist_file.exp)"
44./option_blacklist_file.exp
45
46echo "TESTING: bind as user (test/fs/option_bind_user.exp)"
47./option_bind_user.exp
48
49
50
diff --git a/test/fs_dev_shm.exp b/test/fs/fs_dev_shm.exp
index b54f24eb5..6d27978e2 100755
--- a/test/fs_dev_shm.exp
+++ b/test/fs/fs_dev_shm.exp
@@ -1,4 +1,7 @@
1#!/usr/bin/expect -f 1#!/usr/bin/expect -f
2# This file is part of Firejail project
3# Copyright (C) 2014-2016 Firejail Authors
4# License GPL v2
2 5
3set timeout 10 6set timeout 10
4spawn $env(SHELL) 7spawn $env(SHELL)
@@ -12,33 +15,33 @@ expect {
12} 15}
13sleep 1 16sleep 1
14 17
15send -- "echo mytest > /dev/shm/ttt;pwd\r" 18send -- "echo mytest > /dev/shm/ttt;echo done\r"
16expect { 19expect {
17 timeout {puts "TESTING ERROR 1\n";exit} 20 timeout {puts "TESTING ERROR 1\n";exit}
18 "home" 21 "done"
19} 22}
20 23
21send -- "cat /dev/shm/ttt;pwd\r" 24send -- "cat /dev/shm/ttt;echo done\r"
22expect { 25expect {
23 timeout {puts "TESTING ERROR 2.1\n";exit} 26 timeout {puts "TESTING ERROR 2\n";exit}
24 "mytest" 27 "mytest"
25} 28}
26expect { 29expect {
27 timeout {puts "TESTING ERROR 2\n";exit} 30 timeout {puts "TESTING ERROR 3\n";exit}
28 "home" 31 "done"
29} 32}
30 33
31send -- "rm /dev/shm/ttt;pwd\r" 34send -- "rm /dev/shm/ttt;echo done\r"
32expect { 35expect {
33 timeout {puts "TESTING ERROR 3\n";exit} 36 timeout {puts "TESTING ERROR 4\n";exit}
34 "home" 37 "done"
35} 38}
36 39
37send -- "cat /dev/shm/ttt;pwd\r" 40send -- "cat /dev/shm/ttt;echo done\r"
38expect { 41expect {
39 timeout {puts "TESTING ERROR 4\n";exit} 42 timeout {puts "TESTING ERROR 5\n";exit}
40 "mytest" {puts "TESTING ERROR 4.1\n";exit} 43 "mytest" {puts "TESTING ERROR 6\n";exit}
41 "home" 44 "done"
42} 45}
43 46
44sleep 1 47sleep 1
@@ -48,40 +51,40 @@ sleep 1
48# redo the test with --private 51# redo the test with --private
49send -- "firejail\r" 52send -- "firejail\r"
50expect { 53expect {
51 timeout {puts "TESTING ERROR 10\n";exit} 54 timeout {puts "TESTING ERROR 7\n";exit}
52 "Child process initialized" 55 "Child process initialized"
53} 56}
54sleep 1 57sleep 1
55 58
56send -- "echo mytest > /dev/shm/ttt;pwd\r" 59send -- "echo mytest > /dev/shm/ttt;echo done\r"
57expect { 60expect {
58 timeout {puts "TESTING ERROR 11\n";exit} 61 timeout {puts "TESTING ERROR 8\n";exit}
59 "home" 62 "done"
60} 63}
61 64
62send -- "cat /dev/shm/ttt;pwd\r" 65send -- "cat /dev/shm/ttt;echo done\r"
63expect { 66expect {
64 timeout {puts "TESTING ERROR 12.1\n";exit} 67 timeout {puts "TESTING ERROR 9\n";exit}
65 "mytest" 68 "mytest"
66} 69}
67expect { 70expect {
68 timeout {puts "TESTING ERROR 12\n";exit} 71 timeout {puts "TESTING ERROR 10\n";exit}
69 "home" 72 "done"
70} 73}
71 74
72send -- "rm /dev/shm/ttt;pwd\r" 75send -- "rm /dev/shm/ttt;echo done\r"
73expect { 76expect {
74 timeout {puts "TESTING ERROR 13\n";exit} 77 timeout {puts "TESTING ERROR 11\n";exit}
75 "home" 78 "done"
76} 79}
77 80
78send -- "cat /dev/shm/ttt;pwd\r" 81send -- "cat /dev/shm/ttt;echo done\r"
79expect { 82expect {
80 timeout {puts "TESTING ERROR 14\n";exit} 83 timeout {puts "TESTING ERROR 12\n";exit}
81 "mytest" {puts "TESTING ERROR 14.1\n";exit} 84 "mytest" {puts "TESTING ERROR 13\n";exit}
82 "home" 85 "done"
83} 86}
84 87
85sleep 1 88sleep 1
86 89
87puts "\n" 90puts "\nall done\n"
diff --git a/test/fs_var_lock.exp b/test/fs/fs_var_lock.exp
index dfcf571f4..0e2b3181a 100755
--- a/test/fs_var_lock.exp
+++ b/test/fs/fs_var_lock.exp
@@ -1,4 +1,7 @@
1#!/usr/bin/expect -f 1#!/usr/bin/expect -f
2# This file is part of Firejail project
3# Copyright (C) 2014-2016 Firejail Authors
4# License GPL v2
2 5
3set timeout 10 6set timeout 10
4spawn $env(SHELL) 7spawn $env(SHELL)
@@ -12,33 +15,33 @@ expect {
12} 15}
13sleep 1 16sleep 1
14 17
15send -- "echo mytest > /var/lock/ttt;pwd\r" 18send -- "echo mytest > /var/lock/ttt;echo done\r"
16expect { 19expect {
17 timeout {puts "TESTING ERROR 1\n";exit} 20 timeout {puts "TESTING ERROR 1\n";exit}
18 "home" 21 "done"
19} 22}
20 23
21send -- "cat /var/lock/ttt;pwd\r" 24send -- "cat /var/lock/ttt;echo done\r"
22expect { 25expect {
23 timeout {puts "TESTING ERROR 2.1\n";exit} 26 timeout {puts "TESTING ERROR 2\n";exit}
24 "mytest" 27 "mytest"
25} 28}
26expect { 29expect {
27 timeout {puts "TESTING ERROR 2\n";exit} 30 timeout {puts "TESTING ERROR 3\n";exit}
28 "home" 31 "done"
29} 32}
30 33
31send -- "rm /var/lock/ttt;pwd\r" 34send -- "rm /var/lock/ttt;echo done\r"
32expect { 35expect {
33 timeout {puts "TESTING ERROR 3\n";exit} 36 timeout {puts "TESTING ERROR 4\n";exit}
34 "home" 37 "done"
35} 38}
36 39
37send -- "cat /var/lock/ttt;pwd\r" 40send -- "cat /var/lock/ttt;echo done\r"
38expect { 41expect {
39 timeout {puts "TESTING ERROR 4\n";exit} 42 timeout {puts "TESTING ERROR 5\n";exit}
40 "mytest" {puts "TESTING ERROR 4.1\n";exit} 43 "mytest" {puts "TESTING ERROR 6\n";exit}
41 "home" 44 "done"
42} 45}
43 46
44sleep 1 47sleep 1
@@ -48,40 +51,40 @@ sleep 1
48# redo the test with --private 51# redo the test with --private
49send -- "firejail\r" 52send -- "firejail\r"
50expect { 53expect {
51 timeout {puts "TESTING ERROR 10\n";exit} 54 timeout {puts "TESTING ERROR 7\n";exit}
52 "Child process initialized" 55 "Child process initialized"
53} 56}
54sleep 1 57sleep 1
55 58
56send -- "echo mytest > /var/lock/ttt;pwd\r" 59send -- "echo mytest > /var/lock/ttt;echo done\r"
57expect { 60expect {
58 timeout {puts "TESTING ERROR 11\n";exit} 61 timeout {puts "TESTING ERROR 8\n";exit}
59 "home" 62 "done"
60} 63}
61 64
62send -- "cat /var/lock/ttt;pwd\r" 65send -- "cat /var/lock/ttt;echo done\r"
63expect { 66expect {
64 timeout {puts "TESTING ERROR 12.1\n";exit} 67 timeout {puts "TESTING ERROR 9\n";exit}
65 "mytest" 68 "mytest"
66} 69}
67expect { 70expect {
68 timeout {puts "TESTING ERROR 12\n";exit} 71 timeout {puts "TESTING ERROR 10\n";exit}
69 "home" 72 "done"
70} 73}
71 74
72send -- "rm /var/lock/ttt;pwd\r" 75send -- "rm /var/lock/ttt;echo done\r"
73expect { 76expect {
74 timeout {puts "TESTING ERROR 13\n";exit} 77 timeout {puts "TESTING ERROR 11\n";exit}
75 "home" 78 "done"
76} 79}
77 80
78send -- "cat /var/lock/ttt;pwd\r" 81send -- "cat /var/lock/ttt;echo done\r"
79expect { 82expect {
80 timeout {puts "TESTING ERROR 14\n";exit} 83 timeout {puts "TESTING ERROR 12\n";exit}
81 "mytest" {puts "TESTING ERROR 14.1\n";exit} 84 "mytest" {puts "TESTING ERROR 13\n";exit}
82 "home" 85 "done"
83} 86}
84 87
85sleep 1 88sleep 1
86 89
87puts "\n" 90puts "\nall done\n"
diff --git a/test/fs_var_tmp.exp b/test/fs/fs_var_tmp.exp
index 95ceeb2a4..811baac68 100755
--- a/test/fs_var_tmp.exp
+++ b/test/fs/fs_var_tmp.exp
@@ -1,4 +1,7 @@
1#!/usr/bin/expect -f 1#!/usr/bin/expect -f
2# This file is part of Firejail project
3# Copyright (C) 2014-2016 Firejail Authors
4# License GPL v2
2 5
3set timeout 10 6set timeout 10
4spawn $env(SHELL) 7spawn $env(SHELL)
@@ -12,33 +15,33 @@ expect {
12} 15}
13sleep 1 16sleep 1
14 17
15send -- "echo mytest > /var/tmp/ttt;pwd\r" 18send -- "echo mytest > /var/tmp/ttt;echo done\r"
16expect { 19expect {
17 timeout {puts "TESTING ERROR 1\n";exit} 20 timeout {puts "TESTING ERROR 1\n";exit}
18 "home" 21 "done"
19} 22}
20 23
21send -- "cat /var/tmp/ttt;pwd\r" 24send -- "cat /var/tmp/ttt;echo done\r"
22expect { 25expect {
23 timeout {puts "TESTING ERROR 2.1\n";exit} 26 timeout {puts "TESTING ERROR 2\n";exit}
24 "mytest" 27 "mytest"
25} 28}
26expect { 29expect {
27 timeout {puts "TESTING ERROR 2\n";exit} 30 timeout {puts "TESTING ERROR 3\n";exit}
28 "home" 31 "done"
29} 32}
30 33
31send -- "rm /var/tmp/ttt;pwd\r" 34send -- "rm /var/tmp/ttt;echo done\r"
32expect { 35expect {
33 timeout {puts "TESTING ERROR 3\n";exit} 36 timeout {puts "TESTING ERROR 4\n";exit}
34 "home" 37 "done"
35} 38}
36 39
37send -- "cat /var/tmp/ttt;pwd\r" 40send -- "cat /var/tmp/ttt;echo done\r"
38expect { 41expect {
39 timeout {puts "TESTING ERROR 4\n";exit} 42 timeout {puts "TESTING ERROR 5\n";exit}
40 "mytest" {puts "TESTING ERROR 4.1\n";exit} 43 "mytest" {puts "TESTING ERROR 6\n";exit}
41 "home" 44 "done"
42} 45}
43 46
44sleep 1 47sleep 1
@@ -48,40 +51,40 @@ sleep 1
48# redo the test with --private 51# redo the test with --private
49send -- "firejail\r" 52send -- "firejail\r"
50expect { 53expect {
51 timeout {puts "TESTING ERROR 10\n";exit} 54 timeout {puts "TESTING ERROR 7\n";exit}
52 "Child process initialized" 55 "Child process initialized"
53} 56}
54sleep 1 57sleep 1
55 58
56send -- "echo mytest > /var/tmp/ttt;pwd\r" 59send -- "echo mytest > /var/tmp/ttt;echo done\r"
57expect { 60expect {
58 timeout {puts "TESTING ERROR 11\n";exit} 61 timeout {puts "TESTING ERROR 8\n";exit}
59 "home" 62 "done"
60} 63}
61 64
62send -- "cat /var/tmp/ttt;pwd\r" 65send -- "cat /var/tmp/ttt;echo done\r"
63expect { 66expect {
64 timeout {puts "TESTING ERROR 12.1\n";exit} 67 timeout {puts "TESTING ERROR 9\n";exit}
65 "mytest" 68 "mytest"
66} 69}
67expect { 70expect {
68 timeout {puts "TESTING ERROR 12\n";exit} 71 timeout {puts "TESTING ERROR 10\n";exit}
69 "home" 72 "done"
70} 73}
71 74
72send -- "rm /var/tmp/ttt;pwd\r" 75send -- "rm /var/tmp/ttt;echo done\r"
73expect { 76expect {
74 timeout {puts "TESTING ERROR 13\n";exit} 77 timeout {puts "TESTING ERROR 11\n";exit}
75 "home" 78 "done"
76} 79}
77 80
78send -- "cat /var/tmp/ttt;pwd\r" 81send -- "cat /var/tmp/ttt;echo done\r"
79expect { 82expect {
80 timeout {puts "TESTING ERROR 14\n";exit} 83 timeout {puts "TESTING ERROR 12\n";exit}
81 "mytest" {puts "TESTING ERROR 14.1\n";exit} 84 "mytest" {puts "TESTING ERROR 13\n";exit}
82 "home" 85 "done"
83} 86}
84 87
85sleep 1 88sleep 1
86 89
87puts "\n" 90puts "\nall done\n"
diff --git a/test/invalid_filename.exp b/test/fs/invalid_filename.exp
index fe8bd8c25..1acc85491 100755
--- a/test/invalid_filename.exp
+++ b/test/fs/invalid_filename.exp
@@ -1,23 +1,7 @@
1#!/usr/bin/expect -f 1#!/usr/bin/expect -f
2 2# This file is part of Firejail project
3#invalid_filename checks: 3# Copyright (C) 2014-2016 Firejail Authors
4# 4# License GPL v2
5#--bind (two files) - profile.c - Note: The test is not implemented here, need to be root to test it
6#--blacklist - profile.c
7#--cgroup - cgroup.c
8#--chroot - main.c
9#--netfilter - netfilter.c
10#--output - output.c
11#--private - fs_home.c
12#--privte-bin (list) - fs_bin.c
13#--private-home (list) - fs_home.c
14#--private-etc (list) - fs_etc.c
15#--profile - main.c
16#--read_only - profile.c
17#--shell - main.c
18#--tmpfs - profile.c
19#--white-list
20
21 5
22set timeout 10 6set timeout 10
23spawn $env(SHELL) 7spawn $env(SHELL)
@@ -201,7 +185,5 @@ expect {
201} 185}
202after 100 186after 100
203 187
204
205
206puts "\nall done\n" 188puts "\nall done\n"
207 189
diff --git a/test/kmsg.exp b/test/fs/kmsg.exp
index 096bdb708..abc711aee 100755
--- a/test/kmsg.exp
+++ b/test/fs/kmsg.exp
@@ -1,4 +1,7 @@
1#!/usr/bin/expect -f 1#!/usr/bin/expect -f
2# This file is part of Firejail project
3# Copyright (C) 2014-2016 Firejail Authors
4# License GPL v2
2 5
3set timeout 10 6set timeout 10
4spawn $env(SHELL) 7spawn $env(SHELL)
@@ -16,14 +19,14 @@ expect {
16 timeout {puts "TESTING ERROR 2\n";exit} 19 timeout {puts "TESTING ERROR 2\n";exit}
17 "Permission denied" 20 "Permission denied"
18} 21}
19sleep 1 22after 100
20 23
21send -- "cat /proc/kmsg\r" 24send -- "cat /proc/kmsg\r"
22expect { 25expect {
23 timeout {puts "TESTING ERROR 3\n";exit} 26 timeout {puts "TESTING ERROR 3\n";exit}
24 "Permission denied" 27 "Permission denied"
25} 28}
26sleep 1 29after 100
27 30
28puts "\nall done\n" 31puts "\nall done\n"
29 32
diff --git a/test/option_bind_user.exp b/test/fs/option_bind_user.exp
index 9d2d17d7f..9d2d17d7f 100755
--- a/test/option_bind_user.exp
+++ b/test/fs/option_bind_user.exp
diff --git a/test/option_blacklist.exp b/test/fs/option_blacklist.exp
index b80d0cc60..38fd19237 100755
--- a/test/option_blacklist.exp
+++ b/test/fs/option_blacklist.exp
@@ -1,4 +1,7 @@
1#!/usr/bin/expect -f 1#!/usr/bin/expect -f
2# This file is part of Firejail project
3# Copyright (C) 2014-2016 Firejail Authors
4# License GPL v2
2 5
3set timeout 10 6set timeout 10
4spawn $env(SHELL) 7spawn $env(SHELL)
@@ -11,23 +14,23 @@ expect {
11} 14}
12sleep 1 15sleep 1
13 16
14send -- "ls -l /var;pwd\r" 17send -- "ls -l /var;echo done\r"
15expect { 18expect {
16 timeout {puts "TESTING ERROR 1\n";exit} 19 timeout {puts "TESTING ERROR 1\n";exit}
17 "Permission denied" 20 "Permission denied"
18} 21}
19expect { 22expect {
20 timeout {puts "TESTING ERROR 2\n";exit} 23 timeout {puts "TESTING ERROR 2\n";exit}
21 "home" 24 "done"
22} 25}
23send -- "cd /var;pwd\r" 26send -- "cd /var;echo done\r"
24expect { 27expect {
25 timeout {puts "TESTING ERROR 3\n";exit} 28 timeout {puts "TESTING ERROR 3\n";exit}
26 "Permission denied" 29 "Permission denied"
27} 30}
28expect { 31expect {
29 timeout {puts "TESTING ERROR 4\n";exit} 32 timeout {puts "TESTING ERROR 4\n";exit}
30 "home" 33 "done"
31} 34}
32sleep 1 35sleep 1
33 36
diff --git a/test/option_blacklist_file.exp b/test/fs/option_blacklist_file.exp
index ecdfe3b82..846735d9e 100755
--- a/test/option_blacklist_file.exp
+++ b/test/fs/option_blacklist_file.exp
@@ -11,14 +11,14 @@ expect {
11} 11}
12sleep 1 12sleep 1
13 13
14send -- "cat /etc/passwd;pwd\r" 14send -- "cat /etc/passwd;echo done\r"
15expect { 15expect {
16 timeout {puts "TESTING ERROR 1\n";exit} 16 timeout {puts "TESTING ERROR 1\n";exit}
17 "Permission denied" 17 "Permission denied"
18} 18}
19expect { 19expect {
20 timeout {puts "TESTING ERROR 2\n";exit} 20 timeout {puts "TESTING ERROR 2\n";exit}
21 "home" 21 "done"
22} 22}
23sleep 1 23sleep 1
24 24
diff --git a/test/private-bin.exp b/test/fs/private-bin.exp
index a82d2b213..c19702e77 100755
--- a/test/private-bin.exp
+++ b/test/fs/private-bin.exp
@@ -1,4 +1,7 @@
1#!/usr/bin/expect -f 1#!/usr/bin/expect -f
2# This file is part of Firejail project
3# Copyright (C) 2014-2016 Firejail Authors
4# License GPL v2
2 5
3set timeout 10 6set timeout 10
4spawn $env(SHELL) 7spawn $env(SHELL)
@@ -63,9 +66,6 @@ expect {
63} 66}
64send -- "exit\r" 67send -- "exit\r"
65 68
66
67
68
69sleep 1 69sleep 1
70puts "\nall done\n" 70puts "\nall done\n"
71 71
diff --git a/test/private-bin.profile b/test/fs/private-bin.profile
index 24cf5929a..24cf5929a 100644
--- a/test/private-bin.profile
+++ b/test/fs/private-bin.profile
diff --git a/test/private-etc.exp b/test/fs/private-etc.exp
index db1d1df3a..e5a006585 100755
--- a/test/private-etc.exp
+++ b/test/fs/private-etc.exp
@@ -1,4 +1,7 @@
1#!/usr/bin/expect -f 1#!/usr/bin/expect -f
2# This file is part of Firejail project
3# Copyright (C) 2014-2016 Firejail Authors
4# License GPL v2
2 5
3set timeout 10 6set timeout 10
4spawn $env(SHELL) 7spawn $env(SHELL)
diff --git a/test/private-whitelist.exp b/test/fs/private-whitelist.exp
index 7379241ef..a3d60369a 100755
--- a/test/private-whitelist.exp
+++ b/test/fs/private-whitelist.exp
@@ -1,4 +1,7 @@
1#!/usr/bin/expect -f 1#!/usr/bin/expect -f
2# This file is part of Firejail project
3# Copyright (C) 2014-2016 Firejail Authors
4# License GPL v2
2 5
3set timeout 10 6set timeout 10
4spawn $env(SHELL) 7spawn $env(SHELL)
diff --git a/test/private.exp b/test/fs/private.exp
index 80a921529..01f04d3cb 100755
--- a/test/private.exp
+++ b/test/fs/private.exp
@@ -1,4 +1,7 @@
1#!/usr/bin/expect -f 1#!/usr/bin/expect -f
2# This file is part of Firejail project
3# Copyright (C) 2014-2016 Firejail Authors
4# License GPL v2
2 5
3set timeout 10 6set timeout 10
4spawn $env(SHELL) 7spawn $env(SHELL)
@@ -23,35 +26,35 @@ sleep 1
23 26
24send -- "firejail --private --noprofile\r" 27send -- "firejail --private --noprofile\r"
25expect { 28expect {
26 timeout {puts "TESTING ERROR 0\n";exit} 29 timeout {puts "TESTING ERROR 1\n";exit}
27 "Child process initialized" 30 "Child process initialized"
28} 31}
29 32
30sleep 1 33sleep 1
31send -- "ls -al; pwd\r" 34send -- "cd ~; ls -al; echo done\r"
32expect { 35expect {
33 timeout {puts "TESTING ERROR 0.1\n";exit} 36 timeout {puts "TESTING ERROR 2\n";exit}
34 ".bashrc" 37 ".bashrc"
35} 38}
36expect { 39expect {
37 timeout {puts "TESTING ERROR 0.2\n";exit} 40 timeout {puts "TESTING ERROR 3\n";exit}
38 [lindex $argv 0] 41 [lindex $argv 0]
39} 42}
40send -- "ls -al; pwd\r" 43send -- "ls -al; echo done\r"
41expect { 44expect {
42 timeout { 45 timeout {
43 # OpenSUSE doesn't use .Xauthority from user home directory 46 # OpenSUSE doesn't use .Xauthority from user done directory
44 send -- "env | grep XAUTHORITY\r" 47 send -- "env | grep XAUTHORITY\r"
45 48
46 expect { 49 expect {
47 timeout {puts "TESTING ERROR 0.3\n";exit} 50 timeout {puts "TESTING ERROR 4\n";exit}
48 "/run/lightdm/netblue/xauthority" 51 "/run/lightdm/netblue/xauthority"
49 } 52 }
50 } 53 }
51 ".Xauthority" 54 ".Xauthority"
52} 55}
53expect { 56expect {
54 timeout {puts "TESTING ERROR 0.4\n";exit} 57 timeout {puts "TESTING ERROR 5\n";exit}
55 [lindex $argv 0] 58 [lindex $argv 0]
56} 59}
57 60
@@ -59,38 +62,38 @@ expect {
59# testing private only 62# testing private only
60send -- "bash\r" 63send -- "bash\r"
61sleep 1 64sleep 1
62# owner /home/netblue 65# owner /done/netblue
63send -- "ls -l /home;pwd\r" 66send -- "ls -l /done;echo done\r"
64expect { 67expect {
65 timeout {puts "TESTING ERROR 1\n";exit} 68 timeout {puts "TESTING ERROR 6\n";exit}
66 [lindex $argv 0] 69 [lindex $argv 0]
67} 70}
68expect { 71expect {
69 timeout {puts "TESTING ERROR 1.1\n";exit} 72 timeout {puts "TESTING ERROR 7\n";exit}
70 [lindex $argv 0] 73 [lindex $argv 0]
71} 74}
72expect { 75expect {
73 timeout {puts "TESTING ERROR 1.2\n";exit} 76 timeout {puts "TESTING ERROR 8\n";exit}
74 [lindex $argv 0] 77 [lindex $argv 0]
75} 78}
76expect { 79expect {
77 timeout {puts "TESTING ERROR 1.3\n";exit} 80 timeout {puts "TESTING ERROR 9\n";exit}
78 "home" 81 "done"
79} 82}
80sleep 1 83sleep 1
81 84
82# owner /tmp 85# owner /tmp
83send -- "stat -c %U%a /tmp;pwd\r" 86send -- "stat -c %U%a /tmp;echo done\r"
84expect { 87expect {
85 timeout {puts "TESTING ERROR 2\n";exit} 88 timeout {puts "TESTING ERROR 10\n";exit}
86 "root777" {puts "version 1\n";} 89 "root777" {puts "version 1\n";}
87 "root1777" {puts "version 2\n";} 90 "root1777" {puts "version 2\n";}
88 "nobody777" {puts "version 3\n";} 91 "nobody777" {puts "version 3\n";}
89 "nobody1777" {puts "version 4\n";} 92 "nobody1777" {puts "version 4\n";}
90} 93}
91expect { 94expect {
92 timeout {puts "TESTING ERROR 2.1\n";exit} 95 timeout {puts "TESTING ERROR 11\n";exit}
93 "home" 96 "done"
94} 97}
95sleep 1 98sleep 1
96 99
diff --git a/test/whitelist-empty.exp b/test/fs/whitelist-empty.exp
index 226b019db..f44d4fb58 100755
--- a/test/whitelist-empty.exp
+++ b/test/fs/whitelist-empty.exp
@@ -1,4 +1,7 @@
1#!/usr/bin/expect -f 1#!/usr/bin/expect -f
2# This file is part of Firejail project
3# Copyright (C) 2014-2016 Firejail Authors
4# License GPL v2
2 5
3set timeout 30 6set timeout 30
4spawn $env(SHELL) 7spawn $env(SHELL)
diff --git a/test/pid.exp b/test/pid.exp
deleted file mode 100755
index cdeb9d5fb..000000000
--- a/test/pid.exp
+++ /dev/null
@@ -1,49 +0,0 @@
1#!/usr/bin/expect -f
2
3set timeout 10
4spawn $env(SHELL)
5match_max 100000
6
7send -- "firejail\r"
8expect {
9 timeout {puts "TESTING ERROR 0\n";exit}
10 "Child process initialized"
11}
12sleep 1
13
14# test processes
15send -- "bash\r"
16sleep 1
17send -- "ps aux; pwd\r"
18expect {
19 timeout {puts "TESTING ERROR 1\n";exit}
20 "/bin/bash"
21}
22expect {
23 timeout {puts "TESTING ERROR 2\n";exit}
24 "bash"
25}
26expect {
27 timeout {puts "TESTING ERROR 3\n";exit}
28 "ps aux"
29}
30expect {
31 timeout {puts "TESTING ERROR 4\n";exit}
32 "home"
33}
34sleep 1
35
36
37send -- "ps aux |wc -l; pwd\r"
38expect {
39 timeout {puts "TESTING ERROR 5\n";exit}
40 "6" {puts "normal system\n"}
41 "5" {puts "grsecurity\n"}
42}
43expect {
44 timeout {puts "TESTING ERROR 6\n";exit}
45 "home"
46}
47sleep 1
48
49puts "\nall done\n"
diff --git a/test/quiet.exp b/test/quiet.exp
deleted file mode 100755
index fa46aebf2..000000000
--- a/test/quiet.exp
+++ /dev/null
@@ -1,17 +0,0 @@
1#!/usr/bin/expect -f
2
3set timeout 4
4spawn $env(SHELL)
5match_max 100000
6
7# check ip address
8send -- "firejail --net=br0 --quiet\r"
9expect {
10 "Child process initialized" {puts "TESTING ERROR 1\n";exit}
11 "Interface" {puts "TESTING ERROR 1\n";exit}
12}
13sleep 1
14send -- "\r"
15
16puts "\nall done\n"
17
diff --git a/test/test-nonet.sh b/test/test-nonet.sh
deleted file mode 100755
index 3df8b2d4e..000000000
--- a/test/test-nonet.sh
+++ /dev/null
@@ -1,44 +0,0 @@
1#!/bin/bash
2
3echo "TESTING: version"
4./option_version.exp
5
6echo "TESTING: help"
7./option_help.exp
8
9echo "TESTING: man"
10./option_man.exp
11
12echo "TESTING: list"
13./option_list.exp
14
15echo "TESTING: PID"
16./pid.exp
17
18echo "TESTING: profile no permissions"
19./profile_noperm.exp
20
21echo "TESTING: profile syntax"
22./profile_syntax.exp
23
24echo "TESTING: profile read-only"
25./profile_readonly.exp
26
27echo "TESTING: profile tmpfs"
28./profile_tmpfs.exp
29
30echo "TESTING: private"
31./private.exp `whoami`
32
33echo "TESTING: read/write /var/tmp"
34./fs_var_tmp.exp
35
36echo "TESTING: read/write /var/run"
37./fs_var_run.exp
38
39echo "TESTING: read/write /var/lock"
40./fs_var_lock.exp
41
42echo "TESTING: read/write /dev/shm"
43./fs_dev_shm.exp
44
diff --git a/test/test.sh b/test/test.sh
index 78a6adc43..c4f0afd94 100755
--- a/test/test.sh
+++ b/test/test.sh
@@ -7,38 +7,9 @@
7 7
8./fscheck.sh 8./fscheck.sh
9 9
10
11echo "TESTING: protocol.print (protocol-print.exp)"
12./protocol-print.exp
13
14echo "TESTING: sound (sound.exp)"
15./sound.exp
16
17echo "TESTING: nice (nice.exp)"
18./nice.exp
19
20echo "TESTING: tty (tty.exp)" 10echo "TESTING: tty (tty.exp)"
21./tty.exp 11./tty.exp
22 12
23echo "TESTING: protocol (protocol.exp)"
24./protocol.exp
25
26echo "TESTING: invalid filename (invalid_filename.exp)"
27./invalid_filename.exp
28
29echo "TESTING: whitelist empty (whitelist-empty.exp)"
30./whitelist-empty.exp
31
32echo "TESTING: private-etc (private-etc.exp)"
33./private-etc.exp
34
35echo "TESTING: private-bin (private-bin.exp)"
36./private-bin.exp
37
38echo "TESTING: private whitelist (private-whitelist.exp)"
39echo "TESTING: failing on OpenSUSE"
40./private-whitelist.exp
41
42sleep 1 13sleep 1
43rm -fr dir\ with\ space 14rm -fr dir\ with\ space
44mkdir dir\ with\ space 15mkdir dir\ with\ space
@@ -56,14 +27,6 @@ rm -fr auto2
56rm -fr auto3 27rm -fr auto3
57rm -fr auto4 28rm -fr auto4
58 29
59if [ -f /proc/self/uid_map ];
60then
61 echo "TESTING: noroot (noroot.exp)"
62 ./noroot.exp
63else
64 echo "TESTING: user namespaces not available"
65fi
66
67echo "TESTING: doubledash" 30echo "TESTING: doubledash"
68mkdir -- -testdir 31mkdir -- -testdir
69touch -- -testdir/ttt 32touch -- -testdir/ttt
@@ -71,38 +34,12 @@ cp -- /bin/bash -testdir/.
71./doubledash.exp 34./doubledash.exp
72rm -fr -- -testdir 35rm -fr -- -testdir
73 36
74echo "TESTING: trace1 (option-trace.exp)"
75./option-trace.exp
76
77echo "TESTING: trace2 (trace.exp)"
78rm -f index.html*
79./trace.exp
80rm -f index.html*
81
82echo "TESTING: extract command (extract_command.exp)" 37echo "TESTING: extract command (extract_command.exp)"
83./extract_command.exp 38./extract_command.exp
84 39
85echo "TESTING: kmsg access (kmsg.exp)"
86./kmsg.exp
87
88echo "TESTING: chroot overlay (option_chroot_overlay.exp)" 40echo "TESTING: chroot overlay (option_chroot_overlay.exp)"
89./option_chroot_overlay.exp 41./option_chroot_overlay.exp
90 42
91echo "TESTING: blacklist directory (option_blacklist.exp)"
92./option_blacklist.exp
93
94echo "TESTING: blacklist file (opiton_blacklist_file.exp)"
95./option_blacklist_file.exp
96
97echo "TESTING: bind as user (option_bind_user.exp)"
98./option_bind_user.exp
99
100if [ -d /home/bingo ];
101then
102 echo "TESTING: home sanitize (opiton_version.exp)"
103 ./option_version.exp
104fi
105
106echo "TESTING: chroot as user (fs_chroot.exp)" 43echo "TESTING: chroot as user (fs_chroot.exp)"
107./fs_chroot.exp 44./fs_chroot.exp
108 45
@@ -116,15 +53,9 @@ sleep 5
116rm -f tmpreadonly 53rm -f tmpreadonly
117 54
118 55
119echo "TESTING: PID (pid.exp)"
120./pid.exp
121
122echo "TESTING: output (output.exp)" 56echo "TESTING: output (output.exp)"
123./output.exp 57./output.exp
124 58
125echo "TESTING: private (private.exp)"
126./private.exp `whoami`
127
128echo "TESTING: private directory (private_dir.exp)" 59echo "TESTING: private directory (private_dir.exp)"
129rm -fr dirprivate 60rm -fr dirprivate
130mkdir dirprivate 61mkdir dirprivate
@@ -140,52 +71,9 @@ rm -fr dirprivate
140echo "TESTING: overlayfs (fs_overlay.exp)" 71echo "TESTING: overlayfs (fs_overlay.exp)"
141./fs_overlay.exp 72./fs_overlay.exp
142 73
143echo "TESTING: seccomp debug (seccomp-debug.exp)"
144./seccomp-debug.exp
145
146echo "TESTING: seccomp errno (seccomp-errno.exp)"
147./seccomp-errno.exp
148
149echo "TESTING: seccomp su (seccomp-su.exp)"
150./seccomp-su.exp
151
152echo "TESTING: seccomp ptrace (seccomp-ptrace.exp)"
153./seccomp-ptrace.exp
154
155echo "TESTING: seccomp chmod - seccomp lists (seccomp-chmod.exp)"
156./seccomp-chmod.exp
157
158echo "TESTING: seccomp chmod profile - seccomp lists (seccomp-chmod-profile.exp)"
159./seccomp-chmod-profile.exp
160
161echo "TESTING: seccomp empty (seccomp-empty.exp)"
162./seccomp-empty.exp
163
164echo "TESTING: seccomp bad empty (seccomp-bad-empty.exp)"
165./seccomp-bad-empty.exp
166
167echo "TESTING: seccomp dual filter (seccomp-dualfilter.exp)"
168./seccomp-dualfilter.exp
169
170echo "TESTING: read/write /var/tmp (fs_var_tmp.exp)"
171./fs_var_tmp.exp
172
173echo "TESTING: read/write /var/lock (fs_var_lock.exp)"
174./fs_var_lock.exp
175
176echo "TESTING: read/write /dev/shm (fs_dev_shm.exp)"
177./fs_dev_shm.exp
178
179echo "TESTING: quiet (quiet.exp)"
180./quiet.exp
181
182
183echo "TESTING: login SSH (login_ssh.exp)" 74echo "TESTING: login SSH (login_ssh.exp)"
184./login_ssh.exp 75./login_ssh.exp
185 76
186echo "TESTING: ARP (net_arp.exp)"
187./net_arp.exp
188
189echo "TESTING: DNS (dns.exp)" 77echo "TESTING: DNS (dns.exp)"
190./dns.exp 78./dns.exp
191 79