From 8b9844e4f1ee4b26fcbc64f73e4e621f6ff0e63f Mon Sep 17 00:00:00 2001 From: Reiner Herrmann Date: Fri, 21 Sep 2018 18:45:10 +0200 Subject: tests: skip more tests if capabilities/seccomp of host differs --- test/filters/filters.sh | 9 +++++++-- test/filters/noroot.exp | 1 + test/utils/utils.sh | 16 ++++++++++++---- 3 files changed, 20 insertions(+), 6 deletions(-) (limited to 'test') diff --git a/test/filters/filters.sh b/test/filters/filters.sh index d0a34ccc5..72d699415 100755 --- a/test/filters/filters.sh +++ b/test/filters/filters.sh @@ -35,8 +35,13 @@ echo "TESTING: seccomp postexec (test/filters/seccomp-postexec.exp)" echo "TESTING: noroot (test/filters/noroot.exp)" ./noroot.exp -echo "TESTING: capabilities (test/filters/caps.exp)" -./caps.exp + +if grep -q "^CapBnd:\\s0000003fffffffff" /proc/self/status; then + echo "TESTING: capabilities (test/filters/caps.exp)" + ./caps.exp +else + echo "TESTING SKIP: other capabilities than expected (test/filters/caps.exp)" +fi echo "TESTING: capabilities print (test/filters/caps-print.exp)" ./caps-print.exp diff --git a/test/filters/noroot.exp b/test/filters/noroot.exp index ba52a903a..dee0416c1 100755 --- a/test/filters/noroot.exp +++ b/test/filters/noroot.exp @@ -91,6 +91,7 @@ expect { } expect { timeout {puts "TESTING ERROR 14\n";exit} + "2" {puts "seccomp already active\n";} "0" } expect { diff --git a/test/utils/utils.sh b/test/utils/utils.sh index d98e4c2e4..c3d4a0dcf 100755 --- a/test/utils/utils.sh +++ b/test/utils/utils.sh @@ -115,11 +115,19 @@ echo "TESTING: top (test/utils/top.exp)" echo "TESTING: file transfer (test/utils/ls.exp)" ./ls.exp -echo "TESTING: firemon seccomp (test/utils/firemon-seccomp.exp)" -./firemon-seccomp.exp +if grep -q "^Seccomp.*0" /proc/self/status; then + echo "TESTING: firemon seccomp (test/utils/firemon-seccomp.exp)" + ./firemon-seccomp.exp +else + echo "TESTING SKIP: seccomp already active (test/utils/firemon-seccomp.exp)" +fi -echo "TESTING: firemon caps (test/utils/firemon-caps.exp)" -./firemon-caps.exp +if grep -q "^CapBnd:\\s0000003fffffffff" /proc/self/status; then + echo "TESTING: firemon caps (test/utils/firemon-caps.exp)" + ./firemon-caps.exp +else + echo "TESTING SKIP: other capabilities than expected (test/utils/firemon-caps.exp)" +fi echo "TESTING: firemon cpu (test/utils/firemon-cpu.exp)" ./firemon-cpu.exp -- cgit v1.2.3-54-g00ecf