Linux Kernel Selftest development
 help / color / mirror / Atom feed
* [PATCH v2 resend] selftests: timers: clocksource-switch: Adapt progress to kselftest framework
@ 2024-12-12  9:02 Geert Uytterhoeven
  2024-12-16 23:08 ` Shuah Khan
  0 siblings, 1 reply; 2+ messages in thread
From: Geert Uytterhoeven @ 2024-12-12  9:02 UTC (permalink / raw)
  To: John Stultz, Thomas Gleixner, Stephen Boyd, Anna-Maria Behnsen,
	Frederic Weisbecker, Shuah Khan, Wolfram Sang
  Cc: linux-kselftest, linux-kernel, Geert Uytterhoeven

When adapting the test to the kselftest framework, a few printf() calls
indicating test progress were not updated.

Fix this by replacing these printf() calls by ksft_print_msg() calls.

Fixes: ce7d101750ff8450 ("selftests: timers: clocksource-switch: adapt to kselftest framework")
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Reviewed-by: Thomas Gleixner <tglx@linutronix.de>
---
v2:
  - Add Reviewed-by.

When just running the test, the output looks like:

    # Validating clocksource arch_sys_counter
    TAP version 13
    1..12
    ok 1 CLOCK_REALTIME
    ...
    # Validating clocksource ffca0000.timer
    TAP version 13
    1..12
    ok 1 CLOCK_REALTIME
    ...

When redirecting the test output to a file, the progress prints are not
interspersed with the test output, but collated at the end:

    TAP version 13
    1..12
    ok 1 CLOCK_REALTIME
    ...
    TAP version 13
    1..12
    ok 1 CLOCK_REALTIME
    ...
    # Totals: pass:6 fail:0 xfail:0 xpass:0 skip:6 error:0
    # Validating clocksource arch_sys_counter
    # Validating clocksource ffca0000.timer
    ...

This makes it hard to match the test results with the timer under test.
Is there a way to fix this?  The test does use fork().

Thanks!
---
 tools/testing/selftests/timers/clocksource-switch.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/tools/testing/selftests/timers/clocksource-switch.c b/tools/testing/selftests/timers/clocksource-switch.c
index c5264594064c8516..83faa4e354e389c2 100644
--- a/tools/testing/selftests/timers/clocksource-switch.c
+++ b/tools/testing/selftests/timers/clocksource-switch.c
@@ -156,8 +156,8 @@ int main(int argc, char **argv)
 	/* Check everything is sane before we start switching asynchronously */
 	if (do_sanity_check) {
 		for (i = 0; i < count; i++) {
-			printf("Validating clocksource %s\n",
-				clocksource_list[i]);
+			ksft_print_msg("Validating clocksource %s\n",
+					clocksource_list[i]);
 			if (change_clocksource(clocksource_list[i])) {
 				status = -1;
 				goto out;
@@ -169,7 +169,7 @@ int main(int argc, char **argv)
 		}
 	}
 
-	printf("Running Asynchronous Switching Tests...\n");
+	ksft_print_msg("Running Asynchronous Switching Tests...\n");
 	pid = fork();
 	if (!pid)
 		return run_tests(runtime);
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH v2 resend] selftests: timers: clocksource-switch: Adapt progress to kselftest framework
  2024-12-12  9:02 [PATCH v2 resend] selftests: timers: clocksource-switch: Adapt progress to kselftest framework Geert Uytterhoeven
@ 2024-12-16 23:08 ` Shuah Khan
  0 siblings, 0 replies; 2+ messages in thread
From: Shuah Khan @ 2024-12-16 23:08 UTC (permalink / raw)
  To: Geert Uytterhoeven, John Stultz, Thomas Gleixner, Stephen Boyd,
	Anna-Maria Behnsen, Frederic Weisbecker, Shuah Khan, Wolfram Sang
  Cc: linux-kselftest, linux-kernel

On 12/12/24 02:02, Geert Uytterhoeven wrote:
> When adapting the test to the kselftest framework, a few printf() calls
> indicating test progress were not updated.
> 
> Fix this by replacing these printf() calls by ksft_print_msg() calls.
> 
> Fixes: ce7d101750ff8450 ("selftests: timers: clocksource-switch: adapt to kselftest framework")
> Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
> Reviewed-by: Thomas Gleixner <tglx@linutronix.de>
> ---
> v2:
>    - Add Reviewed-by.
> 
> When just running the test, the output looks like:
> 
>      # Validating clocksource arch_sys_counter
>      TAP version 13
>      1..12
>      ok 1 CLOCK_REALTIME
>      ...
>      # Validating clocksource ffca0000.timer
>      TAP version 13
>      1..12
>      ok 1 CLOCK_REALTIME
>      ...
> 
> When redirecting the test output to a file, the progress prints are not
> interspersed with the test output, but collated at the end:
> 
>      TAP version 13
>      1..12
>      ok 1 CLOCK_REALTIME
>      ...
>      TAP version 13
>      1..12
>      ok 1 CLOCK_REALTIME
>      ...
>      # Totals: pass:6 fail:0 xfail:0 xpass:0 skip:6 error:0
>      # Validating clocksource arch_sys_counter
>      # Validating clocksource ffca0000.timer
>      ...
> 
> This makes it hard to match the test results with the timer under test.
> Is there a way to fix this?  The test does use fork().
> 
> Thanks!
> ---
>   tools/testing/selftests/timers/clocksource-switch.c | 6 +++---
>   1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/tools/testing/selftests/timers/clocksource-switch.c b/tools/testing/selftests/timers/clocksource-switch.c
> index c5264594064c8516..83faa4e354e389c2 100644
> --- a/tools/testing/selftests/timers/clocksource-switch.c
> +++ b/tools/testing/selftests/timers/clocksource-switch.c
> @@ -156,8 +156,8 @@ int main(int argc, char **argv)
>   	/* Check everything is sane before we start switching asynchronously */
>   	if (do_sanity_check) {
>   		for (i = 0; i < count; i++) {
> -			printf("Validating clocksource %s\n",
> -				clocksource_list[i]);
> +			ksft_print_msg("Validating clocksource %s\n",
> +					clocksource_list[i]);
>   			if (change_clocksource(clocksource_list[i])) {
>   				status = -1;
>   				goto out;
> @@ -169,7 +169,7 @@ int main(int argc, char **argv)
>   		}
>   	}
>   
> -	printf("Running Asynchronous Switching Tests...\n");
> +	ksft_print_msg("Running Asynchronous Switching Tests...\n");
>   	pid = fork();
>   	if (!pid)
>   		return run_tests(runtime);

Applied to linux-kselftest next for Linux 6.14-rc1.

thanks,
-- Shuah

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2024-12-16 23:08 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-12-12  9:02 [PATCH v2 resend] selftests: timers: clocksource-switch: Adapt progress to kselftest framework Geert Uytterhoeven
2024-12-16 23:08 ` Shuah Khan

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox