public inbox for linux-btrfs@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/2 v2] btrfs-progs: tests: fix no acl support
@ 2023-06-22  8:18 Anand Jain
  2023-06-22  8:18 ` [PATCH 1/2 v2] btrfs-progs: tests: add helper check_kernel_support_acl Anand Jain
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Anand Jain @ 2023-06-22  8:18 UTC (permalink / raw)
  To: linux-btrfs

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(+)

-- 
2.39.3


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH 1/2 v2] btrfs-progs: tests: add helper check_kernel_support_acl
  2023-06-22  8:18 [PATCH 0/2 v2] btrfs-progs: tests: fix no acl support Anand Jain
@ 2023-06-22  8:18 ` Anand Jain
  2023-06-22  8:18 ` [PATCH 2/2 v2] btrfs-progs: tests: check for btrfs ACL support Anand Jain
  2023-06-28 21:10 ` [PATCH 0/2 v2] btrfs-progs: tests: fix no acl support David Sterba
  2 siblings, 0 replies; 4+ messages in thread
From: Anand Jain @ 2023-06-22  8:18 UTC (permalink / raw)
  To: linux-btrfs

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 --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...]
-- 
2.39.3


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH 2/2 v2] btrfs-progs: tests: check for btrfs ACL support
  2023-06-22  8:18 [PATCH 0/2 v2] btrfs-progs: tests: fix no acl support Anand Jain
  2023-06-22  8:18 ` [PATCH 1/2 v2] btrfs-progs: tests: add helper check_kernel_support_acl Anand Jain
@ 2023-06-22  8:18 ` Anand Jain
  2023-06-28 21:10 ` [PATCH 0/2 v2] btrfs-progs: tests: fix no acl support David Sterba
  2 siblings, 0 replies; 4+ messages in thread
From: Anand Jain @ 2023-06-22  8:18 UTC (permalink / raw)
  To: linux-btrfs

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().

Signed-off-by: Anand Jain <anand.jain@oracle.com>
---
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(+)

diff --git a/tests/convert-tests/001-ext2-basic/test.sh b/tests/convert-tests/001-ext2-basic/test.sh
index 4e8aaecb2f55..3ed3ed0b82c9 100755
--- a/tests/convert-tests/001-ext2-basic/test.sh
+++ b/tests/convert-tests/001-ext2-basic/test.sh
@@ -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
diff --git a/tests/convert-tests/003-ext4-basic/test.sh b/tests/convert-tests/003-ext4-basic/test.sh
index 8a0b2e333554..dd7bb59181b0 100755
--- a/tests/convert-tests/003-ext4-basic/test.sh
+++ b/tests/convert-tests/003-ext4-basic/test.sh
@@ -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
diff --git a/tests/convert-tests/005-delete-all-rollback/test.sh b/tests/convert-tests/005-delete-all-rollback/test.sh
index 0b668a6fc1de..17bf8a379b6b 100755
--- a/tests/convert-tests/005-delete-all-rollback/test.sh
+++ b/tests/convert-tests/005-delete-all-rollback/test.sh
@@ -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
diff --git a/tests/convert-tests/006-large-hole-extent/test.sh b/tests/convert-tests/006-large-hole-extent/test.sh
index 872b4a6f6175..7d92eb463af8 100755
--- a/tests/convert-tests/006-large-hole-extent/test.sh
+++ b/tests/convert-tests/006-large-hole-extent/test.sh
@@ -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"
diff --git a/tests/misc-tests/057-btrfstune-free-space-tree/test.sh b/tests/misc-tests/057-btrfstune-free-space-tree/test.sh
index 93ff4307fca9..8d9a858ddc2f 100755
--- a/tests/misc-tests/057-btrfstune-free-space-tree/test.sh
+++ b/tests/misc-tests/057-btrfstune-free-space-tree/test.sh
@@ -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
-- 
2.39.3


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH 0/2 v2] btrfs-progs: tests: fix no acl support
  2023-06-22  8:18 [PATCH 0/2 v2] btrfs-progs: tests: fix no acl support Anand Jain
  2023-06-22  8:18 ` [PATCH 1/2 v2] btrfs-progs: tests: add helper check_kernel_support_acl Anand Jain
  2023-06-22  8:18 ` [PATCH 2/2 v2] btrfs-progs: tests: check for btrfs ACL support Anand Jain
@ 2023-06-28 21:10 ` David Sterba
  2 siblings, 0 replies; 4+ messages in thread
From: David Sterba @ 2023-06-28 21:10 UTC (permalink / raw)
  To: Anand Jain; +Cc: linux-btrfs

On Thu, Jun 22, 2023 at 04:18:10PM +0800, Anand Jain wrote:
> 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

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

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2023-06-28 21:22 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-06-22  8:18 [PATCH 0/2 v2] btrfs-progs: tests: fix no acl support Anand Jain
2023-06-22  8:18 ` [PATCH 1/2 v2] btrfs-progs: tests: add helper check_kernel_support_acl Anand Jain
2023-06-22  8:18 ` [PATCH 2/2 v2] btrfs-progs: tests: check for btrfs ACL support Anand Jain
2023-06-28 21:10 ` [PATCH 0/2 v2] btrfs-progs: tests: fix no acl support David Sterba

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox