diff mbox series

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

Message ID 20241029031324.482800-1-lizhijian@fujitsu.com (mailing list archive)
State Accepted
Headers show
Series selftests/watchdog-test: Fix system accidentally reset after watchdog-test | expand

Commit Message

Li Zhijian Oct. 29, 2024, 3:13 a.m. UTC
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...

Signed-off-by: Li Zhijian <lizhijian@fujitsu.com>
---
 tools/testing/selftests/watchdog/watchdog-test.c | 6 ++++++
 1 file changed, 6 insertions(+)

Comments

Shuah Khan Oct. 29, 2024, 3:39 a.m. UTC | #1
On 10/28/24 21:13, Li Zhijian wrote:
> 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...
> 
> Signed-off-by: Li Zhijian <lizhijian@fujitsu.com>
> ---
>   tools/testing/selftests/watchdog/watchdog-test.c | 6 ++++++
>   1 file changed, 6 insertions(+)
> 
> diff --git a/tools/testing/selftests/watchdog/watchdog-test.c b/tools/testing/selftests/watchdog/watchdog-test.c
> index bc71cbca0dde..a1f506ba5578 100644
> --- a/tools/testing/selftests/watchdog/watchdog-test.c
> +++ b/tools/testing/selftests/watchdog/watchdog-test.c
> @@ -334,7 +334,13 @@ int main(int argc, char *argv[])
>   
>   	printf("Watchdog Ticking Away!\n");
>   
> +	/*
> +	 * Register the signals
> +	 */
>   	signal(SIGINT, term);
> +	signal(SIGTERM, term);
> +	signal(SIGKILL, term);
> +	signal(SIGQUIT, term);
>   
>   	while (1) {
>   		keep_alive();


Thank you applied to kselftest fixes for next rc.

thanks,
-- Shuah
diff mbox series

Patch

diff --git a/tools/testing/selftests/watchdog/watchdog-test.c b/tools/testing/selftests/watchdog/watchdog-test.c
index bc71cbca0dde..a1f506ba5578 100644
--- a/tools/testing/selftests/watchdog/watchdog-test.c
+++ b/tools/testing/selftests/watchdog/watchdog-test.c
@@ -334,7 +334,13 @@  int main(int argc, char *argv[])
 
 	printf("Watchdog Ticking Away!\n");
 
+	/*
+	 * Register the signals
+	 */
 	signal(SIGINT, term);
+	signal(SIGTERM, term);
+	signal(SIGKILL, term);
+	signal(SIGQUIT, term);
 
 	while (1) {
 		keep_alive();