]> git.apps.os.sepia.ceph.com Git - xfstests-dev.git/commitdiff
generic/35[67]: disable swapfile tests on Btrfs
authorOmar Sandoval <osandov@fb.com>
Tue, 6 Dec 2016 01:01:28 +0000 (17:01 -0800)
committerEryu Guan <eguan@redhat.com>
Tue, 6 Dec 2016 11:04:19 +0000 (19:04 +0800)
Btrfs doesn't support swapfiles (yet?), so generic/356 fails
erroneously, and generic/357 only passes by accident. Let's add a
_require_scratch_swapfile helper and add it to these tests.

Signed-off-by: Omar Sandoval <osandov@fb.com>
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
common/rc
tests/generic/356
tests/generic/357

index 2719b23e3ac1035c67127aefea67f99085a305f5..d863e5694df8cd38f8b38d02a9e411b2336f56cc 100644 (file)
--- a/common/rc
+++ b/common/rc
@@ -1790,6 +1790,28 @@ _require_odirect()
        rm -f $testfile 2>&1 > /dev/null
 }
 
+# Check that the filesystem supports swapfiles
+_require_scratch_swapfile()
+{
+       _require_scratch
+
+       _scratch_mkfs >/dev/null
+       _scratch_mount
+
+       # Minimum size for mkswap is 10 pages
+       local size=$(($(get_page_size) * 10))
+
+       _pwrite_byte 0x61 0 "$size" "$SCRATCH_MNT/swap" >/dev/null 2>&1
+       mkswap "$SCRATCH_MNT/swap" >/dev/null 2>&1
+       if ! swapon "$SCRATCH_MNT/swap" >/dev/null 2>&1; then
+               _scratch_unmount
+               _notrun "swapfiles are not supported"
+       fi
+
+       swapoff "$SCRATCH_MNT/swap" >/dev/null 2>&1
+       _scratch_unmount
+}
+
 # Check that a fs has enough free space (in 1024b blocks)
 #
 _require_fs_space()
index 6bb90c0e0760ece3584507270f3333bfd7aa44e0..51eeb652d1d4093092e8525f7a6b86fae898d28e 100755 (executable)
@@ -44,6 +44,7 @@ _cleanup()
 
 # real QA test starts here
 _supported_os Linux
+_require_scratch_swapfile
 _require_scratch_reflink
 _require_cp_reflink
 
index 439b314122f48c1d9af4ecb5adcb787b194752ae..0dd0c10f6294df066f14757d38245bc9ba997866 100755 (executable)
@@ -44,6 +44,7 @@ _cleanup()
 
 # real QA test starts here
 _supported_os Linux
+_require_scratch_swapfile
 _require_scratch_reflink
 _require_cp_reflink