* [PATCH] selftests: epoll: support KSFT_MACHINE_SLOW / KSFT_TIMEOUT_MUL
@ 2026-08-28 11:04 Florian Schmaus
0 siblings, 0 replies; only message in thread
From: Florian Schmaus @ 2026-08-28 11:04 UTC (permalink / raw)
To: Shuah Khan; +Cc: linux-kselftest, linux-kernel, Florian Schmaus
In slow or emulated environments, the hardcoded 1-second watchdog
timeout in kill_timeout() can easily expire before threads finish
scheduling and processing events, causing spurious test failures.
Add support for KSFT_MACHINE_SLOW, which is already used in kselftest,
to increase the timeout multiplier to 10x (10 seconds). Furthermore,
allow KSFT_TIMEOUT_MUL to explicitly override the multiplier.
Signed-off-by: Florian Schmaus <florian.schmaus@codasip.com>
---
.../filesystems/epoll/epoll_wakeup_test.c | 22 +++++++++++++++++++++-
1 file changed, 21 insertions(+), 1 deletion(-)
diff --git a/tools/testing/selftests/filesystems/epoll/epoll_wakeup_test.c b/tools/testing/selftests/filesystems/epoll/epoll_wakeup_test.c
index 81a994943e12..8d5b15a09439 100644
--- a/tools/testing/selftests/filesystems/epoll/epoll_wakeup_test.c
+++ b/tools/testing/selftests/filesystems/epoll/epoll_wakeup_test.c
@@ -40,9 +40,29 @@ static void signal_handler(int signum)
{
}
+static unsigned int get_timeout_multiplier(void)
+{
+ const char *mul_str = getenv("KSFT_TIMEOUT_MUL");
+ const char *slow_str = getenv("KSFT_MACHINE_SLOW");
+ unsigned int mul = 1;
+
+ if (slow_str)
+ mul = 10;
+
+ if (mul_str) {
+ int val;
+
+ val = atoi(mul_str);
+ if (val > 0)
+ mul = (unsigned int)val;
+ }
+
+ return mul;
+}
+
static void kill_timeout(struct epoll_mtcontext *ctx)
{
- usleep(1000000);
+ usleep(1000000 * get_timeout_multiplier());
pthread_kill(ctx->main, SIGUSR1);
pthread_kill(ctx->waiter, SIGUSR1);
}
---
base-commit: 1b78070aaef63512688aebfbc82365ef9d6660f1
change-id: 20260828-selftest-epoll-timeout-0d47c17beaa2
Best regards,
--
Florian Schmaus <florian.schmaus@codasip.com>
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2026-08-28 11:04 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-08-28 11:04 [PATCH] selftests: epoll: support KSFT_MACHINE_SLOW / KSFT_TIMEOUT_MUL Florian Schmaus
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®