[i-g-t,1/1] runner/executor: sync outputs after tests end

Knop, Ryszard ryszard.knop at intel.com
Wed Apr 9 13:57:11 UTC 2025


LGTM:

Reviewed-by: Ryszard Knop <ryszard.knop at intel.com>

On Wed, 2025-04-09 at 14:55 +0200, Kamil Konieczny wrote:
> We observe that sometimes tests are reported as incomplete after
> a crash and there are more such incompletes before a one that
> caused actual crash. It turns out that there were missing ends
> of tests dmesg logs gathered in a test subdirectory. After cross
> checks with a global dmesg log saved outside of igt_runner, it
> seems that all tests before crushed one properly reported its end
> to kernel kmsg.
> 
>   Try to remediate this and create additional syncs for logs just
> after end of execution, with additional syncs for directories.
> 
> Cc: Krzysztof Karas <krzysztof.karas at intel.com>
> Cc: Peter Senna Tschudin <peter.senna at linux.intel.com>
> Signed-off-by: Kamil Konieczny <kamil.konieczny at linux.intel.com>
> ---
>  runner/executor.c | 17 ++++++++++++++++-
>  1 file changed, 16 insertions(+), 1 deletion(-)
> 
> diff --git a/runner/executor.c b/runner/executor.c
> index 30e2420af..69227a5f2 100644
> --- a/runner/executor.c
> +++ b/runner/executor.c
> @@ -615,6 +615,16 @@ void close_outputs(int *fds)
>  	}
>  }
>  
> +void fsync_outputs(int *fds)
> +{
> +	int i;
> +
> +	for (i = 0; i < _F_LAST; i++) {
> +		if (fds[i] >= 0)
> +			fsync(fds[i]);
> +	}
> +}
> +
>  const char *get_out_filename(int fid)
>  {
>  	if (fid >= 0 && fid < _F_LAST)
> @@ -1871,14 +1881,19 @@ static int execute_next_entry(struct execute_state *state,
>  out_kmsgfd:
>  	close(kmsgfd);
>  out_pipe:
> -	close_outputs(outputs);
>  	close(outpipe[0]);
>  	close(outpipe[1]);
>  	close(errpipe[0]);
>  	close(errpipe[1]);
> +	if (settings->sync)
> +		fsync_outputs(outputs);
>  	close_outputs(outputs);
>  out_dirfd:
> +	if (settings->sync)
> +		fsync(dirfd);
>  	close(dirfd);
> +	if (settings->sync)
> +		fsync(resdirfd);
>  
>  	return result;
>  }


More information about the igt-dev mailing list