Skip to content

Commit

Permalink
testing
Browse files Browse the repository at this point in the history
  • Loading branch information
netblue30 committed Nov 10, 2016
1 parent 18eecb8 commit 35004af
Show file tree
Hide file tree
Showing 17 changed files with 235 additions and 43 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
*~
*.swp
*.rpm
*.gcda
*.gcno
Makefile
config.log
config.status
Expand Down
11 changes: 7 additions & 4 deletions Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ clean:
for dir in $(APPS) $(MYLIBS); do \
$(MAKE) -C $$dir clean; \
done
rm -fr gcov-file gcov-dir
rm -fr gcov-file gcov-dir gcov-test-initialized
rm -f $(MANPAGES) $(MANPAGES:%=%.gz) firejail*.rpm
rm -f test/utils/index.html*
rm -f test/utils/wget-log
Expand Down Expand Up @@ -146,7 +146,7 @@ uninstall:
rm -f $(DESTDIR)/$(datarootdir)/bash-completion/completions/firecfg

DISTFILES = "src etc platform configure configure.ac Makefile.in install.sh mkman.sh mketc.sh mkdeb.sh mkuid.sh COPYING README RELNOTES"
DISTFILES_TEST = "test/apps test/apps-x11 test/apps-x11-xorg test/environment test/profiles test/utils test/compile test/filters test/network test/fs test/sysutils"
DISTFILES_TEST = "test/apps test/apps-x11 test/apps-x11-xorg test/root test/environment test/profiles test/utils test/compile test/filters test/network test/arguments test/fs test/sysutils"

dist:
mv config.status config.status.old
Expand Down Expand Up @@ -219,15 +219,18 @@ test-arguments:
cd test/arguments; ./arguments.sh | grep TESTING

test-network:
echo "Please read test/network/README file and run the test manually"
cd test/network; ./network.sh | grep TESTING

test-fs:
cd test/fs; ./fs.sh | grep TESTING

test: test-profiles test-fs test-utils test-environment test-apps test-apps-x11 test-apps-x11-xorg test-filters test-arguments
echo "TEST COMPLETE"

gcov:;
gcov-test-initialized:
./gcov-test-init.sh

gcov: gcov-test-initialized
lcov --capture -d src/firejail -d src/firemon -d src/fseccomp -d src/fnet -d src/ftee -d src/lib -d src/firecfg --output-file gcov-file
rm -fr gcov-dir
genhtml gcov-file --output-directory gcov-dir
Expand Down
11 changes: 11 additions & 0 deletions gcov-test-init.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/bin/bash

USER=`whoami`
firejail --help
firemon --help
/usr/lib/firejail/fnet --help
/usr/lib/firejail/fseccomp --help
/usr/lib/firejail/ftee --help
firecfg --help
sudo chown $USER:$USER `find .`
touch gcov-test-initialized
4 changes: 4 additions & 0 deletions src/ftee/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,10 @@ int main(int argc, char **argv) {
usage();
exit(1);
}
if (strcmp(argv[1], "--help") == 0) {
usage();
return 0;
}
char *fname = argv[1];


Expand Down
16 changes: 8 additions & 8 deletions test/network/4bridges_arp.exp
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@ expect {
timeout {puts "TESTING ERROR 0.4\n";exit}
"Child process initialized"
}
sleep 2
sleep 1
send -- "exit\r"
sleep 2
sleep 1

# check eth1
send -- "firejail --net=br0 --net=br1 --net=br2 --net=br3\r"
Expand All @@ -55,9 +55,9 @@ expect {
timeout {puts "TESTING ERROR 1.4\n";exit}
"Child process initialized"
}
sleep 2
sleep 1
send -- "exit\r"
sleep 2
sleep 1


# check eth2
Expand All @@ -82,9 +82,9 @@ expect {
timeout {puts "TESTING ERROR 2.4\n";exit}
"Child process initialized"
}
sleep 2
sleep 1
send -- "exit\r"
sleep 2
sleep 1



