From: Jeff Mahoney Date: Mon, 21 Jan 2019 16:33:10 +0000 (-0500) Subject: btrfs/010: don't run without /sys/fs/btrfs X-Git-Tag: v2022.05.01~1283 X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=5b1a503aba5f4890c2aa20a3b77ceef87427430a;p=xfstests-dev.git btrfs/010: don't run without /sys/fs/btrfs Older kernels don't have /sys/fs/btrfs. btrfs/010 will happily run until it goes to check its work against sysfs and finds those files don't exist. This patch introduces a require check to ensure that the sysfs files are present before running. Signed-off-by: Jeff Mahoney Reviewed-by: Filipe Manana Signed-off-by: Eryu Guan --- diff --git a/common/btrfs b/common/btrfs index 26dc0bb9..f6513c06 100644 --- a/common/btrfs +++ b/common/btrfs @@ -89,6 +89,14 @@ _require_btrfs_fs_feature() _notrun "Feature $feat not supported by the available btrfs version" } +_require_btrfs_fs_sysfs() +{ + modprobe btrfs > /dev/null 2>&1 + [ -e /sys/fs/btrfs/features ] || \ + _notrun "Sysfs not supported by the available btrfs version" + +} + _check_btrfs_filesystem() { device=$1 diff --git a/tests/btrfs/010 b/tests/btrfs/010 index 1a5f0146..72b2c727 100755 --- a/tests/btrfs/010 +++ b/tests/btrfs/010 @@ -33,6 +33,7 @@ rm -f $seqres.full _supported_fs btrfs _supported_os Linux _require_test +_require_btrfs_fs_sysfs # Create 32k extents. All of these extents will be accounted as outstanding and # reserved.