* [PATCH v2] selftests/mm: Drop duplicate test_seal_mprotect_two_vma_with_gap() call
@ 2026-08-06 3:08 Hongfu Li
2026-08-07 0:31 ` SJ Park
2026-08-07 6:00 ` Anshuman Khandual
0 siblings, 2 replies; 4+ messages in thread
From: Hongfu Li @ 2026-08-06 3:08 UTC (permalink / raw)
To: akpm, david, ljs, liam, vbabka, rppt, surenb, mhocko, shuah
Cc: linux-mm, linux-kselftest, linux-kernel, hongfu.li, Hongfu Li
From: Hongfu Li <lihongfu@kylinos.cn>
mseal_test main() invokes test_seal_mprotect_two_vma_with_gap() twice.
The second run repeats all assertions with no benefit. Drop the
duplicate call.
Signed-off-by: Hongfu Li <lihongfu@kylinos.cn>
Reviewed-by: Lorenzo Stoakes (ARM) <ljs@kernel.org>
Acked-by: David Hildenbrand (Arm) <david@kernel.org>
---
v2:
- update ksft_set_plan(88) to 87 to match the actual number of tests
after removing the duplicate call.
- Add Reviewed-by and Acked-by tags.
---
tools/testing/selftests/mm/mseal_test.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/tools/testing/selftests/mm/mseal_test.c b/tools/testing/selftests/mm/mseal_test.c
index 93c2e13094d4..1a05e6921fed 100644
--- a/tools/testing/selftests/mm/mseal_test.c
+++ b/tools/testing/selftests/mm/mseal_test.c
@@ -1876,7 +1876,7 @@ int main(void)
if (!pkey_supported())
ksft_print_msg("PKEY not supported\n");
- ksft_set_plan(88);
+ ksft_set_plan(87);
test_seal_addseal();
test_seal_unmapped_start();
@@ -1913,7 +1913,6 @@ int main(void)
test_seal_mprotect_partial_mprotect(false);
test_seal_mprotect_partial_mprotect(true);
- test_seal_mprotect_two_vma_with_gap();
test_seal_mprotect_two_vma_with_gap();
test_seal_mprotect_merge(false);
--
2.54.0
^ permalink raw reply related [flat|nested] 4+ messages in thread* Re: [PATCH v2] selftests/mm: Drop duplicate test_seal_mprotect_two_vma_with_gap() call
2026-08-06 3:08 [PATCH v2] selftests/mm: Drop duplicate test_seal_mprotect_two_vma_with_gap() call Hongfu Li
@ 2026-08-07 0:31 ` SJ Park
2026-08-07 7:15 ` Hongfu Li
2026-08-07 6:00 ` Anshuman Khandual
1 sibling, 1 reply; 4+ messages in thread
From: SJ Park @ 2026-08-07 0:31 UTC (permalink / raw)
To: Hongfu Li
Cc: SJ Park, akpm, david, ljs, liam, vbabka, rppt, surenb, mhocko,
shuah, linux-mm, linux-kselftest, linux-kernel, Hongfu Li
On Thu, 6 Aug 2026 11:08:50 +0800 Hongfu Li <hongfu.li@linux.dev> wrote:
> From: Hongfu Li <lihongfu@kylinos.cn>
>
> mseal_test main() invokes test_seal_mprotect_two_vma_with_gap() twice.
> The second run repeats all assertions with no benefit. Drop the
> duplicate call.
Good eyes, thank you for fixing this!
>
> Signed-off-by: Hongfu Li <lihongfu@kylinos.cn>
> Reviewed-by: Lorenzo Stoakes (ARM) <ljs@kernel.org>
> Acked-by: David Hildenbrand (Arm) <david@kernel.org>
Reviewed-by: SJ Park <sj@kernel.org>
> ---
> v2:
> - update ksft_set_plan(88) to 87 to match the actual number of tests
> after removing the duplicate call.
I wonder if there could be an automated way for this. Obviously not a question
to the author but just my loud thought.
Thanks,
SJ
[...]
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH v2] selftests/mm: Drop duplicate test_seal_mprotect_two_vma_with_gap() call
2026-08-07 0:31 ` SJ Park
@ 2026-08-07 7:15 ` Hongfu Li
0 siblings, 0 replies; 4+ messages in thread
From: Hongfu Li @ 2026-08-07 7:15 UTC (permalink / raw)
To: sj
Cc: akpm, david, hongfu.li, liam, lihongfu, linux-kernel,
linux-kselftest, linux-mm, ljs, mhocko, rppt, shuah, surenb,
vbabka
> > ---
> > v2:
> > - update ksft_set_plan(88) to 87 to match the actual number of tests
> > after removing the duplicate call.
>
> I wonder if there could be an automated way for this. Obviously not a question
> to the author but just my loud thought.
Glad you brought this up, I totally agree with your thought.
Something like the below refactor could achieve that automation:
+typedef void (*test_fn)(void);
+typedef void (*test_fn_seal)(bool seal);
+
+static const struct {
+ test_fn_seal fn;
+ bool seal;
+} tests_seal[] = {
+ { test_seal_mprotect, false },
+ { test_seal_mprotect, true },
...
+};
+
+static const test_fn tests[] = {
+ test_seal_addseal,
+ test_seal_unmapped_start,
...
+};
+
+
int main(void)
{
...
- ksft_set_plan(87);
+ ksft_set_plan(ARRAY_SIZE(tests) + ARRAY_SIZE(tests_seal));
+ for (size_t i = 0; i < ARRAY_SIZE(tests); i++)
+ tests[i]();
+ for (size_t i = 0; i < ARRAY_SIZE(tests_seal); i++)
+ tests_seal[i].fn(tests_seal[i].seal);
Though I'm still unsure whether this extra complexity is really worthwhile.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH v2] selftests/mm: Drop duplicate test_seal_mprotect_two_vma_with_gap() call
2026-08-06 3:08 [PATCH v2] selftests/mm: Drop duplicate test_seal_mprotect_two_vma_with_gap() call Hongfu Li
2026-08-07 0:31 ` SJ Park
@ 2026-08-07 6:00 ` Anshuman Khandual
1 sibling, 0 replies; 4+ messages in thread
From: Anshuman Khandual @ 2026-08-07 6:00 UTC (permalink / raw)
To: Hongfu Li
Cc: akpm, david, ljs, liam, vbabka, rppt, surenb, mhocko, shuah,
linux-mm, linux-kselftest, linux-kernel, Hongfu Li
On Thu, Aug 06, 2026 at 11:08:50AM +0800, Hongfu Li wrote:
> From: Hongfu Li <lihongfu@kylinos.cn>
>
> mseal_test main() invokes test_seal_mprotect_two_vma_with_gap() twice.
> The second run repeats all assertions with no benefit. Drop the
> duplicate call.
Guess these two instances would have been introduced just following the
adjacent other test cases where one takes true and the other takes false
as arguments :)
>
> Signed-off-by: Hongfu Li <lihongfu@kylinos.cn>
> Reviewed-by: Lorenzo Stoakes (ARM) <ljs@kernel.org>
> Acked-by: David Hildenbrand (Arm) <david@kernel.org>
Reviewed-by: Anshuman Khandual <anshuman.khandual@arm.com>
> ---
> v2:
> - update ksft_set_plan(88) to 87 to match the actual number of tests
> after removing the duplicate call.
> - Add Reviewed-by and Acked-by tags.
> ---
> tools/testing/selftests/mm/mseal_test.c | 3 +--
> 1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/tools/testing/selftests/mm/mseal_test.c b/tools/testing/selftests/mm/mseal_test.c
> index 93c2e13094d4..1a05e6921fed 100644
> --- a/tools/testing/selftests/mm/mseal_test.c
> +++ b/tools/testing/selftests/mm/mseal_test.c
> @@ -1876,7 +1876,7 @@ int main(void)
> if (!pkey_supported())
> ksft_print_msg("PKEY not supported\n");
>
> - ksft_set_plan(88);
> + ksft_set_plan(87);
>
> test_seal_addseal();
> test_seal_unmapped_start();
> @@ -1913,7 +1913,6 @@ int main(void)
> test_seal_mprotect_partial_mprotect(false);
> test_seal_mprotect_partial_mprotect(true);
>
> - test_seal_mprotect_two_vma_with_gap();
> test_seal_mprotect_two_vma_with_gap();
>
> test_seal_mprotect_merge(false);
> --
> 2.54.0
>
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2026-08-07 7:16 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-08-06 3:08 [PATCH v2] selftests/mm: Drop duplicate test_seal_mprotect_two_vma_with_gap() call Hongfu Li
2026-08-07 0:31 ` SJ Park
2026-08-07 7:15 ` Hongfu Li
2026-08-07 6:00 ` Anshuman Khandual
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox