From 334c79edd83377a09c138800c0a2fefaf9c7981f Mon Sep 17 00:00:00 2001 From: netblue30 Date: Thu, 10 Nov 2016 07:18:24 -0500 Subject: testing --- test/network/firemon-arp.exp | 2 +- test/network/firemon-interfaces.exp | 67 +++++++++++++++++++++++++++++++++++++ test/network/netstats.exp | 39 +++++++++++++++++++++ test/network/network.sh | 6 ++++ test/utils/firemon-cpu.exp | 44 ++++++++++++++++++++++++ test/utils/top.exp | 40 ++++++++++++++++++++++ test/utils/utils.sh | 9 +++++ 7 files changed, 206 insertions(+), 1 deletion(-) create mode 100755 test/network/firemon-interfaces.exp create mode 100755 test/network/netstats.exp create mode 100755 test/utils/firemon-cpu.exp create mode 100755 test/utils/top.exp (limited to 'test') diff --git a/test/network/firemon-arp.exp b/test/network/firemon-arp.exp index 0a543c3b4..e40ffb609 100755 --- a/test/network/firemon-arp.exp +++ b/test/network/firemon-arp.exp @@ -47,4 +47,4 @@ expect { } after 100 -puts "\nall done\n"" +puts "\nall done\n" diff --git a/test/network/firemon-interfaces.exp b/test/network/firemon-interfaces.exp new file mode 100755 index 000000000..deb8594af --- /dev/null +++ b/test/network/firemon-interfaces.exp @@ -0,0 +1,67 @@ +#!/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=eth0 --name=test1\r" +expect { + timeout {puts "TESTING ERROR 9\n";exit} + "Child process initialized" +} +sleep 1 + +spawn $env(SHELL) +send -- "firejail --net=eth0 --name=test2\r" +expect { + timeout {puts "TESTING ERROR 9\n";exit} + "Child process initialized" +} +sleep 1 + +spawn $env(SHELL) +send -- "firemon --interface\r" +expect { + timeout {puts "TESTING ERROR 9\n";exit} + "Link status" +} +expect { + timeout {puts "TESTING ERROR 9\n";exit} + "lo UP" +} +expect { + timeout {puts "TESTING ERROR 9\n";exit} + "eth0-" +} +expect { + timeout {puts "TESTING ERROR 9\n";exit} + "IPv4 status" +} +expect { + timeout {puts "TESTING ERROR 9\n";exit} + "lo UP" +} +expect { + timeout {puts "TESTING ERROR 9\n";exit} + "eth0-" +} +expect { + timeout {puts "TESTING ERROR 9\n";exit} + "IPv6 status" +} +expect { + timeout {puts "TESTING ERROR 9\n";exit} + "lo UP" +} +expect { + timeout {puts "TESTING ERROR 9\n";exit} + "eth0-" +} + +after 100 + +puts "\n" + diff --git a/test/network/netstats.exp b/test/network/netstats.exp new file mode 100755 index 000000000..41232061d --- /dev/null +++ b/test/network/netstats.exp @@ -0,0 +1,39 @@ +#!/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=eth0 --name=test1\r" +expect { + timeout {puts "TESTING ERROR 9\n";exit} + "Child process initialized" +} +sleep 1 + +spawn $env(SHELL) +send -- "firejail --net=eth0 --name=test2\r" +expect { + timeout {puts "TESTING ERROR 9\n";exit} + "Child process initialized" +} +sleep 1 + +spawn $env(SHELL) +send -- "firejail --netstats\r" +sleep 4 +expect { + timeout {puts "TESTING ERROR 9\n";exit} + "name=test1" +} +expect { + timeout {puts "TESTING ERROR 9\n";exit} + "name=test2" +} +after 100 + +puts "\n" + diff --git a/test/network/network.sh b/test/network/network.sh index 28f707952..e1646d64a 100755 --- a/test/network/network.sh +++ b/test/network/network.sh @@ -8,9 +8,15 @@ export MALLOC_PERTURB_=$(($RANDOM % 255 + 1)) sudo ./configure +echo "TESTING: firemon interface (firemon-interfaces.exp)" +sudo ./firemon-interfaces.exp + echo "TESTING: firemon arp (firemon-arp.exp)" ./firemon-arp.exp +echo "TESTING: firemon netstats (netstats.exp)" +./netstats.exp + echo "TESTING: firemon route (firemon-route.exp)" ./firemon-route.exp diff --git a/test/utils/firemon-cpu.exp b/test/utils/firemon-cpu.exp new file mode 100755 index 000000000..22e44512c --- /dev/null +++ b/test/utils/firemon-cpu.exp @@ -0,0 +1,44 @@ +#!/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 --name=test1\r" +expect { + timeout {puts "TESTING ERROR 0\n";exit} + "Child process initialized" +} +sleep 1 + +spawn $env(SHELL) +send -- "firejail --name=test2\r" +expect { + timeout {puts "TESTING ERROR 1\n";exit} + "Child process initialized" +} +sleep 1 + +spawn $env(SHELL) +send -- "firemon --cpu\r" +sleep 4 +expect { + timeout {puts "TESTING ERROR 2\n";exit} + "name=test1" +} +expect { + timeout {puts "TESTING ERROR 3\n";exit} + "Cpus_allowed_list" +} +expect { + timeout {puts "TESTING ERROR 4\n";exit} + "name=test2" +} + +after 100 + +puts "\nall done\n" + diff --git a/test/utils/top.exp b/test/utils/top.exp new file mode 100755 index 000000000..d530e5a85 --- /dev/null +++ b/test/utils/top.exp @@ -0,0 +1,40 @@ +#!/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 --name=test1\r" +expect { + timeout {puts "TESTING ERROR 0\n";exit} + "Child process initialized" +} +sleep 1 + +spawn $env(SHELL) +send -- "firejail --name=test2\r" +expect { + timeout {puts "TESTING ERROR 1\n";exit} + "Child process initialized" +} +sleep 1 + +spawn $env(SHELL) +send -- "firejail --top\r" +sleep 4 +expect { + timeout {puts "TESTING ERROR 2\n";exit} + "name=test1" +} +expect { + timeout {puts "TESTING ERROR 2\n";exit} + "name=test2" +} + +after 100 + +puts "\nall done\n" + diff --git a/test/utils/utils.sh b/test/utils/utils.sh index ff4e5e086..557f2c961 100755 --- a/test/utils/utils.sh +++ b/test/utils/utils.sh @@ -88,6 +88,15 @@ echo "TESTING: firemon --seccomp (test/utils/seccomp.exp)" echo "TESTING: firemon --caps (test/utils/caps.exp)" ./caps.exp +echo "TESTING: top (test/utils/top.exp)" +./top.exp + echo "TESTING: file transfer (test/utils/ls.exp)" ./ls.exp +echo "TESTING: firemon cpu (test/utils/firemon-cpu.exp)" +./firemon-cpu.exp + +echo "TESTING: firemon cgroup (test/utils/firemon-cgroup.exp)" +./firemon-cgroup.exp + -- cgit v1.2.3-54-g00ecf