The Linux Kernel Mailing List
 help / color / mirror / Atom feed
* [PATCH 1/2] selftests/cgroup: fix missing TAP output in test_hugetlb_memcg
@ 2026-07-14  2:15 Song Hu
  2026-07-14  3:00 ` Tao Cui
  0 siblings, 1 reply; 2+ messages in thread
From: Song Hu @ 2026-07-14  2:15 UTC (permalink / raw)
  To: linux-mm
  Cc: muchun.song, osalvador, david, hannes, mhocko, roman.gushchin,
	shakeel.butt, tj, mkoutny, shuah, cgroups, linux-kselftest,
	linux-kernel, 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 <husong@kylinos.cn>
---
 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();
 }
-- 
2.43.0


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

* Re: [PATCH 1/2] selftests/cgroup: fix missing TAP output in test_hugetlb_memcg
  2026-07-14  2:15 [PATCH 1/2] selftests/cgroup: fix missing TAP output in test_hugetlb_memcg Song Hu
@ 2026-07-14  3:00 ` Tao Cui
  0 siblings, 0 replies; 2+ messages in thread
From: Tao Cui @ 2026-07-14  3:00 UTC (permalink / raw)
  To: Song Hu, linux-mm
  Cc: cui.tao, muchun.song, osalvador, david, hannes, mhocko,
	roman.gushchin, shakeel.butt, tj, mkoutny, shuah, cgroups,
	linux-kselftest, linux-kernel



在 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 <husong@kylinos.cn>
> ---
>  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 <cuitao@kylinos.cn>

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

end of thread, other threads:[~2026-07-14  3:00 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-07-14  2:15 [PATCH 1/2] selftests/cgroup: fix missing TAP output in test_hugetlb_memcg Song Hu
2026-07-14  3:00 ` Tao Cui

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