From 0d5453fc72da34081f22caf191ff31a22be52af8 Mon Sep 17 00:00:00 2001 From: netblue30 Date: Tue, 19 Apr 2016 11:28:19 -0400 Subject: networking profile file support --- test/net-profile.profile | 10 +++++++ test/net_profile.exp | 73 ++++++++++++++++++++++++++++++++++++++++++++++++ test/test.sh | 3 ++ 3 files changed, 86 insertions(+) create mode 100644 test/net-profile.profile create mode 100755 test/net_profile.exp (limited to 'test') 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 @@ +net br0 +mac 00:11:22:33:44:55 +mtu 1000 +net br1 +ip 10.10.30.50 +net br2 +ip 10.10.40.100 +net br3 +defaultgw 10.10.20.2 + 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 @@ +#!/usr/bin/expect -f + +set timeout 10 +spawn $env(SHELL) +match_max 100000 + +# check eth0 +send -- "firejail --profile=net-profile.profile\r" +expect { + timeout {puts "TESTING ERROR 0.0\n";exit} + "eth0" +} +expect { + timeout {puts "TESTING ERROR 0.1\n";exit} + "00:11:22:33:44:55" +} +expect { + timeout {puts "TESTING ERROR 0.1\n";exit} + "10.10.20" +} +expect { + timeout {puts "TESTING ERROR 0.2\n";exit} + "255.255.255.248" +} +expect { + timeout {puts "TESTING ERROR 0.3\n";exit} + "UP" +} +expect { + timeout {puts "TESTING ERROR 0.4\n";exit} + "Child process initialized" +} +sleep 2 + +send -- "ip route show\r" +expect { + timeout {puts "TESTING ERROR 1\n";exit} + "10.10.30.0/24 dev eth1 proto kernel scope link src 10.10.30.50" +} + +send -- "ip route show\r" +expect { + timeout {puts "TESTING ERROR 2\n";exit} + "10.10.40.0/24 dev eth2 proto kernel scope link src 10.10.40.100" +} + + +# check default gw +send -- "ip route show\r" +expect { + timeout {puts "TESTING ERROR 3\n";exit} + "default via 10.10.20.2 dev eth0" +} + +# check mtu +send -- "ip link show\r" +expect { + timeout {puts "TESTING ERROR 4\n";exit} + "eth0" +} +expect { + timeout {puts "TESTING ERROR 5\n";exit} + "mtu 1000" +} +expect { + timeout {puts "TESTING ERROR 6\n";exit} + "state UP" +} + +sleep 1 + +puts "\nall done\n" + 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)" echo "TESTING: failing under VirtualBox where there is only one CPU" ./cpu-print.exp +echo "TESTING: network profile (net_profile.exp)" +./net_profile.exp + echo "TESTING: bandwidth (bandwidth.exp)" ./bandwidth.exp -- cgit v1.2.3-54-g00ecf