selftests/cgroup: fix missing TAP output in test_hugetlb_memcg
Subsystems (5)
PATCH 1/2 selftests/cgroup: fix missing TAP output in test_hugetlb_memcg
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.
--- tools/testing/selftests/cgroup/test_hugetlb_memcg.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-)
tools/testing/selftests/cgroup/test_hugetlb_memcg.c +6 -4
@@ -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 (); }
Signature · 1 line
2.43.0
Quoted 37 lines · Song Hu
main()intest_hugetlb_memcgnever callsksft_print_header(),ksft_set_plan(), orksft_finished(), so its output has no TAP plan and is not valid TAP, unlike the siblingtest_memcontrolandtest_kmemtests. 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(-)tools/testing/selftests/cgroup/test_hugetlb_memcg.c +5
-2@@ -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" );
tools/testing/selftests/cgroup/test_hugetlb_memcg.c int main(int argc, char **argv) · line 244
Quoted 10 lines
tools/testing/selftests/cgroup/test_hugetlb_memcg.c +1
-2break ;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.
Hello, Song.
Applied to cgroup/for-7.3.
Thanks.
Signature · 1 line
tejun