From f8ad9c20bbbc5018927598c23532e33851b74d60 Mon Sep 17 00:00:00 2001 From: netblue30 Date: Thu, 5 May 2016 18:16:03 -0400 Subject: test fixes --- Makefile.in | 5 +++-- test/apps-x11/apps-x11.sh | 17 +++++++++++++++ test/filters/seccomp-dualfilter.exp | 21 +++++++++++++----- test/fs/fs.sh | 1 - test/fs/private-whitelist.exp | 10 +++++---- test/fs/private.exp | 43 +------------------------------------ 6 files changed, 43 insertions(+), 54 deletions(-) diff --git a/Makefile.in b/Makefile.in index 9a6044fcb..fdf247255 100644 --- a/Makefile.in +++ b/Makefile.in @@ -47,6 +47,7 @@ clean: done rm -f firejail.1 firejail.1.gz firemon.1 firemon.1.gz firecfg.1 firecfg.gz firejail-profile.5 firejail-profile.5.gz firejail-login.5 firejail-login.5.gz firejail-config.5 firejail-config.5.gz firejail*.rpm rm -f test/utils/index.html* + rm -f test/utils/wget-log rm -f test/utils/lstesting cd test/compile; ./compile.sh --clean; cd ../.. cd test/dist-compile; ./compile.sh --clean; cd ../.. @@ -303,10 +304,10 @@ test-filters: cd test/filters; ./filters.sh | grep TESTING test-network: - echo "Please read test/netwok/README file and run the test manually" + echo "Please read test/network/README file and run the test manually" test-fs: cd test/fs; ./fs.sh | grep TESTING -test: test-profiles test-fs test-utils test-environment test-apps test-apps-x11 test-filters test-network +test: test-profiles test-fs test-utils test-environment test-apps test-apps-x11 test-filters echo "TEST COMPLETE" diff --git a/test/apps-x11/apps-x11.sh b/test/apps-x11/apps-x11.sh index b01c37d0f..a8556ab8f 100755 --- a/test/apps-x11/apps-x11.sh +++ b/test/apps-x11/apps-x11.sh @@ -6,6 +6,23 @@ export MALLOC_CHECK_=3 export MALLOC_PERTURB_=$(($RANDOM % 255 + 1)) +# check xpra/xephyr +which xpra +if [ "$?" -eq 0 ]; +then + echo "xpra found" +else + echo "xpra not found" + which xephyr + if [ "$?" -eq 0 ]; + then + echo "xephyr found" + else + echo "TESTING SKIP: xpra and/or xephyr not found" + exit + fi +fi + which xterm if [ "$?" -eq 0 ]; then diff --git a/test/filters/seccomp-dualfilter.exp b/test/filters/seccomp-dualfilter.exp index 7efc117da..c75063672 100755 --- a/test/filters/seccomp-dualfilter.exp +++ b/test/filters/seccomp-dualfilter.exp @@ -3,10 +3,23 @@ # Copyright (C) 2014-2016 Firejail Authors # License GPL v2 -set timeout 10 +set timeout 1 spawn $env(SHELL) match_max 100000 +send -- "./syscall_test\r" +expect { + timeout {puts "TESTING SKIP: 64-bit support missing\n";exit} + "Usage" +} + +send -- "./syscall_test32\r" +expect { + timeout {puts "TESTING SKIP: 32-bit support missing\n";exit} + "Usage" +} + +set timeout 10 send -- "firejail ./syscall_test mount\r" expect { timeout {puts "TESTING ERROR 0\n";exit} @@ -18,7 +31,7 @@ expect { } expect { timeout {puts "TESTING ERROR 2\n";exit} - "after mount" {puts "TESTING ERROR 2.1\n";exit} + "after mount" {puts "TESTING ERROR 3\n";exit} "Parent is shutting down" } sleep 1 @@ -26,8 +39,6 @@ sleep 1 send -- "firejail ./syscall_test32 mount\r" expect { timeout {puts "TESTING ERROR 4\n";exit} - "No such file or directory" {puts "\nTESTING SKIP 3: can't execute 32 bit binary\n"; exit} - "Parent is shutting down, bye" {puts "\nTESTING SKIP 3: can't execute 32 bit binary\n"; exit} "Child process initialized" } expect { @@ -36,7 +47,7 @@ expect { } expect { timeout {puts "TESTING ERROR 6\n";exit} - "after mount" {puts "TESTING ERROR 6.1\n";exit} + "after mount" {puts "TESTING ERROR 7\n";exit} "Parent is shutting down" } diff --git a/test/fs/fs.sh b/test/fs/fs.sh index 425af45a6..0fcffcb8e 100755 --- a/test/fs/fs.sh +++ b/test/fs/fs.sh @@ -31,7 +31,6 @@ echo "TESTING: whitelist empty (test/fs/whitelist-empty.exp)" ./whitelist-empty.exp echo "TESTING: private whitelist (test/fs/private-whitelist.exp)" -echo "TESTING: (failing on OpenSUSE)" ./private-whitelist.exp echo "TESTING: invalid filename (test/fs/invalid_filename.exp)" diff --git a/test/fs/private-whitelist.exp b/test/fs/private-whitelist.exp index a3d60369a..4dadeacb1 100755 --- a/test/fs/private-whitelist.exp +++ b/test/fs/private-whitelist.exp @@ -12,26 +12,28 @@ expect { timeout {puts "TESTING ERROR 1\n";exit} "Child process initialized" } -sleep 1 +after 100 send -- "ls -al /tmp\r" expect { timeout {puts "TESTING ERROR 2\n";exit} ".X11-unix" } -sleep 1 +after 100 send -- "ls -a /tmp | wc -l\r" expect { timeout {puts "TESTING ERROR 3\n";exit} "3" } -sleep 1 +after 100 send -- "ls -a ~ | wc -l\r" expect { timeout {puts "TESTING ERROR 4\n";exit} - "5" + "3" {puts "3\n"} + "4" {puts "4\n"} + "5" {puts "5\n"} } sleep 1 diff --git a/test/fs/private.exp b/test/fs/private.exp index 01f04d3cb..7eee0c82b 100755 --- a/test/fs/private.exp +++ b/test/fs/private.exp @@ -38,49 +38,8 @@ expect { } expect { timeout {puts "TESTING ERROR 3\n";exit} - [lindex $argv 0] + done } -send -- "ls -al; echo done\r" -expect { - timeout { - # OpenSUSE doesn't use .Xauthority from user done directory - send -- "env | grep XAUTHORITY\r" - - expect { - timeout {puts "TESTING ERROR 4\n";exit} - "/run/lightdm/netblue/xauthority" - } - } - ".Xauthority" -} -expect { - timeout {puts "TESTING ERROR 5\n";exit} - [lindex $argv 0] -} - - -# testing private only -send -- "bash\r" -sleep 1 -# owner /done/netblue -send -- "ls -l /done;echo done\r" -expect { - timeout {puts "TESTING ERROR 6\n";exit} - [lindex $argv 0] -} -expect { - timeout {puts "TESTING ERROR 7\n";exit} - [lindex $argv 0] -} -expect { - timeout {puts "TESTING ERROR 8\n";exit} - [lindex $argv 0] -} -expect { - timeout {puts "TESTING ERROR 9\n";exit} - "done" -} -sleep 1 # owner /tmp send -- "stat -c %U%a /tmp;echo done\r" -- cgit v1.2.3-54-g00ecf