Skip to contentSkip to conversation

btrfs-progs: tests: fix no acl support

PATCH In review Anand Jain 2 participants 4 messages Jun 22, 2023 – Jun 28, 2023 Btrfs file system

lore
Share & tools
lore

Anand Jain

author
#0 lore raw

v2 cover btrfs-progs: tests: fix no acl support

v2:
Works on David's comments regarding function names. Also use /proc/config.gz to verify ACL support and merging individual test case fixes into a single patch.

Btrfs ACL support is a compiling time optional feature, instead of failing the test cases, let them say notrun. This set fixes it.

Patch 1/2 is preparatory adds helper to check for btrfs acl support. Patches 2/2 are actual fixes.

Thanks.

Anand Jain (2):
btrfs-progs: tests: add helper check_kernel_support_acl
btrfs-progs: tests: check for btrfs ACL support

 tests/common                                   | 18 ++++++++++++++++++
 tests/convert-tests/001-ext2-basic/test.sh     |  1 +
 tests/convert-tests/003-ext4-basic/test.sh     |  1 +
 .../005-delete-all-rollback/test.sh            |  1 +
 .../006-large-hole-extent/test.sh              |  1 +
 .../057-btrfstune-free-space-tree/test.sh      |  1 +
 6 files changed, 23 insertions(+)
Signature · 1 line
2.39.3
author
#1 lore raw

PATCH v2 1/2 btrfs-progs: tests: add helper check_kernel_support_acl

Some test cases are failing because ACL is not compiled on the system. Instead, they should be marked as 'not_run'.

---
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(+)
tests/common +18 -0
index d985ef72a4f1..37473bc8080e 100644
@@ -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...]
Signature · 1 line
2.39.3
author
#2 lore raw

PATCH v2 2/2 btrfs-progs: tests: check for btrfs ACL support

In reply to Anand Jain

Fix failures caused by the lack of ACL support in btrfs. For example:

  $ make test
    ::
    [TEST/misc]   057-btrfstune-free-space-tree
    failed: setfacl -m u:root:x /Volumes/ws/btrfs-progs/tests/mnt/acls/acls.1
    test failed for case 057-btrfstune-free-space-tree
    make: *** [Makefile:493: test-misc] Error 1

Similar failures occurred in the test cases convert/001-ext2-basic, convert/003-ext4-basic, convert/005-delete-all-rollback, and convert/006-large-hole-extent.

Resolve it by adding a check for ACL support using the check_kernel_support_acl() helper function. It gracefully handles the case when ACL support is not compiled by calling _not_run().

---
v2:
Merge individual test case fixes into a single patch.

 tests/convert-tests/001-ext2-basic/test.sh             | 1 +
 tests/convert-tests/003-ext4-basic/test.sh             | 1 +
 tests/convert-tests/005-delete-all-rollback/test.sh    | 1 +
 tests/convert-tests/006-large-hole-extent/test.sh      | 1 +
 tests/misc-tests/057-btrfstune-free-space-tree/test.sh | 1 +
 5 files changed, 5 insertions(+)
tests/convert-tests/001-ext2-basic/test.sh +1 -0
index 4e8aaecb2f55..3ed3ed0b82c9 100755
@@ -8,6 +8,7 @@ check_global_prereq mke2fs
 
 setup_root_helper
 prepare_test_dev
+check_kernel_support_acl
 
 # Iterate over defaults and options that are not tied to hardware capabilities
 # or number of devices
tests/convert-tests/003-ext4-basic/test.sh +1 -0
index 8a0b2e333554..dd7bb59181b0 100755
@@ -8,6 +8,7 @@ check_global_prereq mke2fs
 
 setup_root_helper
 prepare_test_dev
+check_kernel_support_acl
 
 # Iterate over defaults and options that are not tied to hardware capabilities
 # or number of devices
tests/convert-tests/005-delete-all-rollback/test.sh +1 -0
index 0b668a6fc1de..17bf8a379b6b 100755
@@ -10,6 +10,7 @@ check_global_prereq mke2fs
 
 setup_root_helper
 prepare_test_dev
+check_kernel_support_acl
 
 # simple wrapper for a convert test
 # $1: btrfs features, argument to -O
tests/convert-tests/006-large-hole-extent/test.sh +1 -0
index 872b4a6f6175..7d92eb463af8 100755
@@ -13,6 +13,7 @@ check_global_prereq mke2fs
 
 setup_root_helper
 prepare_test_dev
+check_kernel_support_acl
 
 default_mke2fs="mke2fs -t ext4 -b 4096"
 convert_test_preamble '' 'large hole extent test' 16k "$default_mke2fs"
tests/misc-tests/057-btrfstune-free-space-tree/test.sh +1 -0
index 93ff4307fca9..8d9a858ddc2f 100755
@@ -10,6 +10,7 @@ check_prereq btrfs
 
 setup_root_helper
 prepare_test_dev
+check_kernel_support_acl
 
 run_check_mkfs_test_dev -O ^free-space-tree
 run_check_mount_test_dev
Signature · 1 line
2.39.3
#3 lore raw
In reply to Anand Jain
Quoted 9 lines · Anand Jain

v2:
Works on David's comments regarding function names. Also use /proc/config.gz to verify ACL support and merging individual test case fixes into a single patch.

Btrfs ACL support is a compiling time optional feature, instead of failing the test cases, let them say notrun. This set fixes it.

Quoted 8 lines

Patch 1/2 is preparatory adds helper to check for btrfs acl support. Patches 2/2 are actual fixes.

Thanks.

Anand Jain (2):
btrfs-progs: tests: add helper check_kernel_support_acl
btrfs-progs: tests: check for btrfs ACL support

Added to devel, thanks. I'll queue the kernel part for 6.6.