]> git.apps.os.sepia.ceph.com Git - xfstests-dev.git/commitdiff
common/rc: introduce minimal fs size check
authorNaohiro Aota <naohiro.aota@wdc.com>
Wed, 11 Aug 2021 15:12:25 +0000 (00:12 +0900)
committerEryu Guan <guaneryu@gmail.com>
Sun, 15 Aug 2021 15:25:08 +0000 (23:25 +0800)
_scratch_mkfs_sized() create a file system with specified size
limit. It can, however, too small for certain kind of devices. For
example, zoned btrfs requires at least 5 zones to make a file system.

This commit introduces MIN_FSSIZE, which specify the minimum size of the
possible file system. We can set this variable e.g. $ZONE_SIZE *
$MIN_ZONE_COUNT.

Signed-off-by: Naohiro Aota <naohiro.aota@wdc.com>
Reviewed-by: Eryu Guan <guaneryu@gmail.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
README
common/rc

diff --git a/README b/README
index 18f7a6bc3ff0cf9adaed7700df8a58592df898bb..b9877b7d8b1bdfff7fbaaa9ce7e3b6fb64dea97a 100644 (file)
--- a/README
+++ b/README
@@ -117,6 +117,10 @@ Preparing system for tests:
                name of a file to compress; and it must accept '-d -f -k' and
                the name of a file to decompress.  In other words, it must
                emulate gzip.
+            - Set MIN_FSSIZE to specify the minimal size (bytes) of a
+               filesystem we can create. Setting this parameter will
+               skip the tests creating a filesystem less than
+               MIN_FSSIZE.
 
         - or add a case to the switch in common/config assigning
           these variables based on the hostname of your test
index e04d9365d9027752571a78c57940fdfe4146e46f..4cb062e2fd3f254dc9b18cc121edbce618e298da 100644 (file)
--- a/common/rc
+++ b/common/rc
@@ -956,6 +956,16 @@ _available_memory_bytes()
        fi
 }
 
+_check_minimal_fs_size()
+{
+       local fssize=$1
+
+       if [ -n "$MIN_FSSIZE" ]; then
+               [ $MIN_FSSIZE -gt "$fssize" ] &&
+                       _notrun "specified filesystem size is too small"
+       fi
+}
+
 # Create fs of certain size on scratch device
 # _scratch_mkfs_sized <size in bytes> [optional blocksize]
 _scratch_mkfs_sized()
@@ -989,6 +999,8 @@ _scratch_mkfs_sized()
 
        local blocks=`expr $fssize / $blocksize`
 
+       _check_minimal_fs_size $fssize
+
        if [ -b "$SCRATCH_DEV" ]; then
                local devsize=`blockdev --getsize64 $SCRATCH_DEV`
                [ "$fssize" -gt "$devsize" ] && _notrun "Scratch device too small"