[PATCH 3/4] kselftests: vdso: vdso_test_getcpu: conform test to TAP output

From: Muhammad Usama Anjum
Date: Wed May 29 2024 - 03:27:10 EST


Conform the layout, informational and status messages to TAP. No
functional change is intended other than the layout of output messages.

Signed-off-by: Muhammad Usama Anjum <usama.anjum@xxxxxxxxxxxxx>
---
tools/testing/selftests/vDSO/vdso_test_getcpu.c | 16 +++++++---------
1 file changed, 7 insertions(+), 9 deletions(-)

diff --git a/tools/testing/selftests/vDSO/vdso_test_getcpu.c b/tools/testing/selftests/vDSO/vdso_test_getcpu.c
index b758f68c6c9c2..d8e247783057a 100644
--- a/tools/testing/selftests/vDSO/vdso_test_getcpu.c
+++ b/tools/testing/selftests/vDSO/vdso_test_getcpu.c
@@ -28,9 +28,12 @@ int main(int argc, char **argv)
getcpu_t get_cpu;
long ret;

+ ksft_print_header();
+ ksft_set_plan(1);
+
sysinfo_ehdr = getauxval(AT_SYSINFO_EHDR);
if (!sysinfo_ehdr) {
- printf("AT_SYSINFO_EHDR is not present!\n");
+ ksft_print_msg("AT_SYSINFO_EHDR is not present!\n");
return KSFT_SKIP;
}

@@ -38,17 +41,12 @@ int main(int argc, char **argv)

get_cpu = (getcpu_t)vdso_sym(version, name[4]);
if (!get_cpu) {
- printf("Could not find %s\n", name[4]);
+ ksft_print_msg("Could not find %s\n", name[4]);
return KSFT_SKIP;
}

ret = get_cpu(&cpu, &node, 0);
- if (ret == 0) {
- printf("Running on CPU %u node %u\n", cpu, node);
- } else {
- printf("%s failed\n", name[4]);
- return KSFT_FAIL;
- }
+ ksft_test_result(ret == 0, "Running on CPU %u node %u\n", cpu, node);

- return 0;
+ ksft_finished();
}
--
2.39.2