Skip to content

Commit e8cfc52

Browse files
Akhilesh Patilshuahkh
authored andcommitted
selftests: watchdog: skip ping loop if WDIOF_KEEPALIVEPING not supported
Check if watchdog device supports WDIOF_KEEPALIVEPING option before entering keep_alive() ping test loop. Fix watchdog-test silently looping if ioctl based ping is not supported by the device. Exit from test in such case instead of getting stuck in loop executing failing keep_alive() watchdog_info: identity: m41t93 rtc Watchdog firmware_version: 0 Support/Status: Set timeout (in seconds) Support/Status: Watchdog triggers a management or other external alarm not a reboot Watchdog card disabled. Watchdog timeout set to 5 seconds. Watchdog ping rate set to 2 seconds. Watchdog card enabled. WDIOC_KEEPALIVE not supported by this device without this change Watchdog card disabled. Watchdog timeout set to 5 seconds. Watchdog ping rate set to 2 seconds. Watchdog card enabled. Watchdog Ticking Away! (Where test stuck here forver silently) Updated change log at commit time: Shuah Khan <skhan@linuxfoundation.org> Link: https://lore.kernel.org/r/20250914152840.GA3047348@bhairav-test.ee.iitb.ac.in Fixes: d89d08f ("selftests: watchdog: Fix ioctl SET* error paths to take oneshot exit path") Signed-off-by: Akhilesh Patil <akhilesh@ee.iitb.ac.in> Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
1 parent f83ec76 commit e8cfc52

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

tools/testing/selftests/watchdog/watchdog-test.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -332,6 +332,12 @@ int main(int argc, char *argv[])
332332
if (oneshot)
333333
goto end;
334334

335+
/* Check if WDIOF_KEEPALIVEPING is supported */
336+
if (!(info.options & WDIOF_KEEPALIVEPING)) {
337+
printf("WDIOC_KEEPALIVE not supported by this device\n");
338+
goto end;
339+
}
340+
335341
printf("Watchdog Ticking Away!\n");
336342

337343
/*

0 commit comments

Comments
 (0)