Bug 1882

Summary: int64x64 tests trigger valgrind bug
Product: ns-3 Reporter: Peter Barnes <pdbarnes>
Component: coreAssignee: Mathieu Lacage <mathieu.lacage>
Status: RESOLVED FIXED    
Severity: normal CC: ns-bugs, tomh, tommaso.pecorella
Priority: P5    
Version: ns-3-dev   
Hardware: All   
OS: All   

Description Peter Barnes 2014-03-14 15:36:14 UTC
int64x64 test suite fails under valgrind, passes on normal builds.

The failing test case is for conversions to/from double.  The int64x64_t implementation uses long double internally to do the conversion.  Note that many long double implementations have 64 bits (or less!) of mantissa, so it is impossible to do bit-accurate Q64.64 conversions on numbers with integer parts.

The test case uses std::numeric_limits<long double>::epsilon () to tailor the expected values to the claimed numeric precision.

valgrind coerces all long doubles to mere doubles:
http://valgrind.org/docs/manual/manual-core.html#manual-core.limits

Despite numerous requests, 
https://bugs.kde.org/﷒0﷓

the maintainer is apparently extremely reluctant to fix it.

Looking for workaround.
Comment 1 Peter Barnes 2014-03-14 15:41:06 UTC
An example valgrind failure:
https://ns-buildmaster.ee.washington.edu:8010/job/Daily-with-valgrind/label=Ubuntu-64-13.10/481/consoleFull

Search for "--test-name=int64x64" in the command string reported by valgrind
Comment 2 Tom Henderson 2014-03-14 16:39:40 UTC
I'm assuming that once the patch for bug 1880 is applied, there will be no valgrind errors but there will be lingering test failures?

Could the tests that trigger valgrind issues be factored out to a different test suite that is added to core_valgrind_skip_tests in test.py?
Comment 3 Peter Barnes 2014-03-14 16:43:20 UTC
After 1880, the test with valgrind won't crash, but it will fail under valgrind.

The failure occurs because valgrind changes the effective precision, without updating epsilon().  I'm looking into adjusting the expected precision if we detect valgrind, so the test will pass.

(In reply to Tom Henderson from comment #2)
> I'm assuming that once the patch for bug 1880 is applied, there will be no
> valgrind errors but there will be lingering test failures?
> 
> Could the tests that trigger valgrind issues be factored out to a different
> test suite that is added to core_valgrind_skip_tests in test.py?
Comment 4 Peter Barnes 2014-03-14 18:35:14 UTC
Patch r10661 06fbdb895376
http://code.nsnam.org/ns-3-dev/rev/06fbdb895376

Holding off on resolving to see buildbot valgrind error clear.
Comment 5 Tommaso Pecorella 2014-03-29 03:40:56 UTC
Buildbot valgrind is clear.