Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

selftests/watchdog-test: Fix system accidentally reset after watchdog-test

When running watchdog-test with 'make run_tests', the watchdog-test will
be terminated by a timeout signal(SIGTERM) due to the test timemout.

And then, a system reboot would happen due to watchdog not stop. see
the dmesg as below:
```
[ 1367.185172] watchdog: watchdog0: watchdog did not stop!
```

Fix it by registering more signals(including SIGTERM) in watchdog-test,
where its signal handler will stop the watchdog.

After that
# timeout 1 ./watchdog-test
Watchdog Ticking Away!
.
Stopping watchdog ticks...

Link: https://lore.kernel.org/all/20241029031324.482800-1-lizhijian@fujitsu.com/
Signed-off-by: Li Zhijian <lizhijian@fujitsu.com>
Reviewed-by: Shuah Khan <skhan@linuxfoundation.org>
Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>

authored by

Li Zhijian and committed by
Shuah Khan
dc1308be 722d89c3

+6
+6
tools/testing/selftests/watchdog/watchdog-test.c
··· 334 334 335 335 printf("Watchdog Ticking Away!\n"); 336 336 337 + /* 338 + * Register the signals 339 + */ 337 340 signal(SIGINT, term); 341 + signal(SIGTERM, term); 342 + signal(SIGKILL, term); 343 + signal(SIGQUIT, term); 338 344 339 345 while (1) { 340 346 keep_alive();