test-watchdog: use watchdog_runtime_wait() to determine sleep interval

As sugggested in
https://github.com/systemd/systemd/issues/22001#issuecomment-1006755438.
This commit is contained in:
Mike Gilbert 2022-01-06 14:09:30 -05:00
parent cd933f14bd
commit 788c2d9523

View file

@ -27,12 +27,13 @@ int main(int argc, char *argv[]) {
t = 0;
for (i = 0; i < count; i++) {
t = watchdog_runtime_wait();
log_info("Sleeping " USEC_FMT " microseconds...", t);
usleep(t);
log_info("Pinging...");
r = watchdog_ping();
if (r < 0)
log_warning_errno(r, "Failed to ping watchdog: %m");
usleep(t/2);
}
watchdog_close(true);