Skip to content

Commit 1dc830e

Browse files
Guopeng Zhanghtejun
authored andcommitted
selftests/cgroup: conform test to KTAP format output
Conform the layout, informational and status messages to KTAP. No functional change is intended other than the layout of output messages. Signed-off-by: Guopeng Zhang <[email protected]> Suggested-by: Sebastian Chlad <[email protected]> Acked-by: Michal Koutný <[email protected]> Signed-off-by: Tejun Heo <[email protected]>
1 parent f23cb0c commit 1dc830e

File tree

8 files changed

+32
-24
lines changed

8 files changed

+32
-24
lines changed

tools/testing/selftests/cgroup/test_core.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -923,8 +923,10 @@ struct corecg_test {
923923
int main(int argc, char *argv[])
924924
{
925925
char root[PATH_MAX];
926-
int i, ret = EXIT_SUCCESS;
926+
int i;
927927

928+
ksft_print_header();
929+
ksft_set_plan(ARRAY_SIZE(tests));
928930
if (cg_find_unified_root(root, sizeof(root), &nsdelegate)) {
929931
if (setup_named_v1_root(root, sizeof(root), CG_NAMED_NAME))
930932
ksft_exit_skip("cgroup v2 isn't mounted and could not setup named v1 hierarchy\n");
@@ -946,12 +948,11 @@ int main(int argc, char *argv[])
946948
ksft_test_result_skip("%s\n", tests[i].name);
947949
break;
948950
default:
949-
ret = EXIT_FAILURE;
950951
ksft_test_result_fail("%s\n", tests[i].name);
951952
break;
952953
}
953954
}
954955

955956
cleanup_named_v1_root(root);
956-
return ret;
957+
ksft_finished();
957958
}

tools/testing/selftests/cgroup/test_cpu.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -796,8 +796,10 @@ struct cpucg_test {
796796
int main(int argc, char *argv[])
797797
{
798798
char root[PATH_MAX];
799-
int i, ret = EXIT_SUCCESS;
799+
int i;
800800

801+
ksft_print_header();
802+
ksft_set_plan(ARRAY_SIZE(tests));
801803
if (cg_find_unified_root(root, sizeof(root), NULL))
802804
ksft_exit_skip("cgroup v2 isn't mounted\n");
803805

@@ -814,11 +816,10 @@ int main(int argc, char *argv[])
814816
ksft_test_result_skip("%s\n", tests[i].name);
815817
break;
816818
default:
817-
ret = EXIT_FAILURE;
818819
ksft_test_result_fail("%s\n", tests[i].name);
819820
break;
820821
}
821822
}
822823

823-
return ret;
824+
ksft_finished();
824825
}

tools/testing/selftests/cgroup/test_cpuset.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -247,8 +247,10 @@ struct cpuset_test {
247247
int main(int argc, char *argv[])
248248
{
249249
char root[PATH_MAX];
250-
int i, ret = EXIT_SUCCESS;
250+
int i;
251251

252+
ksft_print_header();
253+
ksft_set_plan(ARRAY_SIZE(tests));
252254
if (cg_find_unified_root(root, sizeof(root), NULL))
253255
ksft_exit_skip("cgroup v2 isn't mounted\n");
254256

@@ -265,11 +267,10 @@ int main(int argc, char *argv[])
265267
ksft_test_result_skip("%s\n", tests[i].name);
266268
break;
267269
default:
268-
ret = EXIT_FAILURE;
269270
ksft_test_result_fail("%s\n", tests[i].name);
270271
break;
271272
}
272273
}
273274

274-
return ret;
275+
ksft_finished();
275276
}

tools/testing/selftests/cgroup/test_freezer.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1488,8 +1488,10 @@ struct cgfreezer_test {
14881488
int main(int argc, char *argv[])
14891489
{
14901490
char root[PATH_MAX];
1491-
int i, ret = EXIT_SUCCESS;
1491+
int i;
14921492

1493+
ksft_print_header();
1494+
ksft_set_plan(ARRAY_SIZE(tests));
14931495
if (cg_find_unified_root(root, sizeof(root), NULL))
14941496
ksft_exit_skip("cgroup v2 isn't mounted\n");
14951497
for (i = 0; i < ARRAY_SIZE(tests); i++) {
@@ -1501,11 +1503,10 @@ int main(int argc, char *argv[])
15011503
ksft_test_result_skip("%s\n", tests[i].name);
15021504
break;
15031505
default:
1504-
ret = EXIT_FAILURE;
15051506
ksft_test_result_fail("%s\n", tests[i].name);
15061507
break;
15071508
}
15081509
}
15091510

1510-
return ret;
1511+
ksft_finished();
15111512
}

