X-Git-Url: http://git.ieval.ro/?a=blobdiff_plain;f=t%2FLinux-Seccomp.t;h=ee1737f939dfc0c28de96c33933e6caf6834f081;hb=f228e548b6ed6079886c786bc6cb85076413c1f4;hp=954b2cce2926b06598e0219b2e60d31a6ab810a8;hpb=16ca5f5de629d1df10da2103836e8e0375613c27;p=linux-seccomp.git diff --git a/t/Linux-Seccomp.t b/t/Linux-Seccomp.t index 954b2cc..ee1737f 100644 --- a/t/Linux-Seccomp.t +++ b/t/Linux-Seccomp.t @@ -2,7 +2,8 @@ use strict; use warnings; -use Test::More tests => 3; +use Errno qw/EINVAL/; +use Test::More tests => 4; BEGIN { use_ok('Linux::Seccomp', ':all') }; @@ -123,12 +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; + +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'; +}