[PATCH i-g-t 1/1] lib/igt_core: capture logs for child processes

Kamil Konieczny kamil.konieczny at linux.intel.com
Mon Mar 24 11:05:05 UTC 2025


Hi Pawel,
On 2025-03-21 at 11:07:34 +0100, Pawel Sikora wrote:
> On Mon, Mar 17, 2025 at 05:39:07PM +0100, Kamil Konieczny wrote:
> > Hi Pawel,
> > On 2025-03-13 at 13:50:04 +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.
> > > 
> > > Signed-off-by: Pawel Sikora <pawel.sikora at linux.intel.com>

After offline discussion I decided to merge this v1 with Closes
and r-b from Zbigniew. Thank you all for spotting this bug and
for fixing this.

Regards,
Kamil

> > > ---
> > >  lib/igt_core.c | 5 ++---
> > >  1 file changed, 2 insertions(+), 3 deletions(-)
> > > 
> > > diff --git a/lib/igt_core.c b/lib/igt_core.c
> > > index 9702a9417..33e5ca7cd 100644
> > > --- a/lib/igt_core.c
> > > +++ b/lib/igt_core.c
> > > @@ -1905,12 +1905,11 @@ void igt_fail(int exitcode)
> > >  		failed_one = true;
> > >  	}
> > >  
> > > -	/* Silent exit, parent will do the yelling. */
> > > +	_igt_log_buffer_dump();
> > > +
> > 
> > Can it be a conditional? As I remember this was a problem with
> > logs line interleaving one with another and it was solved by
> > igt_runner using comms, so I propose to use this only when comms
> > are active, see 8a3dc4020 lib/igt_core: Send logs to runner with comms
> > 
> > For example:
> > 	/* If igt_runner uses comms it could grab each childs logs
> > 	 * without them interleaving in stdout/stderr.
> > 	 */
> > 	has_comms = runner_connected();
> > 	if (has_comms)
> > 		_igt_log_buffer_dump();
> > 
> >   	if (test_child)
> >   		exit(exitcode);
> > 
> > 	if (!has_comms)
> > 		_igt_log_buffer_dump();
> > 
> > This will fix it for igt_runner with comms, leaving old behaviour
> > when no comms were used.
> > This is suggestion, if you do not like it at least add a comment
> > why was it added there.
> > 
> > Also I add Petri to Cc.
> > 
> 
> Seems fine to me. Will check it and add in v2.
> 
> Regards,
> Pawel
> 
> > Regards,
> > Kamil
> > 
> > >  	if (test_child)
> > >  		exit(exitcode);
> > >  
> > > -	_igt_log_buffer_dump();
> > > -
> > >  	if (test_multi_fork_child)
> > >  		exit(exitcode);
> > >  
> > > -- 
> > > 2.34.1
> > > 


More information about the igt-dev mailing list