All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/6] btrfs-progs: tests: fix no acl support
@ 2023-06-20  8:49 Anand Jain
  2023-06-20  8:49 ` [PATCH 1/6] btrfs-progs: tests: add helper check_prereq_btrfsacl Anand Jain
                   ` (5 more replies)
  0 siblings, 6 replies; 11+ messages in thread
From: Anand Jain @ 2023-06-20  8:49 UTC (permalink / raw)
  To: linux-btrfs; +Cc: Anand Jain

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/6 is preparatory adds helper to check for btrfs acl support.
Patches 2-6/6 are actual fixes.

Thanks.

Anand Jain (6):
  btrfs-progs: tests: add helper check_prereq_btrfsacl
  btrfs-progs: tests: misc/057-btrfstune-free-space-tree check for btrfs
    acl support
  btrfs-progs: tests: convert/001-ext2-basic check for btrfs acl support
  btrfs-progs: tests: convert/003-ext4-basic check for btrfs acl support
  btrfs-progs: tests: convert/005-delete-all-rollback check for btrfs
    acl support
  btrfs-progs: tests: convert/006-large-hole-extent check for btrfs acl
    support

 tests/common                                        | 13 +++++++++++++
 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 +
 .../057-btrfstune-free-space-tree/test.sh           |  1 +
 6 files changed, 18 insertions(+)

-- 
2.31.1


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

* [PATCH 1/6] btrfs-progs: tests: add helper check_prereq_btrfsacl
  2023-06-20  8:49 [PATCH 0/6] btrfs-progs: tests: fix no acl support Anand Jain
@ 2023-06-20  8:49 ` Anand Jain
  2023-06-21 14:56   ` David Sterba
  2023-06-20  8:49 ` [PATCH 2/6] btrfs-progs: tests: misc/057-btrfstune-free-space-tree check for btrfs acl support Anand Jain
                   ` (4 subsequent siblings)
  5 siblings, 1 reply; 11+ messages in thread
From: Anand Jain @ 2023-06-20  8:49 UTC (permalink / raw)
  To: linux-btrfs; +Cc: Anand Jain

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>
---
 tests/common | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/tests/common b/tests/common
index d985ef72a4f1..0c75d5d76c44 100644
--- a/tests/common
+++ b/tests/common
@@ -575,6 +575,19 @@ setup_root_helper()
 	SUDO_HELPER=root_helper
 }
 
