mbox series

[0/9] selftests: timers: fixes and improvements

Message ID 20220713204623.5443-1-wsa+renesas@sang-engineering.com
Headers show
Series selftests: timers: fixes and improvements | expand

Message

Wolfram Sang July 13, 2022, 8:46 p.m. UTC
The timer selftests are quite useful for me when enabling timers on new
SoCs, e.g. like now with the CMT timer on a Renesas R-Car S4-8. During
development, I needed these fixes and additions to make full use of
the tests. I think they make all sense upstream, so here they are.

Patches are based on v5.19-rc1. Looking forward to comments.

Happy hacking,

   Wolfram


Wolfram Sang (9):
  selftests: timers: valid-adjtimex: build fix for newer toolchains
  selftests: timers: fix declarations of main()
  selftests: timers: nanosleep: adapt to kselftest framework
  selftests: timers: inconsistency-check: adapt to kselftest framework
  selftests: timers: clocksource-switch: fix passing errors from child
  selftests: timers: clocksource-switch: sort includes
  selftests: timers: clocksource-switch: add command line switch to skip
    sanity check
  selftests: timers: clocksource-switch: add 'runtime' command line
    parameter
  selftests: timers: clocksource-switch: adapt to kselftest framework

 tools/testing/selftests/timers/adjtick.c      |  2 +-
 tools/testing/selftests/timers/change_skew.c  |  2 +-
 .../selftests/timers/clocksource-switch.c     | 70 ++++++++++++-------
 .../selftests/timers/inconsistency-check.c    | 32 +++++----
 tools/testing/selftests/timers/nanosleep.c    | 18 +++--
 tools/testing/selftests/timers/raw_skew.c     |  2 +-
 .../selftests/timers/skew_consistency.c       |  2 +-
 .../testing/selftests/timers/valid-adjtimex.c |  2 +-
 8 files changed, 80 insertions(+), 50 deletions(-)

Comments

John Stultz July 13, 2022, 9:05 p.m. UTC | #1
On Wed, Jul 13, 2022 at 1:46 PM Wolfram Sang
<wsa+renesas@sang-engineering.com> wrote:
>
> So the user can decide how long the test should run.
>
> Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
> ---
>  tools/testing/selftests/timers/clocksource-switch.c | 8 ++++++--
>  1 file changed, 6 insertions(+), 2 deletions(-)
>
> diff --git a/tools/testing/selftests/timers/clocksource-switch.c b/tools/testing/selftests/timers/clocksource-switch.c
> index 5256e6215980..a1d0d33738b6 100644
> --- a/tools/testing/selftests/timers/clocksource-switch.c
> +++ b/tools/testing/selftests/timers/clocksource-switch.c
> @@ -124,14 +124,18 @@ int main(int argc, char **argv)
>         char orig_clk[512];
>         int count, i, status, opt;
>         int do_sanity_check = 1;
> +       int runtime = 60;
>         pid_t pid;
>
>         /* Process arguments */
> -       while ((opt = getopt(argc, argv, "s")) != -1) {
> +       while ((opt = getopt(argc, argv, "st:")) != -1) {
>                 switch (opt) {
>                 case 's':
>                         do_sanity_check = 0;
>                         break;
> +               case 't':
> +                       runtime = atoi(optarg);
> +                       break;
>                 default:
>                         printf("Usage: %s [-s]\n", argv[0]);
>                         printf("        -s: skip sanity checks\n");

Ah, one minor nit:  Should the -t option get documented here in the
usage output?

thanks again!
-john
Shuah Khan July 13, 2022, 11:56 p.m. UTC | #2
On 7/13/22 3:02 PM, John Stultz wrote:
> On Wed, Jul 13, 2022 at 1:46 PM Wolfram Sang
> <wsa+renesas@sang-engineering.com> wrote:
>>
>> The timer selftests are quite useful for me when enabling timers on new
>> SoCs, e.g. like now with the CMT timer on a Renesas R-Car S4-8. During
>> development, I needed these fixes and additions to make full use of
>> the tests. I think they make all sense upstream, so here they are.
>>
>> Patches are based on v5.19-rc1. Looking forward to comments.
>>
> 
> Hey!
>    Thanks so much I really appreciate the effort to make and send out
> these cleanups. From the initial skim it all looks great (though, some
> are slightly embarrassing :), and I think some of the extra config
> args will be quite nice for others to use as well.
> 
> Acked-by: John Stultz <jstultz@google.com>
> 
> Thanks so much for submitting these.
> -john
> 

Thank you both. I can queue these for 5.20-rc1

Wolfram, are you going to send v2 to address John's comment on
8/9?

thanks,
-- Shuah
Sergey Shtylyov July 14, 2022, 8:27 a.m. UTC | #3
Hello!

On 7/13/22 11:46 PM, Wolfram Sang wrote:

> So the user can decide how long the test should run.
> 
> Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
> ---
>  tools/testing/selftests/timers/clocksource-switch.c | 8 ++++++--
>  1 file changed, 6 insertions(+), 2 deletions(-)
> 
> diff --git a/tools/testing/selftests/timers/clocksource-switch.c b/tools/testing/selftests/timers/clocksource-switch.c
> index 5256e6215980..a1d0d33738b6 100644
> --- a/tools/testing/selftests/timers/clocksource-switch.c
> +++ b/tools/testing/selftests/timers/clocksource-switch.c
[...]
> -	while ((opt = getopt(argc, argv, "s")) != -1) {
> +	while ((opt = getopt(argc, argv, "st:")) != -1) {
>  		switch (opt) {
>  		case 's':
>  			do_sanity_check = 0;
>  			break;
> +		case 't':
> +			runtime = atoi(optarg);
> +			break;
>  		default:
>  			printf("Usage: %s [-s]\n", argv[0]);
>  			printf("	-s: skip sanity checks\n");

   Hm, you probably forgot to update the usage msg?

[...]

MBR, Sergey
Wolfram Sang July 14, 2022, 11:32 a.m. UTC | #4
> >  		default:
> >  			printf("Usage: %s [-s]\n", argv[0]);
> >  			printf("	-s: skip sanity checks\n");
> 
>    Hm, you probably forgot to update the usage msg?

Yup, thanks!
Wolfram Sang July 14, 2022, 6:43 p.m. UTC | #5
> Wolfram, are you going to send v2 to address John's comment on
> 8/9?

Yes, will do!