tests/capable_sys: skip test_rawio on BTRFS
PATCH 1/1 tests/capable_sys: skip test_rawio on BTRFS
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.
--- tests/capable_sys/test | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
tests/capable_sys/test +4 -3
@@ -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";
Signature · 1 line
2.31.1
Quoted 40 lines · Ondrej Mosnacek
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 <[email protected]>--- tests/capable_sys/test | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)tests/capable_sys/test +4
-4@@ -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"; --
Quoted 2 lines
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
Signature · 3 lines
Ondrej Mosnacek Software Engineer, Linux Security - SELinux kernel Red Hat, Inc.