+# Check if btrfs is compiled with CONFIG_BTRFS_FS_POSIX_ACL, requires TEST_DEV.
+check_prereq_btrfsacl()
+{
+	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 not compiled"
+	fi
+	run_check_umount_test_dev
+}
+
 prepare_test_dev()
 {
 	# num[K/M/G/T...]
-- 
2.31.1


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

* [PATCH 2/6] btrfs-progs: tests: misc/057-btrfstune-free-space-tree check for btrfs acl support
  2023-06-20  8:49 [PATCH 0/6] btrfs-progs: tests: fix no acl support Anand Jain
  2023-06-20  8:49 ` [PATCH 1/6] btrfs-progs: tests: add helper check_prereq_btrfsacl Anand Jain
@ 2023-06-20  8:49 ` Anand Jain
  2023-06-21 14:58   ` David Sterba
  2023-06-20  8:49 ` [PATCH 3/6] btrfs-progs: tests: convert/001-ext2-basic " Anand Jain
                   ` (3 subsequent siblings)
  5 siblings, 1 reply; 11+ messages in thread
From: Anand Jain @ 2023-06-20  8:49 UTC (permalink / raw)
  To: linux-btrfs; +Cc: Anand Jain

Fix failure due to no acl support in btrfs.

  $ 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

Instead, use check_prereq_btrfsacl() to call _not_run().

Signed-off-by: Anand Jain <anand.jain@oracle.com>
---
 tests/misc-tests/057-btrfstune-free-space-tree/test.sh | 1 +
 1 file changed, 1 insertion(+)

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..d91fe2588c93 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_prereq_btrfsacl
 
 run_check_mkfs_test_dev -O ^free-space-tree
 run_check_mount_test_dev
-- 
2.31.1


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

* [PATCH 3/6] btrfs-progs: tests: convert/001-ext2-basic check for btrfs acl support
  2023-06-20  8:49 [PATCH 0/6] btrfs-progs: tests: fix no acl support Anand Jain
  2023-06-20  8:49 ` [PATCH 1/6] btrfs-progs: tests: add helper check_prereq_btrfsacl Anand Jain
  2023-06-20  8:49 ` [PATCH 2/6] btrfs-progs: tests: misc/057-btrfstune-free-space-tree check for btrfs acl support Anand Jain
@ 2023-06-20  8:49 ` Anand Jain
  2023-06-20  8:50 ` [PATCH 4/6] btrfs-progs: tests: convert/003-ext4-basic " Anand Jain
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 11+ messages in thread
From: Anand Jain @ 2023-06-20  8:49 UTC (permalink / raw)
  To: linux-btrfs; +Cc: Anand Jain

Fix failure due to no acl support in btrfs.

  $ make test
  ::
    [TEST/conv]   001-ext2-basic
    [TEST/conv]     ext2 4k nodesize, btrfs defaults
  failed: setfacl -m u:root:x /Volumes/ws/btrfs-progs/tests/mnt/acls/acls.1
  test failed for case 001-ext2-basic
  make: *** [Makefile:477: test-convert] Error 1

Instead, use check_prereq_btrfsacl() to call _not_run().

Signed-off-by: Anand Jain <anand.jain@oracle.com>
---
 tests/convert-tests/001-ext2-basic/test.sh | 1 +
 1 file changed, 1 insertion(+)

diff --git a/tests/convert-tests/001-ext2-basic/test.sh b/tests/convert-tests/001-ext2-basic/test.sh
index 4e8aaecb2f55..4666a83a24b3 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_prereq_btrfsacl
 
 # Iterate over defaults and options that are not tied to hardware capabilities
 # or number of devices
-- 
2.31.1


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

* [PATCH 4/6] btrfs-progs: tests: convert/003-ext4-basic check for btrfs acl support
  2023-06-20  8:49 [PATCH 0/6] btrfs-progs: tests: fix no acl support Anand Jain
                   ` (2 preceding siblings ...)
  2023-06-20  8:49 ` [PATCH 3/6] btrfs-progs: tests: convert/001-ext2-basic " Anand Jain
@ 2023-06-20  8:50 ` Anand Jain
  2023-06-20  8:50 ` [PATCH 5/6] btrfs-progs: tests: convert/005-delete-all-rollback " Anand Jain
  2023-06-20  8:50 ` [PATCH 6/6] btrfs-progs: tests: convert/006-large-hole-extent " Anand Jain
  5 siblings, 0 replies; 11+ messages in thread
From: Anand Jain @ 2023-06-20  8:50 UTC (permalink / raw)
  To: linux-btrfs; +Cc: Anand Jain

Fix failure due to no acl support in btrfs.

  $ make test
  ::
  [TEST/conv]   003-ext4-basic
  [TEST/conv]     ext4 4k nodesize, btrfs defaults
  failed: /Volumes/ws/btrfs-progs/btrfs inspect-internal dump-super -Ffa /Volumes/ws/btrfs-progs/tests/test.img
  test failed for case 003-ext4-basic
  make: *** [Makefile:477: test-convert] Error 1

Instead, use check_prereq_btrfsacl() to call _not_run().

Signed-off-by: Anand Jain <anand.jain@oracle.com>
---
 tests/convert-tests/003-ext4-basic/test.sh | 1 +
 1 file changed, 1 insertion(+)

diff --git a/tests/convert-tests/003-ext4-basic/test.sh b/tests/convert-tests/003-ext4-basic/test.sh
index 8a0b2e333554..911d03006be6 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_prereq_btrfsacl
 
 # Iterate over defaults and options that are not tied to hardware capabilities
 # or number of devices
-- 
2.31.1


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

* [PATCH 5/6] btrfs-progs: tests: convert/005-delete-all-rollback check for btrfs acl support
  2023-06-20  8:49 [PATCH 0/6] btrfs-progs: tests: fix no acl support Anand Jain
                   ` (3 preceding siblings ...)
  2023-06-20  8:50 ` [PATCH 4/6] btrfs-progs: tests: convert/003-ext4-basic " Anand Jain
@ 2023-06-20  8:50 ` Anand Jain
  2023-06-20  8:50 ` [PATCH 6/6] btrfs-progs: tests: convert/006-large-hole-extent " Anand Jain
  5 siblings, 0 replies; 11+ messages in thread
From: Anand Jain @ 2023-06-20  8:50 UTC (permalink / raw)
  To: linux-btrfs; +Cc: Anand Jain

Fix failure due to no acl support in btrfs.

  $ make test
  ::
  [TEST/conv]   005-delete-all-rollback
  [TEST/conv]     ext4 4k nodesize, btrfs defaults
  failed: /Volumes/ws/btrfs-progs/btrfs inspect-internal dump-super -Ffa /Volumes/ws/btrfs-progs/tests/test.img
  test failed for case 005-delete-all-rollback
  make: *** [Makefile:477: test-convert] Error 1

Instead, use check_prereq_btrfsacl() to call _not_run().

Signed-off-by: Anand Jain <anand.jain@oracle.com>
---
 tests/convert-tests/005-delete-all-rollback/test.sh | 1 +
 1 file changed, 1 insertion(+)

diff --git a/tests/convert-tests/005-delete-all-rollback/test.sh b/tests/convert-tests/005-delete-all-rollback/test.sh
index 0b668a6fc1de..02b53bac58a6 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_prereq_btrfsacl
 
 # simple wrapper for a convert test
 # $1: btrfs features, argument to -O
-- 
2.31.1


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

* [PATCH 6/6] btrfs-progs: tests: convert/006-large-hole-extent check for btrfs acl support
  2023-06-20  8:49 [PATCH 0/6] btrfs-progs: tests: fix no acl support Anand Jain
                   ` (4 preceding siblings ...)
  2023-06-20  8:50 ` [PATCH 5/6] btrfs-progs: tests: convert/005-delete-all-rollback " Anand Jain
@ 2023-06-20  8:50 ` Anand Jain
  5 siblings, 0 replies; 11+ messages in thread
From: Anand Jain @ 2023-06-20  8:50 UTC (permalink / raw)
  To: linux-btrfs; +Cc: Anand Jain

Fix failure due to no acl support in btrfs.

  $ make test
    [TEST/conv]   006-large-hole-extent
    [TEST/conv]     large hole extent test, btrfs defaults
    failed: /Volumes/ws/btrfs-progs/btrfs inspect-internal dump-super -Ffa /Volumes/ws/btrfs-progs/tests/test.img
    test failed for case 006-large-hole-extent
    make: *** [Makefile:477: test-convert] Error 1

Instead, use check_prereq_btrfsacl() to call _not_run().

Signed-off-by: Anand Jain <anand.jain@oracle.com>
---
 tests/convert-tests/006-large-hole-extent/test.sh | 1 +
 1 file changed, 1 insertion(+)

diff --git a/tests/convert-tests/006-large-hole-extent/test.sh b/tests/convert-tests/006-large-hole-extent/test.sh
index 872b4a6f6175..d7007b705862 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_prereq_btrfsacl
 
 default_mke2fs="mke2fs -t ext4 -b 4096"
 convert_test_preamble '' 'large hole extent test' 16k "$default_mke2fs"
-- 
2.31.1


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

* Re: [PATCH 1/6] btrfs-progs: tests: add helper check_prereq_btrfsacl
  2023-06-20  8:49 ` [PATCH 1/6] btrfs-progs: tests: add helper check_prereq_btrfsacl Anand Jain
@ 2023-06-21 14:56   ` David Sterba
  2023-06-22  8:11     ` Anand Jain
  0 siblings, 1 reply; 11+ messages in thread
From: David Sterba @ 2023-06-21 14:56 UTC (permalink / raw)
  To: Anand Jain; +Cc: linux-btrfs

On Tue, Jun 20, 2023 at 04:49:57PM +0800, Anand Jain wrote:
> 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>
> ---
>  tests/common | 13 +++++++++++++
>  1 file changed, 13 insertions(+)
> 
> diff --git a/tests/common b/tests/common
> index d985ef72a4f1..0c75d5d76c44 100644
> --- a/tests/common
> +++ b/tests/common
> @@ -575,6 +575,19 @@ setup_root_helper()
>  	SUDO_HELPER=root_helper
>  }
>  
> +# Check if btrfs is compiled with CONFIG_BTRFS_FS_POSIX_ACL, requires TEST_DEV.
> +check_prereq_btrfsacl()

