[Piglit] [PATCH] util: keep track of failures in subtests

Jose Fonseca jfonseca at vmware.com
Tue Mar 3 04:55:35 PST 2015


On 26/02/15 16:06, Martin Peres wrote:
> ---
>   tests/util/piglit-util.c | 17 +++++++++++++++++
>   1 file changed, 17 insertions(+)
>
> diff --git a/tests/util/piglit-util.c b/tests/util/piglit-util.c
> index b094625..b5bd89f 100644
> --- a/tests/util/piglit-util.c
> +++ b/tests/util/piglit-util.c
> @@ -273,6 +273,20 @@ piglit_set_timeout(double seconds, enum piglit_result timeout_result)
>   #endif
>   }
>


> +static bool _piglit_subtests_all_passed = true;
> +
> +bool piglit_subtests_all_passed()
> +{
> +	return _piglit_subtests_all_passed;
> +}
> +
> +bool piglit_subtests_all_passed_reset()
> +{
> +	bool ret = _piglit_subtests_all_passed;
> +	_piglit_subtests_all_passed = true;
> +	return ret;
> +}
> +
>   void
>   piglit_report_subtest_result(enum piglit_result result, const char *format, ...)
>   {
> @@ -287,6 +301,9 @@ piglit_report_subtest_result(enum piglit_result result, const char *format, ...)
>   	fflush(stdout);
>
>   	va_end(ap);
> +
> +	if (result == PIGLIT_FAIL)
> +		_piglit_subtests_all_passed = false;
>   }
>
>   #ifdef _WIN32
>

Sorry for the delay.  This looks good overall, though it might be better 
to change the interface to use enum piglit_result instead of bool, so 
that it eventually it handles WARP/SKIP better (eg., if all subtests 
SKIP, then report SKIP).




BTW, is it really true that if one subtest fails, the overall test 
should be false?  For example, when I was looking at 
iglit_report_subtest_result callers, I noticed that 
tests/spec/amd_performance_monitor/api.c will not report false overall, 
even though may report true.


Maybe a simpler approach would be to the piglit/framework to handle this 
universally.



Jose






More information about the Piglit mailing list