From: Marius Gavrilescu Date: Fri, 25 Nov 2016 16:05:55 +0000 (+0000) Subject: Skip functionality test if seccomp_load returns -EINVAL X-Git-Tag: 0.002001~1 X-Git-Url: http://git.ieval.ro/?a=commitdiff_plain;h=f228e548b6ed6079886c786bc6cb85076413c1f4;p=linux-seccomp.git Skip functionality test if seccomp_load returns -EINVAL --- diff --git a/t/Linux-Seccomp.t b/t/Linux-Seccomp.t index b42df87..ee1737f 100644 --- a/t/Linux-Seccomp.t +++ b/t/Linux-Seccomp.t @@ -2,6 +2,7 @@ use strict; use warnings; +use Errno qw/EINVAL/; use Test::More tests => 4; BEGIN { use_ok('Linux::Seccomp', ':all') }; @@ -123,14 +124,19 @@ foreach my $constname (qw( ok( $fail == 0 , 'Constants' ); +is_deeply version, [2, 3, 1], 'library version is 2.3.1'; + my $got_sigsys = 0; $SIG{SYS} = sub { $got_sigsys = 1 }; my $ctx = Linux::Seccomp->new(SCMP_ACT_ALLOW); $ctx->rule_add(SCMP_ACT_TRAP, syscall_resolve_name('mkdir')); -$ctx->load; +my $result = $ctx->load; -is_deeply version, [2, 3, 1], 'library version is 2.3.1'; +SKIP: { + skip 'loading filter fails with EINVAL -- does your kernel have CONFIG_SECCOMP_FILTER=y?' + if $result == -EINVAL; -mkdir 'testdir'; -ok $got_sigsys, 'filter with SCMP_ACT_TRAP on mkdir() works'; + mkdir 'testdir'; + ok $got_sigsys, 'filter with SCMP_ACT_TRAP on mkdir() works'; +}