Linux Kernel Selftest development
 help / color / mirror / Atom feed
From: Wake Liu <wakel@google.com>
To: Anna-Maria Behnsen <anna-maria@linutronix.de>,
	Frederic Weisbecker <frederic@kernel.org>,
	 Thomas Gleixner <tglx@kernel.org>,
	John Stultz <jstultz@google.com>, Shuah Khan <shuah@kernel.org>
Cc: Stephen Boyd <sboyd@kernel.org>,
	linux-kernel@vger.kernel.org,  linux-kselftest@vger.kernel.org,
	Wake Liu <wakel@google.com>
Subject: [PATCH] selftests: timers: Make sleep time in raw_skew configurable
Date: Fri, 10 Jul 2026 02:51:44 +0000	[thread overview]
Message-ID: <20260710025144.2000000-1-wakel@google.com> (raw)

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


             reply	other threads:[~2026-07-10  2:51 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-10  2:51 Wake Liu [this message]
2026-07-10  3:04 ` [PATCH] selftests: timers: Make sleep time in raw_skew configurable John Stultz
2026-07-13  2:06   ` Wake Liu
2026-07-13  2:00 ` [PATCH v2] " Wake Liu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260710025144.2000000-1-wakel@google.com \
    --to=wakel@google.com \
    --cc=anna-maria@linutronix.de \
    --cc=frederic@kernel.org \
    --cc=jstultz@google.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=sboyd@kernel.org \
    --cc=shuah@kernel.org \
    --cc=tglx@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox