[igt-dev] [PATCH i-g-t] runner/resultgen: Fix subtest runtimes

Mauro Carvalho Chehab mauro.chehab at linux.intel.com
Wed Dec 6 11:02:22 UTC 2023


On Thu, 30 Nov 2023 16:09:23 +0100
Kamil Konieczny <kamil.konieczny at linux.intel.com> wrote:

> From: Piotr Kira <piotr.kira at intel.com>
> 
> Runtimes for single subtest are not included in results json object
> after switching to socket communication. Make times for both subtests
> and dynamic subtests when using comms.
> 
> v2: added GitLab issue number, added Petri to Cc (Kamil)
>   reformat so it could be applied (Kamil)
> 
> Cc: Petri Latvala <adrinael at adrinael.net>
> Fixes: 9d889fa6b8f0 ("runner: Use socket communications")
> Closes: https://gitlab.freedesktop.org/drm/igt-gpu-tools/-/issues/132
> Signed-off-by: Piotr Kira <piotr.kira at intel.com>
> Signed-off-by: Kamil Konieczny <kamil.konieczny at linux.intel.com>

Didn't test it, but LGTM.

Reviewed-by: Mauro Carvalho Chehab <mchehab at kernel.org>

> ---
>  runner/resultgen.c | 7 +++++++
>  1 file changed, 7 insertions(+)
> 
> diff --git a/runner/resultgen.c b/runner/resultgen.c
> index b00bb6ba5..63f5b26d7 100644
> --- a/runner/resultgen.c
> +++ b/runner/resultgen.c
> @@ -1262,6 +1262,9 @@ struct comms_context
>  	char *subtestresult;
>  	char *dynamicsubtestresult;
>  
> +	double subtest_execution_time;
> +	double dynamic_subtest_execution_time;
> +
>  	char *cmdline;
>  	int exitcode;
>  
> @@ -1321,6 +1324,7 @@ static void comms_finish_subtest(struct comms_context *context)
>  	if (context->subtestresult == NULL)
>  		context->subtestresult = strdup("incomplete");
>  	set_result(context->current_test, context->subtestresult);
> +	add_runtime(context->current_test, context->subtest_execution_time);
>  
>  	free(context->subtestresult);
>  	context->subtestresult = NULL;
> @@ -1343,6 +1347,7 @@ static void comms_finish_dynamic_subtest(struct comms_context *context)
>  	if (context->dynamicsubtestresult == NULL)
>  		context->dynamicsubtestresult = strdup("incomplete");
>  	set_result(context->current_dynamic_subtest, context->dynamicsubtestresult);
> +	add_runtime(context->current_dynamic_subtest, context->dynamic_subtest_execution_time);
>  
>  	free(context->dynamicsubtestresult);
>  	context->dynamicsubtestresult = NULL;
> @@ -1617,6 +1622,7 @@ static bool comms_handle_subtest_result(const struct runnerpacket *packet,
>  				    strlen(helper.subtestresult.result),
>  				    &mappedresult, NULL);
>  		context->subtestresult = strdup(mappedresult);
> +		context->subtest_execution_time = strtod(helper.subtestresult.timeused, NULL);
>  	}
>  
>  	context->state = STATE_BETWEEN_SUBTESTS;
> @@ -1757,6 +1763,7 @@ static bool comms_handle_dynamic_subtest_result(const struct runnerpacket *packe
>  				    strlen(helper.dynamicsubtestresult.result),
>  				    &mappedresult, NULL);
>  		context->dynamicsubtestresult = strdup(mappedresult);
> +		context->dynamic_subtest_execution_time = strtod(helper.dynamicsubtestresult.timeused, NULL);
>  	}
>  
>  	context->state = STATE_BETWEEN_DYNAMIC_SUBTESTS;


More information about the igt-dev mailing list