[FFmpeg-devel] tests/checkasm/checkasm: Provide verbose failure information on float_near_abs_eps() failures

Submitted by Michael Niedermayer on April 13, 2018, 12:34 a.m.

Details

Message ID 20180413003401.28202-1-michael@niedermayer.cc
State New
Headers show

Commit Message

Michael Niedermayer April 13, 2018, 12:34 a.m.
This will make understanding failures and adjusting EPS easier

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
---
 tests/checkasm/checkasm.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

Comments

James Almer April 13, 2018, 3:19 a.m.
On 4/12/2018 9:34 PM, Michael Niedermayer wrote:
> This will make understanding failures and adjusting EPS easier
> 
> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
> ---
>  tests/checkasm/checkasm.c | 6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)
> 
> diff --git a/tests/checkasm/checkasm.c b/tests/checkasm/checkasm.c
> index 20ce56932f..8a3e24f100 100644
> --- a/tests/checkasm/checkasm.c
> +++ b/tests/checkasm/checkasm.c
> @@ -294,8 +294,12 @@ int float_near_ulp_array(const float *a, const float *b, unsigned max_ulp,
>  int float_near_abs_eps(float a, float b, float eps)
>  {
>      float abs_diff = fabsf(a - b);
> +    if (abs_diff < eps)
> +        return 1;
>  
> -    return abs_diff < eps;
> +    fprintf(stderr, "test failed comparing %f with %f (abs diff=%f with EPS=%f)\n", a, b, abs_diff, eps);

Maybe %g instead? I may be better to print small values, but I'm not
sure. LGTM in any case.

A few tests also output a custom log message like this one, so it may be
a good idea to remove them now that it's done in general.

> +
> +    return 0;
>  }
>  
>  int float_near_abs_eps_array(const float *a, const float *b, float eps,
>
Michael Niedermayer April 14, 2018, 12:21 p.m.
On Fri, Apr 13, 2018 at 12:19:38AM -0300, James Almer wrote:
> On 4/12/2018 9:34 PM, Michael Niedermayer wrote:
> > This will make understanding failures and adjusting EPS easier
> > 
> > Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
> > ---
> >  tests/checkasm/checkasm.c | 6 +++++-
> >  1 file changed, 5 insertions(+), 1 deletion(-)
> > 
> > diff --git a/tests/checkasm/checkasm.c b/tests/checkasm/checkasm.c
> > index 20ce56932f..8a3e24f100 100644
> > --- a/tests/checkasm/checkasm.c
> > +++ b/tests/checkasm/checkasm.c
> > @@ -294,8 +294,12 @@ int float_near_ulp_array(const float *a, const float *b, unsigned max_ulp,
> >  int float_near_abs_eps(float a, float b, float eps)
> >  {
> >      float abs_diff = fabsf(a - b);
> > +    if (abs_diff < eps)
> > +        return 1;
> >  
> > -    return abs_diff < eps;
> > +    fprintf(stderr, "test failed comparing %f with %f (abs diff=%f with EPS=%f)\n", a, b, abs_diff, eps);
> 
> Maybe %g instead? I may be better to print small values, but I'm not
> sure. LGTM in any case.

%g is a good idea, ill change it to that


> 
> A few tests also output a custom log message like this one, so it may be
> a good idea to remove them now that it's done in general.

agree, not sure which messages exactly you mean though

will apply so we can easily gather more information about some failures

thanks

[...]
James Almer April 14, 2018, 1:27 p.m.
On 4/14/2018 9:21 AM, Michael Niedermayer wrote:
> On Fri, Apr 13, 2018 at 12:19:38AM -0300, James Almer wrote:
>> On 4/12/2018 9:34 PM, Michael Niedermayer wrote:
>>> This will make understanding failures and adjusting EPS easier
>>>
>>> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
>>> ---
>>>  tests/checkasm/checkasm.c | 6 +++++-
>>>  1 file changed, 5 insertions(+), 1 deletion(-)
>>>
>>> diff --git a/tests/checkasm/checkasm.c b/tests/checkasm/checkasm.c
>>> index 20ce56932f..8a3e24f100 100644
>>> --- a/tests/checkasm/checkasm.c
>>> +++ b/tests/checkasm/checkasm.c
>>> @@ -294,8 +294,12 @@ int float_near_ulp_array(const float *a, const float *b, unsigned max_ulp,
>>>  int float_near_abs_eps(float a, float b, float eps)
>>>  {
>>>      float abs_diff = fabsf(a - b);
>>> +    if (abs_diff < eps)
>>> +        return 1;
>>>  
>>> -    return abs_diff < eps;
>>> +    fprintf(stderr, "test failed comparing %f with %f (abs diff=%f with EPS=%f)\n", a, b, abs_diff, eps);
>>
>> Maybe %g instead? I may be better to print small values, but I'm not
>> sure. LGTM in any case.
> 
> %g is a good idea, ill change it to that
> 
> 
>>
>> A few tests also output a custom log message like this one, so it may be
>> a good idea to remove them now that it's done in general.
> 
> agree, not sure which messages exactly you mean though
> 
> will apply so we can easily gather more information about some failures

The synth filter test prints a custom error message similar to the one
you're adding, and other modules probably do the same. I'll see about
removing them now that this is printed by float_near_abs_eps() itself.

> 
> thanks
> 
> [...]
> 
> 
> 
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>

Patch hide | download patch | download mbox

diff --git a/tests/checkasm/checkasm.c b/tests/checkasm/checkasm.c
index 20ce56932f..8a3e24f100 100644
--- a/tests/checkasm/checkasm.c
+++ b/tests/checkasm/checkasm.c
@@ -294,8 +294,12 @@  int float_near_ulp_array(const float *a, const float *b, unsigned max_ulp,
 int float_near_abs_eps(float a, float b, float eps)
 {
     float abs_diff = fabsf(a - b);
+    if (abs_diff < eps)
+        return 1;
 
-    return abs_diff < eps;
+    fprintf(stderr, "test failed comparing %f with %f (abs diff=%f with EPS=%f)\n", a, b, abs_diff, eps);
+
+    return 0;
 }
 
 int float_near_abs_eps_array(const float *a, const float *b, float eps,