Skip to contentSkip to conversation

selinux-testsuite: apply perltidy to infiniband test scripts

PATCH In review Stephen Smalley 2 participants 4 messages Sep 18, 2019 – Sep 19, 2019 SELinux security module

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 selinux-testsuite: apply perltidy to infiniband test scripts

The infiniband test scripts weren't compliant with perltidy so make check-syntax was failing. Fix it.

---
 tests/infiniband_endport/test | 2 +-
 tests/infiniband_pkey/test    | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
tests/infiniband_endport/test +1 -1
index 0021e0d69af4..f071fbc18cf8 100755
@@ -40,7 +40,7 @@ ok( $result, 0 );
 
 foreach (@denied_device_port) {
     @dev_port_pair = split( / /, $_ );
-    $result = system
+    $result        = system
 "runcon -t test_ibendport_manage_subnet_t smpquery PKeyTable -C $dev_port_pair[0] -P $dev_port_pair[1] -D 1 2>/dev/null";
 
     if ( $result >> 8 eq 0 ) {
tests/infiniband_pkey/test +1 -1
index 3ee4d13c8ffe..382c25913ca0 100755
@@ -32,7 +32,7 @@ close($f);
 
 # The gid sysfs shows a fully expanded ipv6 address, just take the
 # top half.
-@tmp = unpack( '(a20)*', $gid );
+@tmp           = unpack( '(a20)*', $gid );
 $subnet_prefix = $tmp[0] . ":";
 
 @labeled_pkeys = split( /,/, $conf{SELINUX_INFINIBAND_TEST_LABELED_PKEYS} );
Signature · 1 line
2.21.0
#1 lore raw
Quoted 2 lines · Stephen Smalley

The infiniband test scripts weren't compliant with perltidy so make check-syntax was failing. Fix it.

Unfortunately there is some disconnect between the perltidy version available in the Travis CI environment and the newer versions available in more recent distributions... See this commit in the audit-testsuite [1] - the decision is to follow the Travis format as the common "standard" (there is really no better way until we patch the Travis script to install newer peritidy somehow...).

Just in case you don't know, anyone can easily enable Travis CI on their GitHub fork - just go to https://travis-ci.org/, log in with your GitHub account, and switch the corresponding project to enabled. That way you can just push a branch to your fork, it will be tested and you will get a report to (just) your mailbox. I.e. you can do the canonical syntax check without opening a PR against the upstream repo.

[1] https://github.com/linux-audit/audit-testsuite/commit/7ff3e434bc243e667ebb26a22b64176e662fddec

Quoted 36 lines
---
 tests/infiniband_endport/test | 2 +-
 tests/infiniband_pkey/test    | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
tests/infiniband_endport/test +1 -1
index 0021e0d69af4..f071fbc18cf8 100755
@@ -40,7 +40,7 @@ ok( $result, 0 );
 
 foreach (@denied_device_port) {
     @dev_port_pair = split( / /, $_ );
-    $result = system
+    $result        = system
 "runcon -t test_ibendport_manage_subnet_t smpquery PKeyTable -C $dev_port_pair[0] -P $dev_port_pair[1] -D 1 2>/dev/null";
 
     if ( $result >> 8 eq 0 ) {
tests/infiniband_pkey/test +1 -2
index 3ee4d13c8ffe..382c25913ca0 100755
@@ -32,7 +32,7 @@ close($f);
 
 # The gid sysfs shows a fully expanded ipv6 address, just take the
 # top half.
-@tmp = unpack( '(a20)*', $gid );
+@tmp           = unpack( '(a20)*', $gid );
 $subnet_prefix = $tmp[0] . ":";
 
 @labeled_pkeys = split( /,/, $conf{SELINUX_INFINIBAND_TEST_LABELED_PKEYS} );
--

2.21.0

Signature · 3 lines
Ondrej Mosnacek <omosnace at redhat dot com>
Software Engineer, Security Technologies
Red Hat, Inc.
#2 lore raw
Quoted 10 lines · Ondrej Mosnacek
Quoted 2 lines · Stephen Smalley

The infiniband test scripts weren't compliant with perltidy so make check-syntax was failing. Fix it.

Unfortunately there is some disconnect between the perltidy version available in the Travis CI environment and the newer versions available in more recent distributions... See this commit in the audit-testsuite [1] - the decision is to follow the Travis format as the common "standard" (there is really no better way until we patch the Travis script to install newer peritidy somehow...).

Ok, I reverted this change. Wondering if this could be controlled through any of the perltidy options, or fixed by using a newer image e.g. bionic.

Quoted 46 lines

Just in case you don't know, anyone can easily enable Travis CI on their GitHub fork - just go to https://travis-ci.org/, log in with your GitHub account, and switch the corresponding project to enabled. That way you can just push a branch to your fork, it will be tested and you will get a report to (just) your mailbox. I.e. you can do the canonical syntax check without opening a PR against the upstream repo.

[1] https://github.com/linux-audit/audit-testsuite/commit/7ff3e434bc243e667ebb26a22b64176e662fddec

Quoted 36 lines
---
  tests/infiniband_endport/test | 2 +-
  tests/infiniband_pkey/test    | 2 +-
  2 files changed, 2 insertions(+), 2 deletions(-)
tests/infiniband_endport/test +1 -1
index 0021e0d69af4..f071fbc18cf8 100755
@@ -40,7 +40,7 @@ ok( $result, 0 );
 
  foreach (@denied_device_port) {
      @dev_port_pair = split( / /, $_ );
-    $result = system
+    $result        = system
  "runcon -t test_ibendport_manage_subnet_t smpquery PKeyTable -C $dev_port_pair[0] -P $dev_port_pair[1] -D 1 2>/dev/null";
 
      if ( $result >> 8 eq 0 ) {
tests/infiniband_pkey/test +1 -2
index 3ee4d13c8ffe..382c25913ca0 100755
@@ -32,7 +32,7 @@ close($f);
 
  # The gid sysfs shows a fully expanded ipv6 address, just take the
  # top half.
-@tmp = unpack( '(a20)*', $gid );
+@tmp           = unpack( '(a20)*', $gid );
  $subnet_prefix = $tmp[0] . ":";
 
  @labeled_pkeys = split( /,/, $conf{SELINUX_INFINIBAND_TEST_LABELED_PKEYS} );
--

2.21.0

#3 lore raw
Quoted 12 lines · Stephen Smalley
Quoted 10 lines · Ondrej Mosnacek
Quoted 2 lines · Stephen Smalley

The infiniband test scripts weren't compliant with perltidy so make check-syntax was failing. Fix it.

Unfortunately there is some disconnect between the perltidy version available in the Travis CI environment and the newer versions available in more recent distributions... See this commit in the audit-testsuite [1] - the decision is to follow the Travis format as the common "standard" (there is really no better way until we patch the Travis script to install newer peritidy somehow...).

Quoted 3 lines

Ok, I reverted this change. Wondering if this could be controlled through any of the perltidy options, or fixed by using a newer image e.g. bionic.

FWIW, I just checked and bionic is still not new enough:

Passed with old perltidy syntax:
https://travis-ci.org/WOnder93/selinux-testsuite/jobs/586994152
Failed with new perltidy syntax:
https://travis-ci.org/WOnder93/selinux-testsuite/builds/586996059

Quoted 42 lines
Quoted 42 lines

Just in case you don't know, anyone can easily enable Travis CI on their GitHub fork - just go to https://travis-ci.org/, log in with your GitHub account, and switch the corresponding project to enabled. That way you can just push a branch to your fork, it will be tested and you will get a report to (just) your mailbox. I.e. you can do the canonical syntax check without opening a PR against the upstream repo.

[1] https://github.com/linux-audit/audit-testsuite/commit/7ff3e434bc243e667ebb26a22b64176e662fddec

Quoted 32 lines
---
  tests/infiniband_endport/test | 2 +-
  tests/infiniband_pkey/test    | 2 +-
  2 files changed, 2 insertions(+), 2 deletions(-)
tests/infiniband_endport/test +1 -1
index 0021e0d69af4..f071fbc18cf8 100755
@@ -40,7 +40,7 @@ ok( $result, 0 );
 
  foreach (@denied_device_port) {
      @dev_port_pair = split( / /, $_ );
-    $result = system
+    $result        = system
  "runcon -t test_ibendport_manage_subnet_t smpquery PKeyTable -C $dev_port_pair[0] -P $dev_port_pair[1] -D 1 2>/dev/null";
 
      if ( $result >> 8 eq 0 ) {
tests/infiniband_pkey/test +1 -1
index 3ee4d13c8ffe..382c25913ca0 100755
@@ -32,7 +32,7 @@ close($f);
 
  # The gid sysfs shows a fully expanded ipv6 address, just take the
  # top half.
-@tmp = unpack( '(a20)*', $gid );
+@tmp           = unpack( '(a20)*', $gid );
  $subnet_prefix = $tmp[0] . ":";
 
Quoted 6 lines
Quoted 5 lines
Quoted 4 lines
tests/infiniband_pkey/test +0 -1
  @labeled_pkeys = split( /,/, $conf{SELINUX_INFINIBAND_TEST_LABELED_PKEYS} );
--

2.21.0

--
Ondrej Mosnacek <omosnace at redhat dot com>
Software Engineer, Security Technologies
Red Hat, Inc.