[LTP] [PATCH v2] Terminate leftover subprocesses when main test process crashes

Cyril Hrubis chrubis@suse.cz
Fri Feb 11 13:55:23 CET 2022


Hi!
> --- a/lib/tst_test.c
> +++ b/lib/tst_test.c
> @@ -1495,6 +1495,9 @@ static int fork_testrun(void)
>  		return TFAIL;
>  	}
>  
> +	if (tst_test->forks_child)
> +		kill(-test_pid, SIGKILL);
> +

Maybe we can even print a message here if the kill() returns with 0,
which would mean that there were any leftover child processes killed.

Either way this is a nice and clean solution:

Reviewed-by: Cyril Hrubis <chrubis@suse.cz>

>  	if (WIFEXITED(status) && WEXITSTATUS(status))
>  		return WEXITSTATUS(status);
>  
> -- 
> 2.34.1
> 
> 
> -- 
> Mailing list info: https://lists.linux.it/listinfo/ltp

-- 
Cyril Hrubis
chrubis@suse.cz


More information about the ltp mailing list