Skip to contentSkip to conversation

tests/filesystem/xfs: use a 300M xfs filesystem image

PATCH In review Paul Moore 2 participants 2 messages Aug 24, 2022 – Aug 25, 2022 SELinux security module

lore
Share & tools
lore

Paul Moore

author maintainer
#0 lore raw

PATCH 1/1 tests/filesystem/xfs: use a 300M xfs filesystem image

Recent versions of mkfs.xfs require at least a 300M image to work properly which unfortunately causes a large number of xfs test failures as the test suite only allocates 16M for a filesystem image. This patch increases the xfs image size to 300M while leaving the existing 16M image size for all other filesystem types.

This was first noticed with xfsprogs v5.19.0 but it is possible earlier versions are also affected.

---
 tests/filesystem/Filesystem.pm |    6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
tests/filesystem/Filesystem.pm +5 -1
index e3cd8ee..bd91a11 100644
@@ -122,10 +122,14 @@ sub attach_dev {
 
 sub make_fs {
     my ( $mk_type, $mk_dev, $mk_dir ) = @_;
+    my $mk_size = 16;
+    if ( $mk_type eq "xfs" ) {
+        $mk_size = 300;
+    }
     print "Create $mk_dir/fstest with dd\n";
     $result =
       system(
-        "dd if=/dev/zero of=$mk_dir/fstest bs=4096 count=4096 2>/dev/null");
+        "dd if=/dev/zero of=$mk_dir/fstest bs=1M count=$mk_size 2>/dev/null");
     if ( $result != 0 ) {
         print "dd failed to create $mk_dir/fstest\n";
     }
#1 lore raw
Quoted 25 lines · Paul Moore

Recent versions of mkfs.xfs require at least a 300M image to work properly which unfortunately causes a large number of xfs test failures as the test suite only allocates 16M for a filesystem image. This patch increases the xfs image size to 300M while leaving the existing 16M image size for all other filesystem types.

This was first noticed with xfsprogs v5.19.0 but it is possible earlier versions are also affected.

---
 tests/filesystem/Filesystem.pm |    6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
tests/filesystem/Filesystem.pm +2 -0
index e3cd8ee..bd91a11 100644
@@ -122,10 +122,14 @@ sub attach_dev {
 
 sub make_fs {
     my ( $mk_type, $mk_dev, $mk_dir ) = @_;
+    my $mk_size = 16;
+    if ( $mk_type eq "xfs" ) {

tests/filesystem/Filesystem.pm sub attach_dev { · line 135

Quoted 10 lines
tests/filesystem/Filesystem.pm +3 -1
+        $mk_size = 300;
+    }
     print "Create $mk_dir/fstest with dd\n";
     $result =
       system(
-        "dd if=/dev/zero of=$mk_dir/fstest bs=4096 count=4096 2>/dev/null");
+        "dd if=/dev/zero of=$mk_dir/fstest bs=1M count=$mk_size 2>/dev/null");
     if ( $result != 0 ) {
         print "dd failed to create $mk_dir/fstest\n";
     }

Thanks! I applied this with a minor edit in the patch description (added upstream xfsprogs commit reference):

https://github.com/SELinuxProject/selinux-testsuite/commit/c592d7f49e5e8ca907d90cb1d6f54bb0d410d442

--
Ondrej Mosnacek
Senior Software Engineer, Linux Security - SELinux kernel Red Hat, Inc.