[PATCH] support: Add support_record_failure_barrier

Adhemerval Zanella Netto adhemerval.zanella@linaro.org
Mon Dec 23 12:56:12 GMT 2024



On 19/11/24 10:11, Florian Weimer wrote:
> This can be used to stop execution after a TEST_COMPARE_BLOB
> failure, for example.
> 

LGTM, thanks.

Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>

> ---
>  support/check.h                  |  3 +++
>  support/support_record_failure.c | 10 ++++++++++
>  2 files changed, 13 insertions(+)
> 
> diff --git a/support/check.h b/support/check.h
> index 7ea22c7a2c..8f41e5b99f 100644
> --- a/support/check.h
> +++ b/support/check.h
> @@ -207,6 +207,9 @@ void support_record_failure_reset (void);
>     failures or not.  */
>  int support_record_failure_is_failed (void);
>  
> +/* Terminate the process if any failures have been encountered so far.  */
> +void support_record_failure_barrier (void);
> +
>  __END_DECLS
>  
>  #endif /* SUPPORT_CHECK_H */
> diff --git a/support/support_record_failure.c b/support/support_record_failure.c
> index 978123701d..72ee2b232f 100644
> --- a/support/support_record_failure.c
> +++ b/support/support_record_failure.c
> @@ -112,3 +112,13 @@ support_record_failure_is_failed (void)
>       synchronization for reliable test error reporting anyway.  */
>    return __atomic_load_n (&state->failed, __ATOMIC_RELAXED);
>  }
> +
> +void
> +support_record_failure_barrier (void)
> +{
> +  if (__atomic_load_n (&state->failed, __ATOMIC_RELAXED))
> +    {
> +      puts ("error: exiting due to previous errors");
> +      exit (1);
> +    }
> +}
> 
> base-commit: 7f045c0b48633b198b42bebdff0024d7cfab3901
> 



More information about the Libc-alpha mailing list