diff mbox series

[1/2,v2] btrfs-progs: tests: add helper check_kernel_support_acl

Message ID 1a79c0a998966f42f6fd561d38801a6c4d309dcc.1687419918.git.anand.jain@oracle.com (mailing list archive)
State New, archived
Headers show
Series btrfs-progs: tests: fix no acl support | expand

Commit Message

Anand Jain June 22, 2023, 8:18 a.m. UTC
Some test cases are failing because ACL is not compiled on the system.
Instead, they should be marked as 'not_run'.

Signed-off-by: Anand Jain <anand.jain@oracle.com>
---
v2:
 Work on David's comments regarding function names.
 Also use /proc/config.gz to verify ACL support.

 tests/common | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)
diff mbox series

Patch

diff --git a/tests/common b/tests/common
index d985ef72a4f1..37473bc8080e 100644
--- a/tests/common
+++ b/tests/common
@@ -575,6 +575,24 @@  setup_root_helper()
 	SUDO_HELPER=root_helper
 }
 
+# Check if btrfs is compiled with CONFIG_BTRFS_FS_POSIX_ACL, may need TEST_DEV.
+check_kernel_support_acl()
+{
+	if [ -f /proc/config.gz ] && \
+	   ! zgrep -q "^CONFIG_BTRFS_FS_POSIX_ACL=y" /proc/config.gz; then
+		_not_run "ACL is not compiled"
+	fi
+
+	run_check_mkfs_test_dev
+	run_check_mount_test_dev
+
+	if grep "$TEST_MNT" /proc/self/mounts | grep -q noacl; then
+		run_check_umount_test_dev
+		_not_run "ACL is not compiled"
+	fi
+	run_check_umount_test_dev
+}
+
 prepare_test_dev()
 {
 	# num[K/M/G/T...]