aboutsummaryrefslogtreecommitdiffstats
path: root/test/stress
diff options
context:
space:
mode:
authorLibravatar netblue30 <netblue30@yahoo.com>2017-03-29 12:09:26 -0400
committerLibravatar netblue30 <netblue30@yahoo.com>2017-03-29 12:09:26 -0400
commitb2b603eac941d2cdea97d7886dc7181c179a8160 (patch)
treeafb0c44459b96f331e07772959bd7e983a082a05 /test/stress
parentmerges (diff)
downloadfirejail-b2b603eac941d2cdea97d7886dc7181c179a8160.tar.gz
firejail-b2b603eac941d2cdea97d7886dc7181c179a8160.tar.zst
firejail-b2b603eac941d2cdea97d7886dc7181c179a8160.zip
testing
Diffstat (limited to 'test/stress')
-rwxr-xr-xtest/stress/blacklist.exp60
-rwxr-xr-xtest/stress/env.exp31
-rwxr-xr-xtest/stress/net_macvlan.exp81
-rwxr-xr-xtest/stress/stress.sh31
4 files changed, 141 insertions, 62 deletions
diff --git a/test/stress/blacklist.exp b/test/stress/blacklist.exp
new file mode 100755
index 000000000..33e2c262e
--- /dev/null
+++ b/test/stress/blacklist.exp
@@ -0,0 +1,60 @@
1#!/usr/bin/expect -f
2# This file is part of Firejail project
3# Copyright (C) 2014-2017 Firejail Authors
4# License GPL v2
5
6set timeout 10
7spawn $env(SHELL)
8match_max 100000
9
10set MAXi 100
11
12# blacklist testing
13set i 1
14send -- "firejail --profile=blacklist.profile\r"
15expect {
16 timeout {puts "TESTING ERROR 1\n";exit}
17 "Child process initialized"
18}
19
20while { $i <= $MAXi } {
21 send -- "cat ~/fj-stress-test/testfile$i\r"
22 expect {
23 timeout {puts "TESTING ERROR 1\n";exit}
24 "denied"
25 }
26 incr i
27 after 100
28}
29after 100
30
31send -- "exit\r"
32sleep 1
33
34# noblacklist testing
35set i 1
36send -- "firejail --profile=noblacklist.profile\r"
37expect {
38 timeout {puts "TESTING ERROR 1\n";exit}
39 "Child process initialized"
40}
41
42while { $i <= $MAXi } {
43 send -- "cat ~/fj-stress-test/testfile$i\r"
44 expect {
45 timeout {puts "TESTING ERROR 1\n";exit}
46 "hello"
47 }
48 incr i
49 after 100
50}
51after 100
52
53send -- "exit\r"
54sleep 1
55
56
57
58after 100
59puts "\nall done\n"
60
diff --git a/test/stress/env.exp b/test/stress/env.exp
new file mode 100755
index 000000000..b327ba498
--- /dev/null
+++ b/test/stress/env.exp
@@ -0,0 +1,31 @@
1#!/usr/bin/expect -f
2# This file is part of Firejail project
3# Copyright (C) 2014-2017 Firejail Authors
4# License GPL v2
5
6set timeout 10
7spawn $env(SHELL)
8match_max 100000
9
10# env testing
11send -- "firejail --profile=env.profile\r"
12expect {
13 timeout {puts "TESTING ERROR 1\n";exit}
14 "Child process initialized"
15}
16
17send -- "env | grep FJSTRESS77\r"
18expect {
19 timeout {puts "TESTING ERROR 2\n";exit}
20 "FJSTRESS77=stress"
21}
22
23send -- "env | grep FJSTRESS | wc -l\r"
24expect {
25 timeout {puts "TESTING ERROR 3\n";exit}
26 "100"
27}
28
29send -- "exit\r"
30after 100
31puts "\nall done\n"
diff --git a/test/stress/net_macvlan.exp b/test/stress/net_macvlan.exp
index 187b5c39f..e0e494ef8 100755
--- a/test/stress/net_macvlan.exp
+++ b/test/stress/net_macvlan.exp
@@ -7,19 +7,9 @@ set timeout 10
7spawn $env(SHELL) 7spawn $env(SHELL)
8match_max 100000 8match_max 100000
9 9
10# check the existing address 10# grab 10 ip addresses
11spawn $env(SHELL) 11set MAXi 210
12send -- "firejail --net=eth0 --ip=192.168.1.60\r" 12set i 201
13expect {
14 timeout {puts "TESTING ERROR 1.1\n";puts "Please open a sandbox on 192.168.1.60\n";exit}
15 "192.168.1.60 is interface eth0 address"
16}
17
18
19
20# grab 30 ip addresses
21set MAXi 229
22set i 200
23while { $i <= $MAXi } { 13while { $i <= $MAXi } {
24 spawn $env(SHELL) 14 spawn $env(SHELL)
25 send -- "firejail --net=eth0 --ip=192.168.1.$i\r" 15 send -- "firejail --net=eth0 --ip=192.168.1.$i\r"
@@ -32,62 +22,31 @@ while { $i <= $MAXi } {
32} 22}
33 23
34 24
35# check an existing address 25# grab 10 more
36spawn $env(SHELL) 26set MAXi 210
37send -- "firejail --net=eth0 --ip=192.168.1.200\r" 27set i 201
38expect {
39 timeout {puts "TESTING ERROR 1\n";exit}
40 "the address 192.168.1.200 is already in use"
41}
42
43
44set MAXi 254
45set i 2
46while { $i <= $MAXi } { 28while { $i <= $MAXi } {
47 spawn $env(SHELL) 29 spawn $env(SHELL)
48 send -- "firejail --net=eth0\r" 30 send -- "firejail --net=eth0 --iprange=192.168.1.201,192.168.1.220\r"
49 expect { 31 expect {
50 timeout {puts "TESTING ERROR 2.1\n";exit} 32 timeout {puts "TESTING ERROR 2\n";exit}
51 "192.168.1.60" {puts "TESTING ERROR 2.2\n";exit}
52 "192.168.1.200" {puts "TESTING ERROR 3\n";exit}
53 "192.168.1.201" {puts "TESTING ERROR 3\n";exit}
54 "192.168.1.202" {puts "TESTING ERROR 3\n";exit}
55 "192.168.1.203" {puts "TESTING ERROR 3\n";exit}
56 "192.168.1.204" {puts "TESTING ERROR 3\n";exit}
57 "192.168.1.205" {puts "TESTING ERROR 3\n";exit}
58 "192.168.1.206" {puts "TESTING ERROR 3\n";exit}
59 "192.168.1.207" {puts "TESTING ERROR 3\n";exit}
60 "192.168.1.208" {puts "TESTING ERROR 3\n";exit}
61 "192.168.1.209" {puts "TESTING ERROR 3\n";exit}
62 "192.168.1.210" {puts "TESTING ERROR 3\n";exit}
63 "192.168.1.211" {puts "TESTING ERROR 3\n";exit}
64 "192.168.1.212" {puts "TESTING ERROR 3\n";exit}
65 "192.168.1.213" {puts "TESTING ERROR 3\n";exit}
66 "192.168.1.214" {puts "TESTING ERROR 3\n";exit}
67 "192.168.1.215" {puts "TESTING ERROR 3\n";exit}
68 "192.168.1.216" {puts "TESTING ERROR 3\n";exit}
69 "192.168.1.217" {puts "TESTING ERROR 3\n";exit}
70 "192.168.1.218" {puts "TESTING ERROR 3\n";exit}
71 "192.168.1.219" {puts "TESTING ERROR 3\n";exit}
72 "192.168.1.220" {puts "TESTING ERROR 3\n";exit}
73 "192.168.1.221" {puts "TESTING ERROR 3\n";exit}
74 "192.168.1.222" {puts "TESTING ERROR 3\n";exit}
75 "192.168.1.223" {puts "TESTING ERROR 3\n";exit}
76 "192.168.1.224" {puts "TESTING ERROR 3\n";exit}
77 "192.168.1.225" {puts "TESTING ERROR 3\n";exit}
78 "192.168.1.226" {puts "TESTING ERROR 3\n";exit}
79 "192.168.1.227" {puts "TESTING ERROR 3\n";exit}
80 "192.168.1.228" {puts "TESTING ERROR 3\n";exit}
81 "192.168.1.229" {puts "TESTING ERROR 3\n";exit}
82 "Child process initialized" 33 "Child process initialized"
83 } 34 }
84 puts "************ $i ******************\n" 35 puts "************ $i ******************\n"
85 incr i 36 incr i
86 after 100 37 after 100
87# sleep 1
88} 38}
89send -- "exit\r"
90after 100
91 39
92puts "\n" 40# the next one should fail, all 20 addresses are in use
41spawn $env(SHELL)
42send -- "firejail --debug --net=eth0 --iprange=192.168.1.201,192.168.1.220\r"
43expect {
44 timeout {puts "TESTING ERROR 3\n";exit}
45 "cannot assign an IP address"
46}
47
48
49
50after 100
51puts "\nall done\n"
93 52
diff --git a/test/stress/stress.sh b/test/stress/stress.sh
index 96bbaf61b..e95d304c4 100755
--- a/test/stress/stress.sh
+++ b/test/stress/stress.sh
@@ -6,6 +6,35 @@
6export MALLOC_CHECK_=3 6export MALLOC_CHECK_=3
7export MALLOC_PERTURB_=$(($RANDOM % 255 + 1)) 7export MALLOC_PERTURB_=$(($RANDOM % 255 + 1))
8 8
9echo "TESTING: macvlan (net_macvlan.exp)" 9
10# blacklist testing
11rm -fr ~/fj-stress-test
12mkdir ~/fj-stress-test
13rm blacklist.profile
14rm noblacklist.profile
15rm env.profile
16for i in `seq 1 100`;
17do
18 echo $i
19 echo "hello" > ~/fj-stress-test/testfile$i
20 echo "blacklist ~/fj-stress-test/testfile$i" >> blacklist.profile
21 echo "noblacklist ~/fj-stress-test/testfile$i" >> noblacklist.profile
22 echo "env FJSTRESS$i=stress" >> env.profile
23done
24echo "include blacklist.profile" >> noblacklist.profile
25
26echo "TESTING: stress blacklist/noblacklist (/test/stress/blacklist.exp)"
27./blacklist.exp
28
29echo "TESTING: stress env (/test/stress/env.exp)"
30./env.exp
31
32rm -fr ~/fj-stress-test
33rm blacklist.profile
34rm noblacklist.profile
35rm env.profile
36
37# network arp testing
38echo "TESTING: macvlan (test/stress/net_macvlan.exp)"
10./net_macvlan.exp 39./net_macvlan.exp
11 40