diff mbox series

[1/1] selinux-testsuite: Add btrfs support for filesystem tests

Message ID 20201013145456.77253-2-richard_c_haines@btinternet.com (mailing list archive)
State Changes Requested
Delegated to: Ondrej Mosnáček
Headers show
Series selinux-testsuite: Add btrfs support for filesystem tests | expand

Commit Message

Richard Haines Oct. 13, 2020, 2:54 p.m. UTC
This allows btrfs filesystems to be created to support the
filesystem mount(2) type calls and the fs_filesystem fsmount(2)
type calls.

Signed-off-by: Richard Haines <richard_c_haines@btinternet.com>
---
 tests/filesystem/Filesystem.pm | 10 +++++++++-
 tests/filesystem/test          |  6 ++++++
 tests/fs_filesystem/test       |  6 ++++++
 3 files changed, 21 insertions(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/tests/filesystem/Filesystem.pm b/tests/filesystem/Filesystem.pm
index 2365ce8..3108eec 100644
--- a/tests/filesystem/Filesystem.pm
+++ b/tests/filesystem/Filesystem.pm
@@ -122,10 +122,18 @@  sub attach_dev {
 
 sub make_fs {
     my ( $mk_type, $mk_dev, $mk_dir ) = @_;
+
+    # BTRFS requires a larger minimum size that takes >2x longer to generate
+    if ( $mk_type eq "btrfs" ) {
+        $count = "28000";
+    }
+    else {
+        $count = "4096";
+    }
     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=4096 count=$count 2>/dev/null");
     if ( $result != 0 ) {
         print "dd failed to create $mk_dir/fstest\n";
     }
diff --git a/tests/filesystem/test b/tests/filesystem/test
index 7d4654d..af59690 100755
--- a/tests/filesystem/test
+++ b/tests/filesystem/test
@@ -72,6 +72,12 @@  BEGIN {
         $test_count   = 55;
         $quota_checks = 0;
     }
+
+    # BTRFS uses internal quotas requiring no security hooks
+    elsif ( $fs_type eq "btrfs" ) {
+        $test_count   = 55;
+        $quota_checks = 0;
+    }
     else {
         $test_count = 69;
     }
diff --git a/tests/fs_filesystem/test b/tests/fs_filesystem/test
index 5dedf83..6bdcc50 100755
--- a/tests/fs_filesystem/test
+++ b/tests/fs_filesystem/test
@@ -75,6 +75,12 @@  BEGIN {
         $test_count   = 54;
         $quota_checks = 0;
     }
+
+    # BTRFS uses internal quotas requiring no security hooks
+    elsif ( $fs_type eq "btrfs" ) {
+        $test_count   = 54;
+        $quota_checks = 0;
+    }
     else {
         $test_count = 68;
     }