]> git.apps.os.sepia.ceph.com Git - xfstests-dev.git/commitdiff
xfstests: helper to detect fs free space
authorEric Sandeen <sandeen@sandeen.net>
Tue, 2 Feb 2010 23:23:58 +0000 (17:23 -0600)
committerEric Sandeen <sandeen@sandeen.net>
Tue, 2 Feb 2010 23:23:58 +0000 (17:23 -0600)
Make a common helper to skip a test if there's not enough
free space on the target fs.

Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
Reviewed-by: Christoph Hellwig <hch@lst.de>
180
217
common.rc

diff --git a/180 b/180
index 6ba32fe40887cb358202739a8ef875d0ff23ea91..c3031696fcb0e402a274e8420fedbafc5c2b2e73 100755 (executable)
--- a/180
+++ b/180
@@ -51,10 +51,8 @@ _require_scratch
 _scratch_mkfs_xfs >/dev/null 2>&1
 _scratch_mount
 
-# Do we have enough space on disk?
-FREE_BLOCKS=`df -klP $SCRATCH_MNT | grep -v Filesystem | awk '{print $4}'`
-[ $FREE_BLOCKS -lt 10485760 ] && _notrun "This test requires at least 10GB of \
-                                          $SCRATCH_DEV to run"
+# Do we have enough space on disk?  10G
+_require_fs_space $SCRATCH_MNT 10485760
 
 _check_files()
 {
diff --git a/217 b/217
index 6032578912a75f8789728c9a2c34a980771c1e6f..19540ad496645e950074126e89f776c1497b47ef 100755 (executable)
--- a/217
+++ b/217
@@ -50,6 +50,8 @@ _setup_testdir
 _require_scratch
 _scratch_mkfs_xfs >/dev/null 2>&1
 _scratch_mount
+# 16T mkfs requires a bit over 2G free
+_require_fs_space $SCRATCH_MNT 2202000
 
 _require_loop
 LOOP_DEV=$SCRATCH_MNT/test_fs
index 642487102b8ae5a50d0ccbf366dd4658d9a5b049..168551431f6e8274d476c64a1d4cb8070ed7edc0 100644 (file)
--- a/common.rc
+++ b/common.rc
@@ -726,7 +726,8 @@ _require_user()
 # check that xfs_io, glibc, kernel, and filesystem all (!) support
 # fallocate
 #
-_require_xfs_io_falloc() {
+_require_xfs_io_falloc()
+{
        testio=`$XFS_IO_PROG -F -f -c "falloc 0 1m" $TEST_DIR/$tmp.io 2>&1`
        rm -f $TEST_DIR/$tmp.io 2>&1 > /dev/null
        echo $testio | grep -q "not found" && \
@@ -735,6 +736,19 @@ _require_xfs_io_falloc() {
                _notrun "xfs_io fallocate command failed (old kernel/wrong fs?)"
 }
 
+# Check that a fs has enough free space (in 1024b blocks)
+#
+_require_fs_space()
+{
+       MNT=$1
+       BLOCKS=$2       # in units of 1024
+       let GB=$BLOCKS/1024/1024
+
+       FREE_BLOCKS=`df -klP $MNT | grep -v Filesystem | awk '{print $4}'`
+       [ $FREE_BLOCKS -lt $BLOCKS ] && \
+               _notrun "This test requires at least ${GB}GB free on $MNT to run"
+}
+
 # check that a FS on a device is mounted
 # if so, return mount point
 #