On 9/24/26 07:00, Sarthak Sharma wrote:
> run_mremap_test_case() reports a test as pass when remap_region()
> succeeds. But if the test was expecting failure and remap succeeds,
> it should be treated as a failure and not a success.
> 
> Check test_case.expect_failure on the successful remap path. If
> it expected failure, report a failure instead of success.
> 
> Fixes: 7df666253f26 ("kselftests: vm: add mremap tests")
> Signed-off-by: Sarthak Sharma <[email protected]>
> ---
>  tools/testing/selftests/mm/mremap_test.c | 7 +++++--
>  1 file changed, 5 insertions(+), 2 deletions(-)
> 
> diff --git a/tools/testing/selftests/mm/mremap_test.c 
> b/tools/testing/selftests/mm/mremap_test.c
> index a5813a5e8f5b..ba9b7f7566d0 100644
> --- a/tools/testing/selftests/mm/mremap_test.c
> +++ b/tools/testing/selftests/mm/mremap_test.c
> @@ -1138,12 +1138,15 @@ static void run_mremap_test_case(struct test 
> test_case, unsigned int threshold_m
>               else
>                       ksft_test_result_fail("%s\n", test_case.name);
>       } else {
> +             if (test_case.expect_failure)
> +                     ksft_test_result_fail("%s: unexpected mremap success\n",
> +                                           test_case.name);
>               /*
>                * Comparing mremap time is only applicable if entire region
>                * was faulted in.
>                */
> -             if (threshold_mb == VALIDATION_NO_THRESHOLD ||
> -                 test_case.config.region_size <= threshold_mb * _1MB)
> +             else if (threshold_mb == VALIDATION_NO_THRESHOLD ||
> +                      test_case.config.region_size <= threshold_mb * _1MB)
>                       ksft_test_result_pass("%s: mremap time: %12lldns\n",
>                                             test_case.name, remap_time);
>               else

That sounds about right to me.

Acked-by: David Hildenbrand (Arm) <[email protected]>

-- 
Cheers,

David

Reply via email to