tools/testing/selftests/cgroup/test_kill.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -274,8 +274,10 @@ struct cgkill_test {
274274
int main(int argc, char *argv[])
275275
{
276276
char root[PATH_MAX];
277-
int i, ret = EXIT_SUCCESS;
277+
int i;
278278

279+
ksft_print_header();
280+
ksft_set_plan(ARRAY_SIZE(tests));
279281
if (cg_find_unified_root(root, sizeof(root), NULL))
280282
ksft_exit_skip("cgroup v2 isn't mounted\n");
281283
for (i = 0; i < ARRAY_SIZE(tests); i++) {
@@ -287,11 +289,10 @@ int main(int argc, char *argv[])
287289
ksft_test_result_skip("%s\n", tests[i].name);
288290
break;
289291
default:
290-
ret = EXIT_FAILURE;
291292
ksft_test_result_fail("%s\n", tests[i].name);
292293
break;
293294
}
294295
}
295296

296-
return ret;
297+
ksft_finished();
297298
}

tools/testing/selftests/cgroup/test_kmem.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -421,8 +421,10 @@ struct kmem_test {
421421
int main(int argc, char **argv)
422422
{
423423
char root[PATH_MAX];
424-
int i, ret = EXIT_SUCCESS;
424+
int i;
425425

426+
ksft_print_header();
427+
ksft_set_plan(ARRAY_SIZE(tests));
426428
if (cg_find_unified_root(root, sizeof(root), NULL))
427429
ksft_exit_skip("cgroup v2 isn't mounted\n");
428430

@@ -446,11 +448,10 @@ int main(int argc, char **argv)
446448
ksft_test_result_skip("%s\n", tests[i].name);
447449
break;
448450
default:
449-
ret = EXIT_FAILURE;
450451
ksft_test_result_fail("%s\n", tests[i].name);
451452
break;
452453
}
453454
}
454455

455-
return ret;
456+
ksft_finished();
456457
}

tools/testing/selftests/cgroup/test_memcontrol.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1650,8 +1650,10 @@ struct memcg_test {
16501650
int main(int argc, char **argv)
16511651
{
16521652
char root[PATH_MAX];
1653-
int i, proc_status, ret = EXIT_SUCCESS;
1653+
int i, proc_status;
16541654

1655+
ksft_print_header();
1656+
ksft_set_plan(ARRAY_SIZE(tests));
16551657
if (cg_find_unified_root(root, sizeof(root), NULL))
16561658
ksft_exit_skip("cgroup v2 isn't mounted\n");
16571659

@@ -1685,11 +1687,10 @@ int main(int argc, char **argv)
16851687
ksft_test_result_skip("%s\n", tests[i].name);
16861688
break;
16871689
default:
1688-
ret = EXIT_FAILURE;
16891690
ksft_test_result_fail("%s\n", tests[i].name);
16901691
break;
16911692
}
16921693
}
16931694

1694-
return ret;
1695+
ksft_finished();
16951696
}

tools/testing/selftests/cgroup/test_zswap.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -597,8 +597,10 @@ static bool zswap_configured(void)
597597
int main(int argc, char **argv)
598598
{
599599
char root[PATH_MAX];
600-
int i, ret = EXIT_SUCCESS;
600+
int i;
601601

602+
ksft_print_header();
603+
ksft_set_plan(ARRAY_SIZE(tests));
602604
if (cg_find_unified_root(root, sizeof(root), NULL))
603605
ksft_exit_skip("cgroup v2 isn't mounted\n");
604606

@@ -625,11 +627,10 @@ int main(int argc, char **argv)
625627
ksft_test_result_skip("%s\n", tests[i].name);
626628
break;
627629
default:
628-
ret = EXIT_FAILURE;
629630
ksft_test_result_fail("%s\n", tests[i].name);
630631
break;
631632
}
632633
}
633634

634-
return ret;
635+
ksft_finished();
635636
}

0 commit comments

Comments
 (0)