The _prereq_ helpers are supposed to check utilities or modules, the
kernel features are named like check_kernel_support_FEATURE.

> +{
> +	run_check_mkfs_test_dev
> +	run_check_mount_test_dev
> +
> +	if grep "$TEST_MNT" /proc/self/mounts | grep -q noacl; then

So this relies on the fact that if ACLs are not compiled in a mounted
filesystem will add noacl to the mount options. This works though
requires a mount. Another option is to grep /proc/config.gz, or
eventually rely on the sysfs export.

That it needs mount can be problematic on kernels with unsupported
features built by default, like eventually block-group-tree. This would
be rare but also would fail the testsuite. The CI environments do not
always have most up-to-date kernels while part of the test suite can
still run.

We can do the mkfs/mount check with some caution, though I don't like it
much.

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

* Re: [PATCH 2/6] btrfs-progs: tests: misc/057-btrfstune-free-space-tree check for btrfs acl support
  2023-06-20  8:49 ` [PATCH 2/6] btrfs-progs: tests: misc/057-btrfstune-free-space-tree check for btrfs acl support Anand Jain
@ 2023-06-21 14:58   ` David Sterba
  2023-06-22  8:12     ` Anand Jain
  0 siblings, 1 reply; 11+ messages in thread
From: David Sterba @ 2023-06-21 14:58 UTC (permalink / raw)
  To: Anand Jain; +Cc: linux-btrfs

On Tue, Jun 20, 2023 at 04:49:58PM +0800, Anand Jain wrote:
> Fix failure due to no acl support in btrfs.
> 
>   $ 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
> 
> Instead, use check_prereq_btrfsacl() to call _not_run().
> 
> Signed-off-by: Anand Jain <anand.jain@oracle.com>
> ---
>  tests/misc-tests/057-btrfstune-free-space-tree/test.sh | 1 +
>  1 file changed, 1 insertion(+)
> 
> 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..d91fe2588c93 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_prereq_btrfsacl

You can do all the test case changes in one patch, the error messages
are basically the same.

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

* Re: [PATCH 1/6] btrfs-progs: tests: add helper check_prereq_btrfsacl
  2023-06-21 14:56   ` David Sterba
@ 2023-06-22  8:11     ` Anand Jain
  0 siblings, 0 replies; 11+ messages in thread
From: Anand Jain @ 2023-06-22  8:11 UTC (permalink / raw)
  To: dsterba; +Cc: linux-btrfs


>> +# Check if btrfs is compiled with CONFIG_BTRFS_FS_POSIX_ACL, requires TEST_DEV.
>> +check_prereq_btrfsacl()
> 
> The _prereq_ helpers are supposed to check utilities or modules, the
> kernel features are named like check_kernel_support_FEATURE.

Ah. That's a clean thumb rule. I will fix it.

> 
>> +{
>> +	run_check_mkfs_test_dev
>> +	run_check_mount_test_dev
>> +
>> +	if grep "$TEST_MNT" /proc/self/mounts | grep -q noacl; then
> 
> So this relies on the fact that if ACLs are not compiled in a mounted
> filesystem will add noacl to the mount options. This works though
> requires a mount.

Yep.

>Another option is to grep /proc/config.gz, or

/proc/config.gz is optional file as well, so we can check ACL
support first in /proc/config.gz and then fallback to the other
methods. Will add it.

> eventually rely on the sysfs export.

Yes.

> That it needs mount can be problematic on kernels with unsupported
> features built by default, like eventually block-group-tree. This would
> be rare but also would fail the testsuite. The CI environments do not
> always have most up-to-date kernels while part of the test suite can
> still run.
> 
> We can do the mkfs/mount check with some caution, though I don't like it
> much.

There isn't much choice; using the mkfs/mount to confirm ACL support
should be the last method IMO, and hopefully, in the long run, the
sysfs method will make other methods redundant.



Thanks for the comments.
Anand


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

* Re: [PATCH 2/6] btrfs-progs: tests: misc/057-btrfstune-free-space-tree check for btrfs acl support
  2023-06-21 14:58   ` David Sterba
@ 2023-06-22  8:12     ` Anand Jain
  0 siblings, 0 replies; 11+ messages in thread
From: Anand Jain @ 2023-06-22  8:12 UTC (permalink / raw)
  To: dsterba; +Cc: linux-btrfs


> 
> You can do all the test case changes in one patch, the error messages
> are basically the same.

Yeah, will merge them into one patch.

Thanks, Anand

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

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

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-06-20  8:49 [PATCH 0/6] btrfs-progs: tests: fix no acl support Anand Jain
2023-06-20  8:49 ` [PATCH 1/6] btrfs-progs: tests: add helper check_prereq_btrfsacl Anand Jain
2023-06-21 14:56   ` David Sterba
2023-06-22  8:11     ` Anand Jain
2023-06-20  8:49 ` [PATCH 2/6] btrfs-progs: tests: misc/057-btrfstune-free-space-tree check for btrfs acl support Anand Jain
2023-06-21 14:58   ` David Sterba
2023-06-22  8:12     ` Anand Jain
2023-06-20  8:49 ` [PATCH 3/6] btrfs-progs: tests: convert/001-ext2-basic " Anand Jain
2023-06-20  8:50 ` [PATCH 4/6] btrfs-progs: tests: convert/003-ext4-basic " Anand Jain
2023-06-20  8:50 ` [PATCH 5/6] btrfs-progs: tests: convert/005-delete-all-rollback " Anand Jain
2023-06-20  8:50 ` [PATCH 6/6] btrfs-progs: tests: convert/006-large-hole-extent " Anand Jain

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.