common/xfs: Add helpers for checking CONFIG_XFS_DEBUG availability
authorCarlos Maiolino <cmaiolino@redhat.com>
Fri, 18 Aug 2017 08:51:55 +0000 (10:51 +0200)
committerEryu Guan <eguan@redhat.com>
Wed, 13 Sep 2017 07:52:58 +0000 (15:52 +0800)
Add the following helpers to common/xfs:

_require_xfs_debug()
_require_no_xfs_debug()

Tests that require or not a kernel built with XFS_DEBUG can now use
these two helpers to explicitly check for it.

Signed-off-by: Carlos Maiolino <cmaiolino@redhat.com>
Reviewed-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
common/xfs

index 2c34e08877471b9f28318dcb14f30901880e99ac..def28bfc73090ca557e0c4dc7b1e275059cc10f9 100644 (file)
@@ -585,6 +585,19 @@ _require_xfs_mkfs_ciname()
                || _notrun "need case-insensitive naming support in mkfs.xfs"
 }
 
+# XFS_DEBUG requirements
+_require_xfs_debug()
+{
+       if grep -q "debug 0" /proc/fs/xfs/stat; then
+               _notrun "Require XFS built with CONFIG_XFS_DEBUG"
+       fi
+}
+_require_no_xfs_debug()
+{
+       if grep -q "debug 1" /proc/fs/xfs/stat; then
+               _notrun "Require XFS built without CONFIG_XFS_DEBUG"
+       fi
+}
 # xfs generates WARNINGs on purpose when applications mix buffered/mmap IO with
 # direct IO on the same file. This is a helper for _check_dmesg() to filter out
 # such warnings.