Expand All @@ -110,9 +110,9 @@ expect {
timeout {puts "TESTING ERROR 4\n";exit}
"Child process initialized"
}
sleep 2
sleep 1
send -- "exit\r"
sleep 2
sleep 1



Expand Down
16 changes: 8 additions & 8 deletions test/network/4bridges_ip.exp
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@ expect {
timeout {puts "TESTING ERROR 0.4\n";exit}
"Child process initialized"
}
sleep 2
sleep 1
send -- "exit\r"
sleep 2
sleep 1

# check eth1
send -- "firejail --net=br0 --net=br1 --ip=10.10.30.50 --net=br2 --ip=10.10.40.100 --net=br3\r"
Expand All @@ -55,9 +55,9 @@ expect {
timeout {puts "TESTING ERROR 1.4\n";exit}
"Child process initialized"
}
sleep 2
sleep 1
send -- "exit\r"
sleep 2
sleep 1


# check eth2
Expand All @@ -82,9 +82,9 @@ expect {
timeout {puts "TESTING ERROR 2.4\n";exit}
"Child process initialized"
}
sleep 2
sleep 1
send -- "exit\r"
sleep 2
sleep 1



Expand All @@ -110,9 +110,9 @@ expect {
timeout {puts "TESTING ERROR 4\n";exit}
"Child process initialized"
}
sleep 2
sleep 1
send -- "exit\r"
sleep 2
sleep 1



Expand Down
1 change: 0 additions & 1 deletion test/network/README
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,4 @@ Limitations - to be investigated and fixed:
- macvlan interfaces don't seem to work correctly under VirtualBox

Run the test:
$ sudo ./configure
$ ./network.sh | grep TESTING
2 changes: 1 addition & 1 deletion test/network/bandwidth.exp
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ expect {
timeout {puts "TESTING ERROR 0\n";exit}
"Child process initialized"
}
sleep 2
sleep 1

spawn $env(SHELL)
send -- "firejail --bandwidth=test status\r"
Expand Down
26 changes: 21 additions & 5 deletions test/firemon-arp.exp → test/network/firemon-arp.exp
Original file line number Diff line number Diff line change
Expand Up @@ -11,24 +11,40 @@ expect {
}
sleep 1

send -- "firejail\r"
send -- "firejail --name=test1\r"
expect {
timeout {puts "TESTING ERROR 1\n";exit}
"Child process initialized"
}
sleep 1

spawn $env(SHELL)
send -- "firemon --arp\r"
send -- "firejail --name=test2\r"
expect {
timeout {puts "TESTING ERROR 2\n";exit}
"Child process initialized"
}
sleep 1

spawn $env(SHELL)
send -- "firemon --arp\r"
expect {
timeout {puts "TESTING ERROR 3\n";exit}
"name=test1"
}
expect {
timeout {puts "TESTING ERROR 4\n";exit}
"192.168.1.1 dev eth0 lladdr" {puts "Debian testing\n";}
"192.168.1.1 dev enp0s3 lladdr" {puts "Centos 7 testing\n";}
}
expect {
timeout {puts "TESTING ERROR 3\n";exit}
timeout {puts "TESTING ERROR 5\n";exit}
"REACHABLE"
}
sleep 1
expect {
timeout {puts "TESTING ERROR 6\n";exit}
"name=test2"
}
after 100

puts "\n"
puts "\nall done\n""
30 changes: 23 additions & 7 deletions test/firemon-route.exp → test/network/firemon-route.exp
Original file line number Diff line number Diff line change
Expand Up @@ -4,30 +4,46 @@ set timeout 10
spawn $env(SHELL)
match_max 100000

send -- "firejail\r"
send -- "firejail --name=test1\r"
expect {
timeout {puts "TESTING ERROR 0\n";exit}
"Child process initialized"
}
sleep 1

