AudioTaperPotTest.ScaleTest fails, but values are equal

Bug #1810495 reported by David Runge
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Mixxx
Fix Released
High
Daniel Schürmann

Bug Description

Hi!

During building of the package for Arch Linux of mixxx 2.2.0, I have one failing test:

```
[----------] 1 test from AudioTaperPotTest
[ RUN ] AudioTaperPotTest.ScaleTest
Loading resources from "/build/mixxx/src/mixxx-2.2.0/res/"
src/test/audiotaperpot_test.cpp:23: Failure
Value of: catpb.parameterToValue(1)
  Actual: 1.99526
Expected: db2ratio(maxDB)
Which is: 1.99526
[ FAILED ] AudioTaperPotTest.ScaleTest (0 ms)
[----------] 1 test from AudioTaperPotTest (0 ms total)
```

It's a bit puzzling, as the values seem equal.
The full test log can be found in attachment and the PKGBUILD can be found here (might only be showing the 2.2.0 build in a couple of hours, as I'm on the road right now): https://git.archlinux.org/svntogit/community.git/tree/trunk/PKGBUILD?h=packages/mixxx

Packages are built using a pristine systemd-nspawn container on each iteration and currently I'm building on a Lenovo W540 (which has a Intel(R) Core(TM) i7-4700MQ CPU @ 2.40GHz - that's a Haswell), in case that's of interest to you.

Tags: easy unittest
Revision history for this message
David Runge (dvzrv) wrote :
Revision history for this message
Daniel Schürmann (daschuer) wrote :

I think we need to replace ASSERT_EQ by ASSERT_DOUBLE_EQ in line 23

Changed in mixxx:
status: New → Confirmed
importance: Undecided → High
milestone: none → 2.1.7
tags: added: easy
Changed in mixxx:
assignee: nobody → Daniel Schürmann (daschuer)
status: Confirmed → In Progress
Revision history for this message
Daniel Schürmann (daschuer) wrote :

A PR is here:
https://github.com/mixxxdj/mixxx/pull/1979

Can you confirm that this fixes your issue?

Revision history for this message
David Runge (dvzrv) wrote :

@daschuer, thanks for the quick reply.
Unfortunately, even after applying the patch the same error was triggered for me :-/

Revision history for this message
Daniel Schürmann (daschuer) wrote :

Ok, so we need a wider ellipsis.
I will change the code to something like
abbs(a-b) < 0.00001
It it would be interesting how big the difference is though.

Revision history for this message
Daniel Schürmann (daschuer) wrote :

I have update the PR for
ASSERT_NEAR((db2ratio(maxDB), catpb.parameterToValue(1), 1e-10);

Please check.

Thank you.

Revision history for this message
David Runge (dvzrv) wrote :

Will do!
You have introduced a leading '(' in that commit btw.

Revision history for this message
David Runge (dvzrv) wrote :

After removing the superfluous '(' from the commit, I still get this:

```
[----------] 1 test from AudioTaperPotTest
[ RUN ] AudioTaperPotTest.ScaleTest
Loading resources from "/build/mixxx/src/mixxx-2.2.0/res/"
src/test/audiotaperpot_test.cpp:44: Failure
Value of: catpb.parameterToValue(1)
  Actual: 1.99526
Expected: db2ratio(maxDB)
Which is: 1.99526
[ FAILED ] AudioTaperPotTest.ScaleTest (1 ms)
[----------] 1 test from AudioTaperPotTest (1 ms total)
```

Revision history for this message
Daniel Schürmann (daschuer) wrote :

please change it to:
ASSERT_EQ(db2ratio(maxDB) - catpb.parameterToValue(1), 0);

and post the output.

It looks like the compiler optimizes some fractional places away. Maybe we suffer a float precision overflow. Which compiler version do you use?
Do we have a bug? Normally ASSERT_DOUBLE_EQ should work. mmm

Revision history for this message
David Runge (dvzrv) wrote :

Alright, here it is:

```
[----------] 1 test from AudioTaperPotTest
[ RUN ] AudioTaperPotTest.ScaleTest
Loading resources from "/build/mixxx/src/mixxx-2.2.0/res/"
src/test/audiotaperpot_test.cpp:23: Failure
Value of: 0
Expected: db2ratio(maxDB) - catpb.parameterToValue(1)
Which is: -2.22045e-16
[ FAILED ] AudioTaperPotTest.ScaleTest (0 ms)
[----------] 1 test from AudioTaperPotTest (0 ms total)
```

On Arch Linux we're currently at gcc 8.2.1 (should've mentioned that earlier, sorry).

Revision history for this message
Daniel Schürmann (daschuer) wrote :

Thank you.
It is strange because abs(-2.22045e-16) is smaller than 1e-10.

IMHO this should work:
ASSERT_NEAR((db2ratio(maxDB), catpb.parameterToValue(1), 1e-10);

Do you have an idea what went wrong?

Revision history for this message
Ferran Pujol (ferranpujol) wrote :

I can't reproduce the original failing test on Ubuntu 18.10.
I built with the same settings and gcc 8.2.0

Revision history for this message
Daniel Schürmann (daschuer) wrote :

I cannot confirm this either so lets wait until one can confirm the issue.

Revision history for this message
Daniel Schürmann (daschuer) wrote :

Thank you for your tests.

Revision history for this message
Daniel Schürmann (daschuer) wrote :

@dvzrv: did you have more test results for us? See #11.

Changed in mixxx:
milestone: 2.1.7 → 2.2.1
Revision history for this message
Daniel Schürmann (daschuer) wrote :

Any updates?

Changed in mixxx:
status: In Progress → Incomplete
Revision history for this message
David Runge (dvzrv) wrote :

@daschuer: Sorry, but it took me some time to get back to this. Mixxx is a little extreme to build, as I can't separate building from testing the application. Scons rebuilds everything in every target :(

Anyways, same problem with whatever was proposed in #11:

```
[----------] 1 test from AudioTaperPotTest
[ RUN ] AudioTaperPotTest.ScaleTest
src/test/audiotaperpot_test.cpp:44: Failure
Value of: catpb.parameterToValue(1)
  Actual: 1.99526
Expected: db2ratio(maxDB)
Which is: 1.99526
[ FAILED ] AudioTaperPotTest.ScaleTest (1 ms)
[----------] 1 test from AudioTaperPotTest (1 ms total)
```

Also, our reproducible build pipeline has the same issue as initially reported:
https://tests.reproducible-builds.org/archlinux/community/mixxx/build1.log

Revision history for this message
Daniel Schürmann (daschuer) wrote :

@dvzrv: Ah, got it. The second fail was in line 44 not 23.
Now I have fixed some more places by using ASSERT_DOUBLE_EQ,

This allows +-4 integer minimal steps. One minimal steps matches the reported -2.22045e-16,
Please retest.

Changed in mixxx:
status: Incomplete → Fix Committed
Changed in mixxx:
status: Fix Committed → Fix Released
Revision history for this message
Swiftb0y (swiftb0y) wrote :

Mixxx now uses GitHub for bug tracking. This bug has been migrated to:
https://github.com/mixxxdj/mixxx/issues/9562

lock status: Metadata changes locked and limited to project staff
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Bug attachments

Remote bug watches

Bug watches keep track of this bug in other bug trackers.