Message ID | 20240712073045.110014-2-usama.anjum@collabora.com (mailing list archive) |
---|---|
State | Changes Requested |
Headers | show |
Series | [1/2] selftests: x86: vdso_restorer: remove manual counting of pass/fail tests | expand |
On 7/12/24 01:30, Muhammad Usama Anjum wrote: > Return correct exit status, KSFT_SKIP if the pre-conditions aren't met. > Return KSFT_FAIL if error occurs. Use ksft_finished() which will > compmare the total planned tests with passed tests to return the exit > value. > > Signed-off-by: Muhammad Usama Anjum <usama.anjum@collabora.com> Same comment - here. Include before and after output to show how this change improves the report. thanks, -- Shuah
On 7/17/24 3:01 AM, Shuah Khan wrote: > On 7/12/24 01:30, Muhammad Usama Anjum wrote: >> Return correct exit status, KSFT_SKIP if the pre-conditions aren't met. >> Return KSFT_FAIL if error occurs. Use ksft_finished() which will >> compmare the total planned tests with passed tests to return the exit >> value. >> >> Signed-off-by: Muhammad Usama Anjum <usama.anjum@collabora.com> > > Same comment - here. Include before and after output to show > how this change improves the report. Following results have been generated in the case when both tests fail: # selftests: x86: vdso_restorer_32 # ERROR: ld.so: object '/usr/libexec/coreutils/libstdbuf.so' from LD_PRELOAD cannot be preloaded (wrong ELF class: ELFCLASS64): ignored. # [RUN] Raise a signal, SA_SIGINFO, sa.restorer == NULL # [FAIL] SA_SIGINFO handler was not called # [RUN] Raise a signal, !SA_SIGINFO, sa.restorer == NULL # [FAIL] !SA_SIGINFO handler was not called not ok 21 selftests: x86: vdso_restorer_32 # exit=2 # selftests: x86: vdso_restorer_32 # ERROR: ld.so: object '/usr/libexec/coreutils/libstdbuf.so' from LD_PRELOAD cannot be preloaded (wrong ELF class: ELFCLASS64): ignored. # TAP version 13 # 1..2 # [RUN] Raise a signal, SA_SIGINFO, sa.restorer == NULL # not ok 1 SA_SIGINFO handler returned # [RUN] Raise a signal, !SA_SIGINFO, sa.restorer == NULL # not ok 2 SA_SIGINFO handler returned # # Totals: pass:0 fail:2 xfail:0 xpass:0 skip:0 error:0 not ok 21 selftests: x86: vdso_restorer_32 # exit=1 Please let me know what you think? > > thanks, > -- Shuah > >
diff --git a/tools/testing/selftests/x86/vdso_restorer.c b/tools/testing/selftests/x86/vdso_restorer.c index 8e173d71291f6..54f33e8cda5cc 100644 --- a/tools/testing/selftests/x86/vdso_restorer.c +++ b/tools/testing/selftests/x86/vdso_restorer.c @@ -56,7 +56,7 @@ int main() RTLD_LAZY | RTLD_LOCAL | RTLD_NOLOAD); if (!vdso) { printf("[SKIP]\tFailed to find vDSO. Tests are not expected to work.\n"); - return 0; + return KSFT_SKIP; } ksft_set_plan(2); @@ -69,7 +69,7 @@ int main() printf("[RUN]\tRaise a signal, SA_SIGINFO, sa.restorer == NULL\n"); if (syscall(SYS_rt_sigaction, SIGUSR1, &sa, NULL, 8) != 0) - err(1, "raw rt_sigaction syscall"); + err(KSFT_FAIL, "raw rt_sigaction syscall"); raise(SIGUSR1); @@ -80,10 +80,12 @@ int main() sa.flags = 0; sa.handler = handler_without_siginfo; if (syscall(SYS_sigaction, SIGUSR1, &sa, 0) != 0) - err(1, "raw sigaction syscall"); + err(KSFT_FAIL, "raw sigaction syscall"); handler_called = 0; raise(SIGUSR1); ksft_test_result(handler_called, "SA_SIGINFO handler returned\n"); + + ksft_finished(); }
Return correct exit status, KSFT_SKIP if the pre-conditions aren't met. Return KSFT_FAIL if error occurs. Use ksft_finished() which will compmare the total planned tests with passed tests to return the exit value. Signed-off-by: Muhammad Usama Anjum <usama.anjum@collabora.com> --- tools/testing/selftests/x86/vdso_restorer.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)