selftests: timers: clocksource-switch: adapt to kselftest framework
authorWolfram Sang <wsa+renesas@sang-engineering.com>
Wed, 13 Jul 2022 20:46:21 +0000 (22:46 +0200)
committerShuah Khan <skhan@linuxfoundation.org>
Thu, 14 Jul 2022 20:36:52 +0000 (14:36 -0600)
So we have proper counters at the end of a test. We also print the
kselftest header at the end of the test, so we don't mix with the output
of the child process. There is only this one test anyhow.

Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
Acked-by: John Stultz <jstultz@google.com>
Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
tools/testing/selftests/timers/clocksource-switch.c

index 577e4b74211af6a61598aba1bbe7e155d5cbc931..c5264594064c8516e2186f9f21a087456e9bc9ae 100644 (file)
@@ -183,7 +183,9 @@ int main(int argc, char **argv)
 out:
        change_clocksource(orig_clk);
 
-       if (status)
-               return ksft_exit_fail();
-       return ksft_exit_pass();
+       /* Print at the end to not mix output with child process */
+       ksft_print_header();
+       ksft_set_plan(1);
+       ksft_test_result(!status, "clocksource-switch\n");
+       ksft_exit(!status);
 }