aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorLibravatar netblue30 <netblue30@yahoo.com>2016-04-19 11:28:19 -0400
committerLibravatar netblue30 <netblue30@yahoo.com>2016-04-19 11:28:19 -0400
commit0d5453fc72da34081f22caf191ff31a22be52af8 (patch)
tree763e59f9e403ccb31f41aeac97b908ba2985cb8b /test
parentgoogle-play-music-desktop-player.profile (diff)
downloadfirejail-0d5453fc72da34081f22caf191ff31a22be52af8.tar.gz
firejail-0d5453fc72da34081f22caf191ff31a22be52af8.tar.zst
firejail-0d5453fc72da34081f22caf191ff31a22be52af8.zip
networking profile file support
Diffstat (limited to 'test')
-rw-r--r--test/net-profile.profile10
-rwxr-xr-xtest/net_profile.exp73
-rwxr-xr-xtest/test.sh3
3 files changed, 86 insertions, 0 deletions
diff --git a/test/net-profile.profile b/test/net-profile.profile
new file mode 100644
index 000000000..05052b6dc
--- /dev/null
+++ b/test/net-profile.profile
@@ -0,0 +1,10 @@
1net br0
2mac 00:11:22:33:44:55
3mtu 1000
4net br1
5ip 10.10.30.50
6net br2
7ip 10.10.40.100
8net br3
9defaultgw 10.10.20.2
10
diff --git a/test/net_profile.exp b/test/net_profile.exp
new file mode 100755
index 000000000..37043c906
--- /dev/null
+++ b/test/net_profile.exp
@@ -0,0 +1,73 @@
1#!/usr/bin/expect -f
2
3set timeout 10
4spawn $env(SHELL)
5match_max 100000
6
7# check eth0
8send -- "firejail --profile=net-profile.profile\r"
9expect {
10 timeout {puts "TESTING ERROR 0.0\n";exit}
11 "eth0"
12}
13expect {
14 timeout {puts "TESTING ERROR 0.1\n";exit}
15 "00:11:22:33:44:55"
16}
17expect {
18 timeout {puts "TESTING ERROR 0.1\n";exit}
19 "10.10.20"
20}
21expect {
22 timeout {puts "TESTING ERROR 0.2\n";exit}
23 "255.255.255.248"
24}
25expect {
26 timeout {puts "TESTING ERROR 0.3\n";exit}
27 "UP"
28}
29expect {
30 timeout {puts "TESTING ERROR 0.4\n";exit}
31 "Child process initialized"
32}
33sleep 2
34
35send -- "ip route show\r"
36expect {
37 timeout {puts "TESTING ERROR 1\n";exit}
38 "10.10.30.0/24 dev eth1 proto kernel scope link src 10.10.30.50"
39}
40
41send -- "ip route show\r"
42expect {
43 timeout {puts "TESTING ERROR 2\n";exit}
44 "10.10.40.0/24 dev eth2 proto kernel scope link src 10.10.40.100"
45}
46
47
48# check default gw
49send -- "ip route show\r"
50expect {
51 timeout {puts "TESTING ERROR 3\n";exit}
52 "default via 10.10.20.2 dev eth0"
53}
54
55# check mtu
56send -- "ip link show\r"
57expect {
58 timeout {puts "TESTING ERROR 4\n";exit}
59 "eth0"
60}
61expect {
62 timeout {puts "TESTING ERROR 5\n";exit}
63 "mtu 1000"
64}
65expect {
66 timeout {puts "TESTING ERROR 6\n";exit}
67 "state UP"
68}
69
70sleep 1
71
72puts "\nall done\n"
73
diff --git a/test/test.sh b/test/test.sh
index c6fe4f299..961b48807 100755
--- a/test/test.sh
+++ b/test/test.sh
@@ -10,6 +10,9 @@ echo "TESTING: cpu.print (cpu-print.exp)"
10echo "TESTING: failing under VirtualBox where there is only one CPU" 10echo "TESTING: failing under VirtualBox where there is only one CPU"
11./cpu-print.exp 11./cpu-print.exp
12 12
13echo "TESTING: network profile (net_profile.exp)"
14./net_profile.exp
15
13echo "TESTING: bandwidth (bandwidth.exp)" 16echo "TESTING: bandwidth (bandwidth.exp)"
14./bandwidth.exp 17./bandwidth.exp
15 18