spawn $env(SHELL)
send -- "firemon --route\r"
send -- "firejail --name=test2\r"
expect {
timeout {puts "TESTING ERROR 1\n";exit}
"Child process initialized"
}
sleep 1

spawn $env(SHELL)
send -- "firemon --route\r"
expect {
timeout {puts "TESTING ERROR 2\n";exit}
"name=test1"
}
expect {
timeout {puts "TESTING ERROR 3\n";exit}
"0.0.0.0/0 via 192.168.1.1, dev eth0, metric 0" {puts "Debian testing\n";}
"0.0.0.0/0 via 192.168.1.1, dev enp0s3, metric 1024" {puts "Centos 7 testing\n";}
"0.0.0.0/0 via 192.168.1.1, dev enp0s3, metric 0" {puts "OpenSUSE testing\n";}
"0.0.0.0/0 via 192.168.1.1, dev enp0s3, metric 100" {puts "Arch testing\n";}
"0.0.0.0/0 via 192.168.1.1, dev enp0s3, metric 100" {puts "Arch testing\n";}
}
expect {
timeout {puts "TESTING ERROR 2\n";exit}
timeout {puts "TESTING ERROR 4\n";exit}
"10.10.30.0/24, dev br1, scope link src 10.10.30.1"
}
expect {
timeout {puts "TESTING ERROR 3\n";exit}
timeout {puts "TESTING ERROR 5\n";exit}
"10.10.50.0/24, dev br3, scope link src 10.10.50.1"
}
sleep 1
expect {
timeout {puts "TESTING ERROR 6\n";exit}
"name=test2"
}
after 100

puts "\n"
puts "\nalldone\n"
2 changes: 1 addition & 1 deletion test/network/interface.exp
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ set chroot [lindex $argv 1]
#
# 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"
send -- "firejail --noprofile --interface=eth0.5 --interface=eth0.6\r"
expect {
timeout {puts "TESTING ERROR 0\n";exit}
"Child process initialized"
Expand Down
4 changes: 2 additions & 2 deletions test/network/net_ip.exp
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@ expect {
timeout {puts "TESTING ERROR 4\n";exit}
"Child process initialized"
}
sleep 2
sleep 1
send -- "exit\r"
sleep 2
sleep 1

# check loopback
send -- "firejail --net=br0 --ip=10.10.20.5 --protocol=unix,inet,netlink\r"
Expand Down
4 changes: 2 additions & 2 deletions test/network/net_local.exp
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ expect {
timeout {puts "TESTING ERROR 4\n";exit}
"Child process initialized"
}
sleep 2
sleep 1
send -- "exit\r"
sleep 2
sleep 1

# check loopback
send -- "firejail --noprofile\r"
Expand Down
6 changes: 3 additions & 3 deletions test/network/net_netfilter.exp
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ expect {
timeout {puts "TESTING ERROR 4\n";exit}
"Child process initialized"
}
sleep 2
sleep 1
send -- "exit\r"
sleep 1

Expand All @@ -43,7 +43,7 @@ expect {
"ACCEPT icmp -- any any anywhere" {puts "TESTING ERROR 5.1\n";exit}
"Child process initialized"
}
sleep 2
sleep 1
send -- "exit\r"
sleep 1

Expand All @@ -57,7 +57,7 @@ expect {
timeout {puts "TESTING ERROR 6.1\n";exit}
"Child process initialized"
}
sleep 2
sleep 1
send -- "ping -c 1 -w 3 10.10.20.1\r"
expect {
timeout {puts "TESTING ERROR 6.2\n";exit}
Expand Down
2 changes: 1 addition & 1 deletion test/network/net_profile.exp
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ expect {
timeout {puts "TESTING ERROR 0.4\n";exit}
"Child process initialized"
}
sleep 2
sleep 1

send -- "ip route show\r"
expect {
Expand Down
Loading

0 comments on commit 35004af

Please sign in to comment.