* [PATCH] selftests: timers: Make sleep time in raw_skew configurable
@ 2026-07-10 2:51 Wake Liu
2026-07-10 3:04 ` John Stultz
2026-07-13 2:00 ` [PATCH v2] " Wake Liu
0 siblings, 2 replies; 4+ messages in thread
From: Wake Liu @ 2026-07-10 2:51 UTC (permalink / raw)
To: Anna-Maria Behnsen, Frederic Weisbecker, Thomas Gleixner,
John Stultz, Shuah Khan
Cc: Stephen Boyd, linux-kernel, linux-kselftest, Wake Liu
The raw_skew test currently sleeps for 120 seconds to estimate clock
drift. This is a very long time for a single test, and can cause
timeouts in automated test suites or CI systems.
Allow overriding the sleep time via a command line argument,
so it can be adjusted if needed in different environments, while
keeping the default at 120 seconds to preserve original behavior.
Signed-off-by: Wake Liu <wakel@google.com>
---
tools/testing/selftests/timers/raw_skew.c | 13 +++++++++++--
1 file changed, 11 insertions(+), 2 deletions(-)
diff --git a/tools/testing/selftests/timers/raw_skew.c b/tools/testing/selftests/timers/raw_skew.c
index a7bae7d80916..03cdcecba8f4 100644
--- a/tools/testing/selftests/timers/raw_skew.c
+++ b/tools/testing/selftests/timers/raw_skew.c
@@ -92,6 +92,15 @@ int main(int argc, char **argv)
struct timespec mon, raw, start, end;
long long delta1, delta2, interval, eppm, ppm;
struct timex tx1, tx2;
+ int sleep_sec = 120;
+
+ if (argc > 1) {
+ sleep_sec = atoi(argv[1]);
+ if (sleep_sec <= 0) {
+ printf("Invalid sleep time, using default 120s\n");
+ sleep_sec = 120;
+ }
+ }
setbuf(stdout, NULL);
@@ -109,9 +118,9 @@ int main(int argc, char **argv)
if (tx1.offset)
printf("WARNING: ADJ_OFFSET in progress, this will cause inaccurate results\n");
- printf("Estimating clock drift: ");
+ printf("Estimating clock drift (%ds): ", sleep_sec);
fflush(stdout);
- sleep(120);
+ sleep(sleep_sec);
get_monotonic_and_raw(&mon, &raw);
end = mon;
--
2.55.0.795.g602f6c329a-goog
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] selftests: timers: Make sleep time in raw_skew configurable
2026-07-10 2:51 [PATCH] selftests: timers: Make sleep time in raw_skew configurable Wake Liu
@ 2026-07-10 3:04 ` John Stultz
2026-07-13 2:06 ` Wake Liu
2026-07-13 2:00 ` [PATCH v2] " Wake Liu
1 sibling, 1 reply; 4+ messages in thread
From: John Stultz @ 2026-07-10 3:04 UTC (permalink / raw)
To: Wake Liu
Cc: Anna-Maria Behnsen, Frederic Weisbecker, Thomas Gleixner,
Shuah Khan, Stephen Boyd, linux-kernel, linux-kselftest
On Thu, Jul 9, 2026 at 7:51 PM Wake Liu <wakel@google.com> wrote:
>
> The raw_skew test currently sleeps for 120 seconds to estimate clock
> drift. This is a very long time for a single test, and can cause
> timeouts in automated test suites or CI systems.
>
Sheesh, nobody has two minutes to spare? :)
> Allow overriding the sleep time via a command line argument,
> so it can be adjusted if needed in different environments, while
> keeping the default at 120 seconds to preserve original behavior.
>
> Signed-off-by: Wake Liu <wakel@google.com>
> ---
> tools/testing/selftests/timers/raw_skew.c | 13 +++++++++++--
> 1 file changed, 11 insertions(+), 2 deletions(-)
>
> diff --git a/tools/testing/selftests/timers/raw_skew.c b/tools/testing/selftests/timers/raw_skew.c
> index a7bae7d80916..03cdcecba8f4 100644
> --- a/tools/testing/selftests/timers/raw_skew.c
> +++ b/tools/testing/selftests/timers/raw_skew.c
> @@ -92,6 +92,15 @@ int main(int argc, char **argv)
> struct timespec mon, raw, start, end;
> long long delta1, delta2, interval, eppm, ppm;
> struct timex tx1, tx2;
> + int sleep_sec = 120;
> +
> + if (argc > 1) {
> + sleep_sec = atoi(argv[1]);
> + if (sleep_sec <= 0) {
> + printf("Invalid sleep time, using default 120s\n");
> + sleep_sec = 120;
> + }
> + }
This probably needs some usage documentation so folks can discover this?
(Which may mean also supporting -h/--help)
Otherwise seems reasonable.
thanks!
-john
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH v2] selftests: timers: Make sleep time in raw_skew configurable
2026-07-10 2:51 [PATCH] selftests: timers: Make sleep time in raw_skew configurable Wake Liu
2026-07-10 3:04 ` John Stultz
@ 2026-07-13 2:00 ` Wake Liu
1 sibling, 0 replies; 4+ messages in thread
From: Wake Liu @ 2026-07-13 2:00 UTC (permalink / raw)
To: Anna-Maria Behnsen, Frederic Weisbecker, Thomas Gleixner,
John Stultz, Shuah Khan
Cc: Stephen Boyd, linux-kernel, linux-kselftest, Wake Liu
The raw_skew test currently sleeps for 120 seconds to estimate clock
drift. This is a very long time for a single test, and can cause
timeouts in automated test suites or CI systems.
Allow overriding the sleep time via a command line argument,
so it can be adjusted if needed in different environments, while
keeping the default at 120 seconds to preserve original behavior.
Also add -h/--help support to document this option.
Signed-off-by: Wake Liu <wakel@google.com>
---
tools/testing/selftests/timers/raw_skew.c | 24 +++++++++++++++++++++--
1 file changed, 22 insertions(+), 2 deletions(-)
diff --git a/tools/testing/selftests/timers/raw_skew.c b/tools/testing/selftests/timers/raw_skew.c
index a7bae7d80916..5fff3eaf1307 100644
--- a/tools/testing/selftests/timers/raw_skew.c
+++ b/tools/testing/selftests/timers/raw_skew.c
@@ -27,6 +27,7 @@
#include <time.h>
#include <include/vdso/time64.h>
#include "kselftest.h"
+#include <string.h>
#define shift_right(x, s) ({ \
__typeof__(x) __x = (x); \
@@ -87,11 +88,30 @@ void get_monotonic_and_raw(struct timespec *mon, struct timespec *raw)
}
}
+static void usage(char *argv0)
+{
+ printf("Usage: %s [sleep_secs]\n", argv0);
+ printf(" sleep_secs: time to sleep in seconds to estimate clock drift (default: 120s)\n");
+}
+
int main(int argc, char **argv)
{
struct timespec mon, raw, start, end;
long long delta1, delta2, interval, eppm, ppm;
struct timex tx1, tx2;
+ int sleep_sec = 120;
+
+ if (argc > 1) {
+ if (strcmp(argv[1], "-h") == 0 || strcmp(argv[1], "--help") == 0) {
+ usage(argv[0]);
+ ksft_exit_pass();
+ }
+ sleep_sec = atoi(argv[1]);
+ if (sleep_sec <= 0) {
+ printf("Invalid sleep time, using default 120s\n");
+ sleep_sec = 120;
+ }
+ }
setbuf(stdout, NULL);
@@ -109,9 +129,9 @@ int main(int argc, char **argv)
if (tx1.offset)
printf("WARNING: ADJ_OFFSET in progress, this will cause inaccurate results\n");
- printf("Estimating clock drift: ");
+ printf("Estimating clock drift (%ds): ", sleep_sec);
fflush(stdout);
- sleep(120);
+ sleep(sleep_sec);
get_monotonic_and_raw(&mon, &raw);
end = mon;
--
2.55.0.795.g602f6c329a-goog
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] selftests: timers: Make sleep time in raw_skew configurable
2026-07-10 3:04 ` John Stultz
@ 2026-07-13 2:06 ` Wake Liu
0 siblings, 0 replies; 4+ messages in thread
From: Wake Liu @ 2026-07-13 2:06 UTC (permalink / raw)
To: John Stultz
Cc: Anna-Maria Behnsen, Frederic Weisbecker, Thomas Gleixner,
Shuah Khan, Stephen Boyd, linux-kernel, linux-kselftest
Thanks for the review :)
I've sent out v2 which addresses this by adding -h/--help support and
usage documentation.
On Fri, Jul 10, 2026 at 11:04 AM John Stultz <jstultz@google.com> wrote:
>
> On Thu, Jul 9, 2026 at 7:51 PM Wake Liu <wakel@google.com> wrote:
> >
> > The raw_skew test currently sleeps for 120 seconds to estimate clock
> > drift. This is a very long time for a single test, and can cause
> > timeouts in automated test suites or CI systems.
> >
>
> Sheesh, nobody has two minutes to spare? :)
>
> > Allow overriding the sleep time via a command line argument,
> > so it can be adjusted if needed in different environments, while
> > keeping the default at 120 seconds to preserve original behavior.
> >
> > Signed-off-by: Wake Liu <wakel@google.com>
> > ---
> > tools/testing/selftests/timers/raw_skew.c | 13 +++++++++++--
> > 1 file changed, 11 insertions(+), 2 deletions(-)
> >
> > diff --git a/tools/testing/selftests/timers/raw_skew.c b/tools/testing/selftests/timers/raw_skew.c
> > index a7bae7d80916..03cdcecba8f4 100644
> > --- a/tools/testing/selftests/timers/raw_skew.c
> > +++ b/tools/testing/selftests/timers/raw_skew.c
> > @@ -92,6 +92,15 @@ int main(int argc, char **argv)
> > struct timespec mon, raw, start, end;
> > long long delta1, delta2, interval, eppm, ppm;
> > struct timex tx1, tx2;
> > + int sleep_sec = 120;
> > +
> > + if (argc > 1) {
> > + sleep_sec = atoi(argv[1]);
> > + if (sleep_sec <= 0) {
> > + printf("Invalid sleep time, using default 120s\n");
> > + sleep_sec = 120;
> > + }
> > + }
>
> This probably needs some usage documentation so folks can discover this?
> (Which may mean also supporting -h/--help)
>
> Otherwise seems reasonable.
>
> thanks!
> -john
--
Best Regards,
Wake Liu
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2026-07-13 2:07 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-07-10 2:51 [PATCH] selftests: timers: Make sleep time in raw_skew configurable Wake Liu
2026-07-10 3:04 ` John Stultz
2026-07-13 2:06 ` Wake Liu
2026-07-13 2:00 ` [PATCH v2] " Wake Liu
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox