[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH] tests/qtest/libqtest: Do not overwrite child coredump
From: |
Thomas Huth |
Subject: |
Re: [PATCH] tests/qtest/libqtest: Do not overwrite child coredump |
Date: |
Tue, 7 Jul 2020 11:03:31 +0200 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.9.0 |
On 07/07/2020 05.19, Philippe Mathieu-Daudé wrote:
> We are interested by the coredump of the child, not the qtest
> parent. If the child generated a coredump, simply call
> exit(EXIT_FAILURE) in the parent to avoid overwriting the
> child coredump.
>
> Fixes: 71a268a5fd ("tests/libqtest: Improve kill_qemu()")
> Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
> ---
> tests/qtest/libqtest.c | 7 ++++++-
> 1 file changed, 6 insertions(+), 1 deletion(-)
>
> diff --git a/tests/qtest/libqtest.c b/tests/qtest/libqtest.c
> index 49075b55a1..bd85d01145 100644
> --- a/tests/qtest/libqtest.c
> +++ b/tests/qtest/libqtest.c
> @@ -173,7 +173,12 @@ static void kill_qemu(QTestState *s)
> fprintf(stderr, "%s:%d: kill_qemu() detected QEMU death "
> "from signal %d (%s)%s\n",
> __FILE__, __LINE__, sig, signame, dump);
> - abort();
> + if (WCOREDUMP(wstatus)) {
> + /* Preserve child coredump */
> + exit(1);
> + } else {
> + abort();
> + }
> }
> }
Would it maybe rather make sense to always use exit(1) unconditionally here?
Thomas