Re: [selinux-testsuite PATCH 1/4] tests/inet_socket: check 'ip xfrm policy ctx' support

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 






----- Original Message -----
> From: "Paul Moore" <paul@xxxxxxxxxxxxxx>
> To: "Jan Stancek" <jstancek@xxxxxxxxxx>
> Cc: selinux@xxxxxxxxxxxxx, "Stephen Smalley" <sds@xxxxxxxxxxxxx>
> Sent: Friday, 6 November, 2015 6:58:38 PM
> Subject: Re: [selinux-testsuite PATCH 1/4] tests/inet_socket: check 'ip xfrm policy ctx' support
> 
> On Fri, Nov 6, 2015 at 8:07 AM, Jan Stancek <jstancek@xxxxxxxxxx> wrote:
> > Early RHEL6 distros like RHEL6.0 do not support "ctx" parameter,
> > which is causing test to fail:
> >   Error: argument "ctx" is wrong: unknown
> >
> > Signed-off-by: Jan Stancek <jstancek@xxxxxxxxxx>
> > Cc: Paul Moore <paul@xxxxxxxxxxxxxx>
> > Cc: Stephen Smalley <sds@xxxxxxxxxxxxx>
> > ---
> >  tests/inet_socket/test | 31 +++++++++++++++++++------------
> >  1 file changed, 19 insertions(+), 12 deletions(-)
> >
> > diff --git a/tests/inet_socket/test b/tests/inet_socket/test
> > index 4deca746208c..4f6ee51cec5c 100755
> > --- a/tests/inet_socket/test
> > +++ b/tests/inet_socket/test
> > @@ -1,7 +1,14 @@
> >  #!/usr/bin/perl
> > -
> > -use Test;
> > -BEGIN { plan tests => 20}
> > +use Test::More;
> > +
> > +BEGIN {
> > +    # check if ip xfrm supports ctx parameter
> > +    if (system("ip xfrm policy help 2>&1 | grep ctx") != 0) {
> > +        plan skip_all => "ctx not supported in ip xfrm policy";
> > +    } else {
> > +        plan tests => 20;
> > +    }
> > +}
> >
> >  $basedir = $0;  $basedir =~ s|(.*)/[^/]*|$1|;
> >
> > @@ -17,7 +24,7 @@ sleep 1; # Give it a moment to initialize.
> >
> >  # Verify that authorized client can communicate with the server.
> >  $result = system "runcon -t test_inet_client_t $basedir/client stream
> >  65535";
> > -ok($result, 0);
> > +ok($result eq 0);
> 
> My understanding of Perl is *very* basic - why this change (and the
> similar ones in this patch)?

I wanted to skip the test, but skip_all is supported only in Test::More
framework. And arguments in ok() have slightly different meaning.

In "Test" args are "ok($have, $expect);" [1]
In "Test::More" args are "ok($got eq $expected, $test_name);" [2]

This change adapts parameters to "Test::More" style.

[1] http://perldoc.perl.org/Test.html
[2] http://perldoc.perl.org/Test/More.html

> 
> --
> paul moore
> www.paul-moore.com
> 
_______________________________________________
Selinux mailing list
Selinux@xxxxxxxxxxxxx
To unsubscribe, send email to Selinux-leave@xxxxxxxxxxxxx.
To get help, send an email containing "help" to Selinux-request@xxxxxxxxxxxxx.



[Index of Archives]     [Selinux Refpolicy]     [Linux SGX]     [Fedora Users]     [Fedora Desktop]     [Yosemite Photos]     [Yosemite Camping]     [Yosemite Campsites]     [KDE Users]     [Gnome Users]

  Powered by Linux