diff mbox series

[testsuite] tests/capable_sys: skip test_rawio on BTRFS

Message ID 20210804130842.743651-1-omosnace@redhat.com (mailing list archive)
State Accepted
Delegated to: Ondrej Mosnáček
Headers show
Series [testsuite] tests/capable_sys: skip test_rawio on BTRFS | expand

Commit Message

Ondrej Mosnacek Aug. 4, 2021, 1:08 p.m. UTC
BTRFS doesn't support the FIBMAP ioctl, which is used to test
CAP_SYS_RAWIO. It is already disabled for NFS, so disable that test also
on BTRFS.

Fedora 35 cloud images already have BTRFS volumes instead of ext4 and
this patch is needed to make the testsuite pass there.

Signed-off-by: Ondrej Mosnacek <omosnace@redhat.com>
---
 tests/capable_sys/test | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

Comments

Ondrej Mosnacek Aug. 19, 2021, 9:09 a.m. UTC | #1
On Wed, Aug 4, 2021 at 3:08 PM Ondrej Mosnacek <omosnace@redhat.com> wrote:
> BTRFS doesn't support the FIBMAP ioctl, which is used to test
> CAP_SYS_RAWIO. It is already disabled for NFS, so disable that test also
> on BTRFS.
>
> Fedora 35 cloud images already have BTRFS volumes instead of ext4 and
> this patch is needed to make the testsuite pass there.
>
> Signed-off-by: Ondrej Mosnacek <omosnace@redhat.com>
> ---
>  tests/capable_sys/test | 7 ++++---
>  1 file changed, 4 insertions(+), 3 deletions(-)
>
> diff --git a/tests/capable_sys/test b/tests/capable_sys/test
> index cd50ebc..a72616d 100755
> --- a/tests/capable_sys/test
> +++ b/tests/capable_sys/test
> @@ -9,10 +9,11 @@ BEGIN {
>      $basedir = $0;
>      $basedir =~ s|(.*)/[^/]*|$1|;
>
> -    $isnfs = `stat -f --print %T $basedir`;
> +    $fs          = `stat -f --print %T $basedir`;
> +    $test_fibmap = $fs ne "btrfs" and $fs ne "nfs";
>
>      $test_count = 7;
> -    if ( $isnfs ne "nfs" ) {
> +    if ($test_fibmap) {
>          $test_count += 1;
>      }
>
> @@ -26,7 +27,7 @@ system "rm -f $basedir/temp_file 2>&1";
>  # Tests for the good domain.
>  #
>
> -if ( $isnfs ne "nfs" ) {
> +if ($test_fibmap) {
>
>      # CAP_SYS_RAWIO
>      system "touch $basedir/temp_file 2>&1";
> --
> 2.31.1
>

This patch is now merged with minor modification - the logical
expression in tests/capable_sys had to be parenthesized because of
Perl bogosity (https://www.perlmonks.org/?node_id=734436).

https://github.com/SELinuxProject/selinux-testsuite/commit/4ed5d11312d673203d93dafbcdad441c3afc36f9
diff mbox series

Patch

diff --git a/tests/capable_sys/test b/tests/capable_sys/test
index cd50ebc..a72616d 100755
--- a/tests/capable_sys/test
+++ b/tests/capable_sys/test
@@ -9,10 +9,11 @@  BEGIN {
     $basedir = $0;
     $basedir =~ s|(.*)/[^/]*|$1|;
 
-    $isnfs = `stat -f --print %T $basedir`;
+    $fs          = `stat -f --print %T $basedir`;
+    $test_fibmap = $fs ne "btrfs" and $fs ne "nfs";
 
     $test_count = 7;
-    if ( $isnfs ne "nfs" ) {
+    if ($test_fibmap) {
         $test_count += 1;
     }
 
@@ -26,7 +27,7 @@  system "rm -f $basedir/temp_file 2>&1";
 # Tests for the good domain.
 #
 
-if ( $isnfs ne "nfs" ) {
+if ($test_fibmap) {
 
     # CAP_SYS_RAWIO
     system "touch $basedir/temp_file 2>&1";