在 2026/7/14 10:15, Song Hu 写道:
> main() in test_hugetlb_memcg never calls ksft_print_header(),
> ksft_set_plan(), or ksft_finished(), so its output has no TAP plan and is
> not valid TAP, unlike the sibling test_memcontrol and test_kmem tests.
> Add the header/plan/finished calls following the same pattern.
> 
> Signed-off-by: Song Hu <[email protected]>
> ---
>  tools/testing/selftests/cgroup/test_hugetlb_memcg.c | 10 ++++++----
>  1 file changed, 6 insertions(+), 4 deletions(-)
> 
> diff --git a/tools/testing/selftests/cgroup/test_hugetlb_memcg.c 
> b/tools/testing/selftests/cgroup/test_hugetlb_memcg.c
> index b627d84358b1..8c5aced813b6 100644
> --- a/tools/testing/selftests/cgroup/test_hugetlb_memcg.c
> +++ b/tools/testing/selftests/cgroup/test_hugetlb_memcg.c
> @@ -199,7 +199,10 @@ static int test_hugetlb_memcg(char *root)
>  int main(int argc, char **argv)
>  {
>       char root[PATH_MAX];
> -     int ret = EXIT_SUCCESS, has_memory_hugetlb_acc;
> +     int has_memory_hugetlb_acc;
> +
> +     ksft_print_header();
> +     ksft_set_plan(1);
>  
>       has_memory_hugetlb_acc = 
> proc_mount_contains("memory_hugetlb_accounting");
>       if (has_memory_hugetlb_acc < 0)
> @@ -211,7 +214,7 @@ int main(int argc, char **argv)
>       if (get_hugepage_size() != 2048) {
>               ksft_print_msg("test_hugetlb_memcg requires 2MB hugepages\n");
>               ksft_test_result_skip("test_hugetlb_memcg\n");
> -             return ret;
> +             ksft_finished();
>       }
>  
>       if (cg_find_unified_root(root, sizeof(root), NULL))
> @@ -233,10 +236,9 @@ int main(int argc, char **argv)
>               ksft_test_result_skip("test_hugetlb_memcg\n");
>               break;
>       default:
> -             ret = EXIT_FAILURE;
>               ksft_test_result_fail("test_hugetlb_memcg\n");
>               break;
>       }
>  
> -     return ret;
> +     ksft_finished();
>  }

This one looks good to me — it mirrors the test_memcontrol/test_kmem
pattern and the exit-code semantics are preserved.

Reviewed-by: Tao Cui <[email protected]>

Reply via email to