[PATCH i-g-t v3 1/1] lib/igt_core: capture logs for child processes
Kamil Konieczny
kamil.konieczny at linux.intel.com
Fri Mar 21 18:28:20 UTC 2025
Hi Pawel,
On 2025-03-21 at 13:03:44 +0100, Pawel Sikora wrote:
> This change addresses the issue of missing logs for child
> processes in the IGT runner.
>
> The '_igt_log_buffer_dump()' function is now called before
> exiting child processes, ensuring that logs are properly
> captured and not lost when IGT fails and child processes
> dump logs before exiting.
>
> v2: Make the dump conditional based on active comms (Kamil)
>
> Closes: https://gitlab.freedesktop.org/drm/xe/kernel/-/issues/2178
>
Remove empty line here.
> Reviewed-by: Zbigniew Kempczyński <zbigniew.kempczynski at intel.com>
> Signed-off-by: Pawel Sikora <pawel.sikora at linux.intel.com>
> ---
> lib/igt_core.c | 11 +++++++++--
> 1 file changed, 9 insertions(+), 2 deletions(-)
>
> diff --git a/lib/igt_core.c b/lib/igt_core.c
> index c19689a51..512d88437 100644
> --- a/lib/igt_core.c
> +++ b/lib/igt_core.c
> @@ -296,6 +296,7 @@ static bool in_fixture = false;
> static bool test_with_subtests = false;
> static bool in_atexit_handler = false;
> static bool show_ftrace = false;
> +static bool has_comms = false;
> static enum {
> CONT = 0, SKIP, FAIL
> } skip_subtests_henceforth = CONT;
> @@ -1905,11 +1906,17 @@ void igt_fail(int exitcode)
> failed_one = true;
> }
>
> - /* Silent exit, parent will do the yelling. */
> + /* If igt_runner uses comms, it could grab each child's logs without
> + * them interleaving in stdout/stderr. */
I just realised that there is another _child exit after if(!has_comms)...
What about dropping those runner_connected() if's and just dump it
unconditionally here? Let the user cope with non-runner runs?
So imho we could have new comment like above and here:
_igt_log_buffer_dump();
What is you opinion Zbigniew?
Regards,
Kamil
> + has_comms = runner_connected();
> + if (has_comms)
> + _igt_log_buffer_dump();
> +
> if (test_child)
> exit(exitcode);
>
> - _igt_log_buffer_dump();
> + if (!has_comms)
> + _igt_log_buffer_dump();
>
> if (test_multi_fork_child)
> exit(exitcode);
> --
> 2.34.1
>
More information about the igt-dev
mailing list