From 686bc51e38b0718651e82818871b0bf1451c8b21 Mon Sep 17 00:00:00 2001 From: netblue30 Date: Wed, 23 Dec 2015 12:38:13 -0500 Subject: 0.9.36 testing --- test/features/1.1.exp | 31 ++++---- test/features/1.10.exp | 38 +++++---- test/features/1.2.exp | 79 ++++++++++--------- test/features/1.4.exp | 55 +++++++------ test/features/1.5.exp | 31 ++++---- test/features/1.6.exp | 31 ++++---- test/features/1.7.exp | 31 ++++---- test/features/1.8.exp | 43 +++++----- test/features/2.1.exp | 63 ++++++++------- test/features/2.2.exp | 47 +++++------ test/features/2.3.exp | 183 ++++++++++++++++++++++--------------------- test/features/2.4.exp | 148 +++++++++++++++++----------------- test/features/2.5.exp | 55 +++++++------ test/features/2.6.exp | 31 ++++---- test/features/3.1.exp | 31 ++++---- test/features/3.2.exp | 31 ++++---- test/features/3.3.exp | 31 ++++---- test/features/3.4.exp | 31 ++++---- test/features/test.sh | 53 ++++++++----- test/net_mac.exp | 2 +- test/option-join-profile.exp | 2 +- 21 files changed, 560 insertions(+), 487 deletions(-) (limited to 'test') diff --git a/test/features/1.1.exp b/test/features/1.1.exp index 06c42c815..dafa4630e 100755 --- a/test/features/1.1.exp +++ b/test/features/1.1.exp @@ -6,6 +6,7 @@ set timeout 10 spawn $env(SHELL) match_max 100000 +set overlay [lindex $argv 0] # # N @@ -30,21 +31,23 @@ sleep 1 # # O # -send -- "firejail --noprofile --overlay\r" -expect { - timeout {puts "TESTING ERROR 2\n";exit} - "Child process initialized" +if { $overlay == "overlay" } { + send -- "firejail --noprofile --overlay\r" + expect { + timeout {puts "TESTING ERROR 2\n";exit} + "Child process initialized" + } + sleep 1 + + send -- "ls -l /boot\r" + expect { + timeout {puts "TESTING ERROR 3\n";exit} + "Permission denied" + } + after 100 + send -- "exit\r" + sleep 1 } -sleep 1 - -send -- "ls -l /boot\r" -expect { - timeout {puts "TESTING ERROR 3\n";exit} - "Permission denied" -} -after 100 -send -- "exit\r" -sleep 1 # # C diff --git a/test/features/1.10.exp b/test/features/1.10.exp index a6e0f9281..96e3c38d1 100755 --- a/test/features/1.10.exp +++ b/test/features/1.10.exp @@ -6,6 +6,7 @@ set timeout 10 spawn $env(SHELL) match_max 100000 +set overlay [lindex $argv 0] # # N @@ -20,7 +21,8 @@ sleep 1 send -- "ls -l /selinux\r" expect { timeout {puts "TESTING ERROR 1\n";exit} - "Permission denied" + "Permission denied" {puts "denied\n"} + "No such file or directory" {puts "no file\n"} } after 100 send -- "exit\r" @@ -30,21 +32,24 @@ sleep 1 # # O # -send -- "firejail --noprofile --overlay\r" -expect { - timeout {puts "TESTING ERROR 2\n";exit} - "Child process initialized" -} -sleep 1 - -send -- "ls -l /selinux\r" -expect { - timeout {puts "TESTING ERROR 3\n";exit} - "Permission denied" +if { $overlay == "overlay" } { + send -- "firejail --noprofile --overlay\r" + expect { + timeout {puts "TESTING ERROR 2\n";exit} + "Child process initialized" + } + sleep 1 + + send -- "ls -l /selinux\r" + expect { + timeout {puts "TESTING ERROR 3\n";exit} + "Permission denied" {puts "denied\n"} + "No such file or directory" {puts "no file\n"} + } + after 100 + send -- "exit\r" + sleep 1 } -after 100 -send -- "exit\r" -sleep 1 # # C @@ -59,7 +64,8 @@ sleep 1 send -- "ls -l /selinux\r" expect { timeout {puts "TESTING ERROR 5\n";exit} - "Permission denied" + "Permission denied" {puts "denied\n"} + "No such file or directory" {puts "no file\n"} } after 100 send -- "exit\r" diff --git a/test/features/1.2.exp b/test/features/1.2.exp index 399e9948b..d487537e4 100755 --- a/test/features/1.2.exp +++ b/test/features/1.2.exp @@ -6,6 +6,7 @@ set timeout 10 spawn $env(SHELL) match_max 100000 +set overlay [lindex $argv 0] # # N @@ -54,45 +55,47 @@ sleep 1 # # O # -send -- "firejail --noprofile --overlay\r" -expect { - timeout {puts "TESTING ERROR 2\n";exit} - "Child process initialized" -} -sleep 1 - -send -- "cat /proc/mounts | grep proc\r" -expect { - timeout {puts "TESTING ERROR 3.1\n";exit} - "proc /proc proc" +if { $overlay == "overlay" } { + send -- "firejail --noprofile --overlay\r" + expect { + timeout {puts "TESTING ERROR 2\n";exit} + "Child process initialized" + } + sleep 1 + + send -- "cat /proc/mounts | grep proc\r" + expect { + timeout {puts "TESTING ERROR 3.1\n";exit} + "proc /proc proc" + } + expect { + timeout {puts "TESTING ERROR 3.2\n";exit} + "proc /proc proc" + } + expect { + timeout {puts "TESTING ERROR 3.3\n";exit} + "proc /proc/sys proc" + } + expect { + timeout {puts "TESTING ERROR 3.4\n";exit} + "proc /proc/sysrq-trigger proc" + } + expect { + timeout {puts "TESTING ERROR 3.5\n";exit} + "proc /proc/sys/kernel/hotplug" + } + expect { + timeout {puts "TESTING ERROR 3.6\n";exit} + "proc /proc/irq proc" + } + expect { + timeout {puts "TESTING ERROR 3.7\n";exit} + "proc /proc/bus proc" + } + after 100 + send -- "exit\r" + sleep 1 } -expect { - timeout {puts "TESTING ERROR 3.2\n";exit} - "proc /proc proc" -} -expect { - timeout {puts "TESTING ERROR 3.3\n";exit} - "proc /proc/sys proc" -} -expect { - timeout {puts "TESTING ERROR 3.4\n";exit} - "proc /proc/sysrq-trigger proc" -} -expect { - timeout {puts "TESTING ERROR 3.5\n";exit} - "proc /proc/sys/kernel/hotplug" -} -expect { - timeout {puts "TESTING ERROR 3.6\n";exit} - "proc /proc/irq proc" -} -expect { - timeout {puts "TESTING ERROR 3.7\n";exit} - "proc /proc/bus proc" -} -after 100 -send -- "exit\r" -sleep 1 # # C diff --git a/test/features/1.4.exp b/test/features/1.4.exp index 82d683175..113a328c9 100755 --- a/test/features/1.4.exp +++ b/test/features/1.4.exp @@ -6,6 +6,7 @@ set timeout 10 spawn $env(SHELL) match_max 100000 +set overlay [lindex $argv 0] # # N @@ -43,33 +44,35 @@ sleep 1 # # O # -send -- "firejail --noprofile --overlay\r" -expect { - timeout {puts "TESTING ERROR 2\n";exit} - "Child process initialized" +if { $overlay == "overlay" } { + send -- "firejail --noprofile --overlay\r" + expect { + timeout {puts "TESTING ERROR 2\n";exit} + "Child process initialized" + } + sleep 1 + + send -- "ls -l /home | wc -l\r" + expect { + timeout {puts "TESTING ERROR 3\n";exit} + "2" + } + after 100 + send -- "cat /etc/passwd | grep 1001 | wc -l\r" + expect { + timeout {puts "TESTING ERROR 3.1\n";exit} + "0" + } + after 100 + send -- "cat /etc/group | grep 1001 | wc -l\r" + expect { + timeout {puts "TESTING ERROR 3.2\n";exit} + "0" + } + after 100 + send -- "exit\r" + sleep 1 } -sleep 1 - -send -- "ls -l /home | wc -l\r" -expect { - timeout {puts "TESTING ERROR 3\n";exit} - "2" -} -after 100 -send -- "cat /etc/passwd | grep 1001 | wc -l\r" -expect { - timeout {puts "TESTING ERROR 3.1\n";exit} - "0" -} -after 100 -send -- "cat /etc/group | grep 1001 | wc -l\r" -expect { - timeout {puts "TESTING ERROR 3.2\n";exit} - "0" -} -after 100 -send -- "exit\r" -sleep 1 # # C diff --git a/test/features/1.5.exp b/test/features/1.5.exp index 84c00937f..5a2643ede 100755 --- a/test/features/1.5.exp +++ b/test/features/1.5.exp @@ -6,6 +6,7 @@ set timeout 10 spawn $env(SHELL) match_max 100000 +set overlay [lindex $argv 0] # # N @@ -30,21 +31,23 @@ sleep 1 # # O # -send -- "firejail --noprofile --overlay\r" -expect { - timeout {puts "TESTING ERROR 2\n";exit} - "Child process initialized" +if { $overlay == "overlay" } { + send -- "firejail --noprofile --overlay\r" + expect { + timeout {puts "TESTING ERROR 2\n";exit} + "Child process initialized" + } + sleep 1 + + send -- "ps aux | wc -l \r" + expect { + timeout {puts "TESTING ERROR 3\n";exit} + "5" + } + after 100 + send -- "exit\r" + sleep 1 } -sleep 1 - -send -- "ps aux | wc -l \r" -expect { - timeout {puts "TESTING ERROR 3\n";exit} - "5" -} -after 100 -send -- "exit\r" -sleep 1 # # C diff --git a/test/features/1.6.exp b/test/features/1.6.exp index 0a4b788b8..8ed20fa46 100755 --- a/test/features/1.6.exp +++ b/test/features/1.6.exp @@ -6,6 +6,7 @@ set timeout 10 spawn $env(SHELL) match_max 100000 +set overlay [lindex $argv 0] # # N @@ -30,21 +31,23 @@ sleep 1 # # O # -send -- "firejail --noprofile --overlay\r" -expect { - timeout {puts "TESTING ERROR 2\n";exit} - "Child process initialized" +if { $overlay == "overlay" } { + send -- "firejail --noprofile --overlay\r" + expect { + timeout {puts "TESTING ERROR 2\n";exit} + "Child process initialized" + } + sleep 1 + + send -- "ls -l /var/log/syslog | wc -l\r" + expect { + timeout {puts "TESTING ERROR 3\n";exit} + "0" + } + after 100 + send -- "exit\r" + sleep 1 } -sleep 1 - -send -- "ls -l /var/log/syslog | wc -l\r" -expect { - timeout {puts "TESTING ERROR 3\n";exit} - "0" -} -after 100 -send -- "exit\r" -sleep 1 # # C diff --git a/test/features/1.7.exp b/test/features/1.7.exp index c95184fd1..35351b7d9 100755 --- a/test/features/1.7.exp +++ b/test/features/1.7.exp @@ -6,6 +6,7 @@ set timeout 10 spawn $env(SHELL) match_max 100000 +set overlay [lindex $argv 0] # # N @@ -32,21 +33,23 @@ sleep 1 # # O # -send -- "firejail --noprofile --overlay\r" -expect { - timeout {puts "TESTING ERROR 2\n";exit} - "Child process initialized" +if { $overlay == "overlay" } { + send -- "firejail --noprofile --overlay\r" + expect { + timeout {puts "TESTING ERROR 2\n";exit} + "Child process initialized" + } + sleep 1 + + send -- "ls -l /var/tmp/somefile | wc -l\r" + expect { + timeout {puts "TESTING ERROR 3\n";exit} + "0" + } + after 100 + send -- "exit\r" + sleep 1 } -sleep 1 - -send -- "ls -l /var/tmp/somefile | wc -l\r" -expect { - timeout {puts "TESTING ERROR 3\n";exit} - "0" -} -after 100 -send -- "exit\r" -sleep 1 # # C diff --git a/test/features/1.8.exp b/test/features/1.8.exp index aefe9d8c5..293864671 100755 --- a/test/features/1.8.exp +++ b/test/features/1.8.exp @@ -6,6 +6,7 @@ set timeout 10 spawn $env(SHELL) match_max 100000 +set overlay [lindex $argv 0] # # N @@ -37,27 +38,29 @@ sleep 1 # # O # -send -- "firejail --noprofile --overlay\r" -expect { - timeout {puts "TESTING ERROR 2\n";exit} - "Child process initialized" -} -sleep 1 -send -- "ls /etc/firejail\r" -expect { - timeout {puts "TESTING ERROR 3\n";exit} - "Permission denied" -} -after 100 -send -- "ls ~/.config/firejail\r" -expect { - timeout {puts "TESTING ERROR 3.1\n";exit} - "Permission denied" +if { $overlay == "overlay" } { + send -- "firejail --noprofile --overlay\r" + expect { + timeout {puts "TESTING ERROR 2\n";exit} + "Child process initialized" + } + sleep 1 + send -- "ls /etc/firejail\r" + expect { + timeout {puts "TESTING ERROR 3\n";exit} + "Permission denied" + } + after 100 + send -- "ls ~/.config/firejail\r" + expect { + timeout {puts "TESTING ERROR 3.1\n";exit} + "Permission denied" + } + after 100 + + send -- "exit\r" + sleep 1 } -after 100 - -send -- "exit\r" -sleep 1 # # C diff --git a/test/features/2.1.exp b/test/features/2.1.exp index a2ae321ce..5f188988b 100755 --- a/test/features/2.1.exp +++ b/test/features/2.1.exp @@ -6,6 +6,7 @@ set timeout 10 spawn $env(SHELL) match_max 100000 +set overlay [lindex $argv 0] # # N @@ -46,37 +47,39 @@ sleep 1 # # O # -send -- "firejail --noprofile --hostname=bingo --overlay\r" -expect { - timeout {puts "TESTING ERROR 2\n";exit} - "Child process initialized" -} -sleep 1 - -send -- "hostname\r" -expect { - timeout {puts "TESTING ERROR 3\n";exit} - "bingo" -} -after 100 -send -- "cat /etc/hostname\r" -expect { - timeout {puts "TESTING ERROR 3.0\n";exit} - "bingo" -} -after 100 -send -- "getent hosts bingo\r" -expect { - timeout {puts "TESTING ERROR 3.1\n";exit} - "127.0.0.1" +if { $overlay == "overlay" } { + send -- "firejail --noprofile --hostname=bingo --overlay\r" + expect { + timeout {puts "TESTING ERROR 2\n";exit} + "Child process initialized" + } + sleep 1 + + send -- "hostname\r" + expect { + timeout {puts "TESTING ERROR 3\n";exit} + "bingo" + } + after 100 + send -- "cat /etc/hostname\r" + expect { + timeout {puts "TESTING ERROR 3.0\n";exit} + "bingo" + } + after 100 + send -- "getent hosts bingo\r" + expect { + timeout {puts "TESTING ERROR 3.1\n";exit} + "127.0.0.1" + } + expect { + timeout {puts "TESTING ERROR 3.2\n";exit} + "bingo" + } + after 100 + send -- "exit\r" + sleep 1 } -expect { - timeout {puts "TESTING ERROR 3.2\n";exit} - "bingo" -} -after 100 -send -- "exit\r" -sleep 1 # # C diff --git a/test/features/2.2.exp b/test/features/2.2.exp index c562328fd..186da98fb 100755 --- a/test/features/2.2.exp +++ b/test/features/2.2.exp @@ -6,6 +6,7 @@ set timeout 10 spawn $env(SHELL) match_max 100000 +set overlay [lindex $argv 0] # # N @@ -38,29 +39,31 @@ sleep 1 # # O # -send -- "firejail --noprofile --dns=4.2.2.1 --overlay\r" -expect { - timeout {puts "TESTING ERROR 2\n";exit} - "Child process initialized" +if { $overlay == "overlay" } { + send -- "firejail --noprofile --dns=4.2.2.1 --overlay\r" + expect { + timeout {puts "TESTING ERROR 2\n";exit} + "Child process initialized" + } + sleep 1 + + send -- "dig google.com\r" + expect { + timeout {puts "TESTING ERROR 3\n";exit} + "ANSWER SECTION" + } + expect { + timeout {puts "TESTING ERROR 3.1\n";exit} + "google.com" + } + expect { + timeout {puts "TESTING ERROR 3.3\n";exit} + "SERVER: 4.2.2.1" + } + after 100 + send -- "exit\r" + sleep 1 } -sleep 1 - -send -- "dig google.com\r" -expect { - timeout {puts "TESTING ERROR 3\n";exit} - "ANSWER SECTION" -} -expect { - timeout {puts "TESTING ERROR 3.1\n";exit} - "google.com" -} -expect { - timeout {puts "TESTING ERROR 3.3\n";exit} - "SERVER: 4.2.2.1" -} -after 100 -send -- "exit\r" -sleep 1 # # C diff --git a/test/features/2.3.exp b/test/features/2.3.exp index dd4bdace7..9201696c2 100755 --- a/test/features/2.3.exp +++ b/test/features/2.3.exp @@ -6,11 +6,12 @@ set timeout 10 spawn $env(SHELL) match_max 100000 +set overlay [lindex $argv 0] # # N # -send -- "firejail --noprofile --net=eth0\r" +send -- "firejail --noprofile --net=eth0 --dns=8.8.8.8 --dns=8.8.4.4\r" expect { timeout {puts "TESTING ERROR 0\n";exit} "Child process initialized" @@ -54,7 +55,7 @@ after 100 send -- "exit\r" sleep 3 -send -- "firejail --noprofile --net=eth0 --ip=192.168.1.244\r" +send -- "firejail --noprofile --net=eth0 --ip=192.168.1.244 --dns=8.8.8.8 --dns=8.8.4.4\r" expect { timeout {puts "TESTING ERROR 0\n";exit} "Child process initialized" @@ -101,99 +102,101 @@ sleep 3 # # O # -send -- "firejail --noprofile --net=eth0 --overlay\r" -expect { - timeout {puts "TESTING ERROR 2\n";exit} - "Child process initialized" -} -sleep 1 - -send -- "dig google.com\r" -expect { - timeout {puts "TESTING ERROR 3\n";exit} - "ANSWER SECTION" -} -expect { - timeout {puts "TESTING ERROR 3.1\n";exit} - "google.com" -} -expect { - timeout {puts "TESTING ERROR 3.3\n";exit} - "SERVER" -} -after 100 - -send -- "/sbin/ifconfig\r" -expect { - timeout {puts "TESTING ERROR 3.4\n";exit} - "eth0" -} -expect { - timeout {puts "TESTING ERROR 3.5\n";exit} - "Link" -} -expect { - timeout {puts "TESTING ERROR 3.6\n";exit} - "192.168.1" -} -expect { - timeout {puts "TESTING ERROR 3.7\n";exit} - "UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1" -} -after 100 - -send -- "exit\r" -sleep 3 - -send -- "firejail --noprofile --net=eth0 --ip=192.168.1.244 --overlay\r" -expect { - timeout {puts "TESTING ERROR 2\n";exit} - "Child process initialized" -} -sleep 1 - -send -- "dig google.com\r" -expect { - timeout {puts "TESTING ERROR 3\n";exit} - "ANSWER SECTION" +if { $overlay == "overlay" } { + send -- "firejail --noprofile --net=eth0 --overlay --dns=8.8.8.8 --dns=8.8.4.4\r" + expect { + timeout {puts "TESTING ERROR 2\n";exit} + "Child process initialized" + } + sleep 1 + + send -- "dig google.com\r" + expect { + timeout {puts "TESTING ERROR 3\n";exit} + "ANSWER SECTION" + } + expect { + timeout {puts "TESTING ERROR 3.1\n";exit} + "google.com" + } + expect { + timeout {puts "TESTING ERROR 3.3\n";exit} + "SERVER" + } + after 100 + + send -- "/sbin/ifconfig\r" + expect { + timeout {puts "TESTING ERROR 3.4\n";exit} + "eth0" + } + expect { + timeout {puts "TESTING ERROR 3.5\n";exit} + "Link" + } + expect { + timeout {puts "TESTING ERROR 3.6\n";exit} + "192.168.1" + } + expect { + timeout {puts "TESTING ERROR 3.7\n";exit} + "UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1" + } + after 100 + + send -- "exit\r" + sleep 3 + + send -- "firejail --noprofile --net=eth0 --ip=192.168.1.244 --overlay --dns=8.8.8.8 --dns=8.8.4.4\r" + expect { + timeout {puts "TESTING ERROR 2\n";exit} + "Child process initialized" + } + sleep 1 + + send -- "dig google.com\r" + expect { + timeout {puts "TESTING ERROR 3\n";exit} + "ANSWER SECTION" + } + expect { + timeout {puts "TESTING ERROR 3.1\n";exit} + "google.com" + } + expect { + timeout {puts "TESTING ERROR 3.3\n";exit} + "SERVER" + } + after 100 + + send -- "/sbin/ifconfig\r" + expect { + timeout {puts "TESTING ERROR 3.4\n";exit} + "eth0" + } + expect { + timeout {puts "TESTING ERROR 3.5\n";exit} + "Link" + } + expect { + timeout {puts "TESTING ERROR 3.6\n";exit} + "192.168.1.244" + } + expect { + timeout {puts "TESTING ERROR 3.7\n";exit} + "UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1" + } + after 100 + + send -- "exit\r" + sleep 3 } -expect { - timeout {puts "TESTING ERROR 3.1\n";exit} - "google.com" -} -expect { - timeout {puts "TESTING ERROR 3.3\n";exit} - "SERVER" -} -after 100 - -send -- "/sbin/ifconfig\r" -expect { - timeout {puts "TESTING ERROR 3.4\n";exit} - "eth0" -} -expect { - timeout {puts "TESTING ERROR 3.5\n";exit} - "Link" -} -expect { - timeout {puts "TESTING ERROR 3.6\n";exit} - "192.168.1.244" -} -expect { - timeout {puts "TESTING ERROR 3.7\n";exit} - "UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1" -} -after 100 - -send -- "exit\r" -sleep 3 # # C # -send -- "firejail --noprofile --net=eth0 --chroot=/tmp/chroot\r" +send -- "firejail --noprofile --net=eth0 --chroot=/tmp/chroot --dns=8.8.8.8 --dns=8.8.4.4\r" expect { timeout {puts "TESTING ERROR 4\n";exit} "Child process initialized" @@ -237,7 +240,7 @@ after 100 send -- "exit\r" sleep 3 -send -- "firejail --noprofile --net=eth0 --ip=192.168.1.244 --chroot=/tmp/chroot\r" +send -- "firejail --noprofile --net=eth0 --ip=192.168.1.244 --chroot=/tmp/chroot --dns=8.8.8.8 --dns=8.8.4.4\r" expect { timeout {puts "TESTING ERROR 4\n";exit} "Child process initialized" diff --git a/test/features/2.4.exp b/test/features/2.4.exp index a995322b9..424d4fead 100755 --- a/test/features/2.4.exp +++ b/test/features/2.4.exp @@ -7,6 +7,7 @@ set timeout 10 spawn $env(SHELL) match_max 100000 +set overlay [lindex $argv 0] # # N @@ -89,80 +90,81 @@ sleep 1 # # O # -send -- "firejail --noprofile --net=br0 --overlay\r" -expect { - timeout {puts "TESTING ERROR 2\n";exit} - "Child process initialized" -} -sleep 1 - -send -- "ping -c 3 10.10.20.1\r" -expect { - timeout {puts "TESTING ERROR 3\n";exit} - " packets transmitted, 3 received, 0% packet loss" -} -sleep 1 - - -send -- "/sbin/ifconfig\r" -expect { - timeout {puts "TESTING ERROR 3.4\n";exit} - "eth0" +if { $overlay == "overlay" } { + send -- "firejail --noprofile --net=br0 --overlay\r" + expect { + timeout {puts "TESTING ERROR 2\n";exit} + "Child process initialized" + } + sleep 1 + + send -- "ping -c 3 10.10.20.1\r" + expect { + timeout {puts "TESTING ERROR 3\n";exit} + " packets transmitted, 3 received, 0% packet loss" + } + sleep 1 + + + send -- "/sbin/ifconfig\r" + expect { + timeout {puts "TESTING ERROR 3.4\n";exit} + "eth0" + } + expect { + timeout {puts "TESTING ERROR 3.5\n";exit} + "Link" + } + expect { + timeout {puts "TESTING ERROR 3.6\n";exit} + "10.10.20" + } + expect { + timeout {puts "TESTING ERROR 3.7\n";exit} + "UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1" + } + after 100 + + send -- "exit\r" + sleep 1 + + send -- "firejail --noprofile --net=br0 --ip=10.10.20.4 --overlay\r" + expect { + timeout {puts "TESTING ERROR 2\n";exit} + "Child process initialized" + } + sleep 1 + + send -- "ping -c 3 10.10.20.1\r" + expect { + timeout {puts "TESTING ERROR 3\n";exit} + " packets transmitted, 3 received, 0% packet loss" + } + sleep 1 + + + send -- "/sbin/ifconfig\r" + expect { + timeout {puts "TESTING ERROR 3.4\n";exit} + "eth0" + } + expect { + timeout {puts "TESTING ERROR 3.5\n";exit} + "Link" + } + expect { + timeout {puts "TESTING ERROR 3.6\n";exit} + "10.10.20.4" + } + expect { + timeout {puts "TESTING ERROR 3.7\n";exit} + "UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1" + } + after 100 + + send -- "exit\r" + sleep 1 } -expect { - timeout {puts "TESTING ERROR 3.5\n";exit} - "Link" -} -expect { - timeout {puts "TESTING ERROR 3.6\n";exit} - "10.10.20" -} -expect { - timeout {puts "TESTING ERROR 3.7\n";exit} - "UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1" -} -after 100 - -send -- "exit\r" -sleep 1 - -send -- "firejail --noprofile --net=br0 --ip=10.10.20.4 --overlay\r" -expect { - timeout {puts "TESTING ERROR 2\n";exit} - "Child process initialized" -} -sleep 1 - -send -- "ping -c 3 10.10.20.1\r" -expect { - timeout {puts "TESTING ERROR 3\n";exit} - " packets transmitted, 3 received, 0% packet loss" -} -sleep 1 - - -send -- "/sbin/ifconfig\r" -expect { - timeout {puts "TESTING ERROR 3.4\n";exit} - "eth0" -} -expect { - timeout {puts "TESTING ERROR 3.5\n";exit} - "Link" -} -expect { - timeout {puts "TESTING ERROR 3.6\n";exit} - "10.10.20.4" -} -expect { - timeout {puts "TESTING ERROR 3.7\n";exit} - "UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1" -} -after 100 - -send -- "exit\r" -sleep 1 - # diff --git a/test/features/2.5.exp b/test/features/2.5.exp index 4ba1f5a28..e189f145b 100755 --- a/test/features/2.5.exp +++ b/test/features/2.5.exp @@ -6,6 +6,7 @@ set timeout 10 spawn $env(SHELL) match_max 100000 +set overlay [lindex $argv 0] # # N @@ -41,33 +42,35 @@ sleep 1 # # O # -send -- "firejail --noprofile --overlay --interface=eth0.6\r" -expect { - timeout {puts "TESTING ERROR 2\n";exit} - "Child process initialized" -} -sleep 1 - -send -- "/sbin/ifconfig\r" -expect { - timeout {puts "TESTING ERROR 3.4\n";exit} - "eth0.6" -} -expect { - timeout {puts "TESTING ERROR 3.5n";exit} - "Link" -} -expect { - timeout {puts "TESTING ERROR 3.6\n";exit} - "10.10.206.10" +if { $overlay == "overlay" } { + send -- "firejail --noprofile --overlay --interface=eth0.6\r" + expect { + timeout {puts "TESTING ERROR 2\n";exit} + "Child process initialized" + } + sleep 1 + + send -- "/sbin/ifconfig\r" + expect { + timeout {puts "TESTING ERROR 3.4\n";exit} + "eth0.6" + } + expect { + timeout {puts "TESTING ERROR 3.5n";exit} + "Link" + } + expect { + timeout {puts "TESTING ERROR 3.6\n";exit} + "10.10.206.10" + } + expect { + timeout {puts "TESTING ERROR 3.7\n";exit} + "UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1" + } + after 100 + send -- "exit\r" + sleep 1 } -expect { - timeout {puts "TESTING ERROR 3.7\n";exit} - "UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1" -} -after 100 -send -- "exit\r" -sleep 1 # # C diff --git a/test/features/2.6.exp b/test/features/2.6.exp index dc2381393..77bd8cab0 100755 --- a/test/features/2.6.exp +++ b/test/features/2.6.exp @@ -6,6 +6,7 @@ set timeout 10 spawn $env(SHELL) match_max 100000 +set overlay [lindex $argv 0] # # N @@ -29,21 +30,23 @@ sleep 1 # # O # -send -- "firejail --noprofile --overlay --net=eth0 --defaultgw=192.168.1.10\r" -expect { - timeout {puts "TESTING ERROR 2\n";exit} - "Child process initialized" +if { $overlay == "overlay" } { + send -- "firejail --noprofile --overlay --net=eth0 --defaultgw=192.168.1.10\r" + expect { + timeout {puts "TESTING ERROR 2\n";exit} + "Child process initialized" + } + sleep 1 + + send -- "netstat -rn\r" + expect { + timeout {puts "TESTING ERROR 3\n";exit} + "0.0.0.0 192.168.1.10" + } + after 100 + send -- "exit\r" + sleep 1 } -sleep 1 - -send -- "netstat -rn\r" -expect { - timeout {puts "TESTING ERROR 3\n";exit} - "0.0.0.0 192.168.1.10" -} -after 100 -send -- "exit\r" -sleep 1 # # C diff --git a/test/features/3.1.exp b/test/features/3.1.exp index 6abbf94a5..13ec1b6be 100755 --- a/test/features/3.1.exp +++ b/test/features/3.1.exp @@ -6,6 +6,7 @@ set timeout 10 spawn $env(SHELL) match_max 100000 +set overlay [lindex $argv 0] # # N @@ -31,21 +32,23 @@ sleep 1 # # O # -send -- "firejail --noprofile --overlay --tmpfs=/home/netblue/.config\r" -expect { - timeout {puts "TESTING ERROR 2\n";exit} - "Child process initialized" +if { $overlay == "overlay" } { + send -- "firejail --noprofile --overlay --tmpfs=/home/netblue/.config\r" + expect { + timeout {puts "TESTING ERROR 2\n";exit} + "Child process initialized" + } + sleep 1 + + send -- "ls ~/.config | wc -l\r" + expect { + timeout {puts "TESTING ERROR 3\n";exit} + "0" + } + after 100 + send -- "exit\r" + sleep 1 } -sleep 1 - -send -- "ls ~/.config | wc -l\r" -expect { - timeout {puts "TESTING ERROR 3\n";exit} - "0" -} -after 100 -send -- "exit\r" -sleep 1 # # C diff --git a/test/features/3.2.exp b/test/features/3.2.exp index 44d9b73f3..49d8d27c1 100755 --- a/test/features/3.2.exp +++ b/test/features/3.2.exp @@ -6,6 +6,7 @@ set timeout 10 spawn $env(SHELL) match_max 100000 +set overlay [lindex $argv 0] # # N @@ -31,21 +32,23 @@ sleep 1 # # O # -send -- "firejail --noprofile --overlay --read-only=/home/netblue/.config\r" -expect { - timeout {puts "TESTING ERROR 2\n";exit} - "Child process initialized" +if { $overlay == "overlay" } { + send -- "firejail --noprofile --overlay --read-only=/home/netblue/.config\r" + expect { + timeout {puts "TESTING ERROR 2\n";exit} + "Child process initialized" + } + sleep 1 + + send -- "touch ~/.config/firejail-test-file\r" + expect { + timeout {puts "TESTING ERROR 3\n";exit} + "Read-only file system" + } + after 100 + send -- "exit\r" + sleep 1 } -sleep 1 - -send -- "touch ~/.config/firejail-test-file\r" -expect { - timeout {puts "TESTING ERROR 3\n";exit} - "Read-only file system" -} -after 100 -send -- "exit\r" -sleep 1 # # C diff --git a/test/features/3.3.exp b/test/features/3.3.exp index 432a135d7..a53a4ade5 100755 --- a/test/features/3.3.exp +++ b/test/features/3.3.exp @@ -6,6 +6,7 @@ set timeout 10 spawn $env(SHELL) match_max 100000 +set overlay [lindex $argv 0] # # N @@ -30,21 +31,23 @@ sleep 1 # # O # -send -- "firejail --noprofile --overlay --blacklist=/home/netblue/.config\r" -expect { - timeout {puts "TESTING ERROR 2\n";exit} - "Child process initialized" +if { $overlay == "overlay" } { + send -- "firejail --noprofile --overlay --blacklist=/home/netblue/.config\r" + expect { + timeout {puts "TESTING ERROR 2\n";exit} + "Child process initialized" + } + sleep 1 + + send -- "cd ~/.config\r" + expect { + timeout {puts "TESTING ERROR 3\n";exit} + "Permission denied" + } + after 100 + send -- "exit\r" + sleep 1 } -sleep 1 - -send -- "cd ~/.config\r" -expect { - timeout {puts "TESTING ERROR 3\n";exit} - "Permission denied" -} -after 100 -send -- "exit\r" -sleep 1 # # C diff --git a/test/features/3.4.exp b/test/features/3.4.exp index bc6e10733..da6dd3ff0 100755 --- a/test/features/3.4.exp +++ b/test/features/3.4.exp @@ -6,6 +6,7 @@ set timeout 10 spawn $env(SHELL) match_max 100000 +set overlay [lindex $argv 0] # # N @@ -30,21 +31,23 @@ sleep 1 # # O # -send -- "firejail --noprofile --overlay --whitelist=/home/netblue/.config\r" -expect { - timeout {puts "TESTING ERROR 2\n";exit} - "Child process initialized" -} -sleep 1 - -send -- "ls -al ~/. | wc -l\r" -expect { - timeout {puts "TESTING ERROR 1\n";exit} - "6" +if { $overlay == "overlay" } { + send -- "firejail --noprofile --overlay --whitelist=/home/netblue/.config\r" + expect { + timeout {puts "TESTING ERROR 2\n";exit} + "Child process initialized" + } + sleep 1 + + send -- "ls -al ~/. | wc -l\r" + expect { + timeout {puts "TESTING ERROR 1\n";exit} + "6" + } + after 100 + send -- "exit\r" + sleep 1 } -after 100 -send -- "exit\r" -sleep 1 # # C diff --git a/test/features/test.sh b/test/features/test.sh index e49dfc3f0..b600cec31 100755 --- a/test/features/test.sh +++ b/test/features/test.sh @@ -1,4 +1,21 @@ #!/bin/bash +OVERLAY="overlay" + +while [ $# -gt 0 ]; do # Until you run out of parameters . . . + case "$1" in + --nooverlay) + OVERLAY="" + ;; + --help) + echo "./test.sh [--nooverlay|--help] | grep TESTING" + exit + ;; + esac + shift # Check next set of parameters. +done + + + # # Feature testing @@ -6,57 +23,57 @@ # Default features echo "TESTING: 1.1 disable /boot" -./1.1.exp +./1.1.exp $OVERLAY echo "TESTING: 1.2 new /proc" -./1.2.exp +./1.2.exp $OVERLAY echo "TESTING: 1.4 mask other users" -./1.4.exp +./1.4.exp $OVERLAY echo "TESTING: 1.5 PID namespace" -./1.5.exp +./1.5.exp $OVERLAY echo "TESTING: 1.6 new /var/log" -./1.6.exp +./1.6.exp $OVERLAY echo "TESTING: 1.7 new /var/tmp" -./1.7.exp +./1.7.exp $OVERLAY echo "TESTING: 1.8 disable /etc/firejail and ~/.config/firejail" -./1.8.exp +./1.8.exp $OVERLAY echo "TESTING: 1.10 disable /selinux" -./1.10.exp +./1.10.exp $OVERLAY # networking features echo "TESTING: 2.1 hostname" -./2.1.exp +./2.1.exp $OVERLAY echo "TESTING: 2.2 DNS" -./2.2.exp +./2.2.exp $OVERLAY echo "TESTING: 2.3 mac-vlan" -./2.3.exp +./2.3.exp $OVERLAY echo "TESTING: 2.4 bridge" -./2.4.exp +./2.4.exp $OVERLAY echo "TESTING: 2.5 interface" -./2.5.exp +./2.5.exp $OVERLAY echo "TESTING: 2.6 Default gateway" -./2.6.exp +./2.6.exp $OVERLAY echo "TESTING: 3.1 tmpfs" -./3.1.exp +./3.1.exp $OVERLAY echo "TESTING: 3.2 read-only" -./3.2.exp +./3.2.exp $OVERLAY echo "TESTING: 3.3 blacklist" -./3.3.exp +./3.3.exp $OVERLAY echo "TESTING: 3.4 whitelist" -./3.4.exp +./3.4.exp $OVERLAY diff --git a/test/net_mac.exp b/test/net_mac.exp index 555d86b74..076634730 100755 --- a/test/net_mac.exp +++ b/test/net_mac.exp @@ -32,5 +32,5 @@ expect { } sleep 1 -puts "\n" +puts "\nall done\n" diff --git a/test/option-join-profile.exp b/test/option-join-profile.exp index d208a7f23..8f9c10bf7 100755 --- a/test/option-join-profile.exp +++ b/test/option-join-profile.exp @@ -26,7 +26,7 @@ expect { timeout {puts "TESTING ERROR 3\n";exit} "home" } -sleep 1 +sleep 5 send -- "firejail --list;pwd\r" expect { -- cgit v1.2.3-54-g00ecf