From e44f60a25011e388ae9f33ce8d16b9d8cb143502 Mon Sep 17 00:00:00 2001 From: netblue30 Date: Wed, 9 Nov 2016 09:43:31 -0500 Subject: testing --- test/network/interface.exp | 66 ++++++++++++++++++++++++++++++++++++++++ test/network/net_scan.exp | 75 ++++++++++++++++++++++++++++++++++++++++++++++ test/network/network.sh | 6 ++++ 3 files changed, 147 insertions(+) create mode 100755 test/network/interface.exp create mode 100755 test/network/net_scan.exp (limited to 'test/network') diff --git a/test/network/interface.exp b/test/network/interface.exp new file mode 100755 index 000000000..b15563eec --- /dev/null +++ b/test/network/interface.exp @@ -0,0 +1,66 @@ +#!/usr/bin/expect -f +# +# interface +# + +set timeout 10 +spawn $env(SHELL) +match_max 100000 +set overlay [lindex $argv 0] +set chroot [lindex $argv 1] + +# +# N +# +# todo: seems to be unable to find interface eth0.7 +#send -- "firejail --noprofile --interface=eth0.5 --interface=eth0.6 --interface=eth0.7\r" +send -- "firejail --noprofile --interface=eth0.7 --interface=eth0.6\r" +expect { + timeout {puts "TESTING ERROR 0\n";exit} + "Child process initialized" +} +sleep 1 + +send -- "/sbin/ifconfig\r" +expect { + timeout {puts "TESTING ERROR 1\n";exit} + "eth0.5" +} +expect { + timeout {puts "TESTING ERROR 2n";exit} + "Link" +} +expect { + timeout {puts "TESTING ERROR 3\n";exit} + "10.10.205.10" +} +expect { + timeout {puts "TESTING ERROR 4\n";exit} + "UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1" +} +after 100 + +send -- "/sbin/ifconfig\r" +expect { + timeout {puts "TESTING ERROR 5\n";exit} + "eth0.6" +} +expect { + timeout {puts "TESTING ERROR 6\n";exit} + "Link" +} +expect { + timeout {puts "TESTING ERROR 7\n";exit} + "10.10.206.10" +} +expect { + timeout {puts "TESTING ERROR 8\n";exit} + "UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1" +} +after 100 + +send -- "exit\r" +sleep 1 + + +puts "\nall done\n" diff --git a/test/network/net_scan.exp b/test/network/net_scan.exp new file mode 100755 index 000000000..5afbbeea6 --- /dev/null +++ b/test/network/net_scan.exp @@ -0,0 +1,75 @@ +#!/usr/bin/expect -f +# This file is part of Firejail project +# Copyright (C) 2014-2016 Firejail Authors +# License GPL v2 + +set timeout 10 +spawn $env(SHELL) +match_max 100000 + +# +send -- "firejail --net=br1 --ip=10.10.30.50\r" +expect { + timeout {puts "TESTING ERROR 0\n";exit} + "eth0" +} +expect { + timeout {puts "TESTING ERROR 1\n";exit} + "10.10.30.50" +} +expect { + timeout {puts "TESTING ERROR 2\n";exit} + "255.255.255.0" +} +expect { + timeout {puts "TESTING ERROR 3\n";exit} + "Child process initialized" +} +sleep 1 + +spawn $env(SHELL) +send -- "firejail --net=br1 --ip=10.10.30.51\r" +expect { + timeout {puts "TESTING ERROR 4\n";exit} + "eth0" +} +expect { + timeout {puts "TESTING ERROR 5\n";exit} + "10.10.30.51" +} +expect { + timeout {puts "TESTING ERROR 6\n";exit} + "255.255.255.0" +} +expect { + timeout {puts "TESTING ERROR 7\n";exit} + "Child process initialized" +} +sleep 1 + +spawn $env(SHELL) +send -- "firejail --net=br1 --scan\r" +expect { + timeout {puts "TESTING ERROR 8\n";exit} + "eth0" +} +expect { + timeout {puts "TESTING ERROR 9\n";exit} + "10.10.30.50" +} +expect { + timeout {puts "TESTING ERROR 10\n";exit} + "10.10.30.51" +} +expect { + timeout {puts "TESTING ERROR 11\n";exit} + "Child process initialized" +} +sleep 1 + + + +after 100 + +puts "\nall done\n" + diff --git a/test/network/network.sh b/test/network/network.sh index 7b6d66e34..e0087411d 100755 --- a/test/network/network.sh +++ b/test/network/network.sh @@ -52,6 +52,12 @@ echo "TESTING: network default gateway test 2 (net_defaultgw2.exp)" echo "TESTING: network default gateway test 3 (net_defaultgw3.exp)" ./net_defaultgw3.exp +echo "TESTING: scan (net_scan.exp)" +./net_scan.exp + +echo "TESTING: interface (interface.exp)" +./interface.exp + echo "TESTING: netfilter (net_netfilter.exp)" ./net_netfilter.exp -- cgit v1.2.3-54-g00ecf