Test TeuchosCore_TypeConversions_UnitTest_MPI_1 fails with failed asSave<double> conversion in all white/ride builds and CUDA hansen/shiller builds
Created by: bartlettroscoe
CC: @trilinos/teuchos, @nmhamster, @mhoemmen
Next Action Status
Merged PR #2409 and #2429 fixed test in all current ATDM Builds of Trilinos on 3/21/2018.
Description
The test TeuchosCore_TypeConversions_UnitTest_MPI_1
fails in all of the gnu
and cuda
builds on white
and ride
as shown at:
All of these show failures for an invalid saveAs<double>()
conversion to thrown an exception in the test asSafe_stringToReal_UnitTest
showing:
Test that code {valD = asSafe<double> (os.str ());} throws std::range_error: failed (code did not throw an exception at all)
Test that code {valD = asSafe<double> (os.str ());} throws std::range_error: failed (code did not throw an exception at all)
The test code that is failing looks to be:
TEUCHOS_UNIT_TEST( asSafe, stringToReal ) {
...
const long double minLD = -std::numeric_limits<long double>::max ();
const long double minusOneLD = -1;
const long double maxLD = std::numeric_limits<long double>::max ();
...
if (sizeof (long double) > sizeof (double)) {
{
std::ostringstream os;
os.precision (36);
os << minLD;
TEST_THROW(valD = asSafe<double> (os.str ()), std::range_error);
}
{
std::ostringstream os;
os.precision (36);
os << maxLD;
TEST_THROW(valD = asSafe<double> (os.str ()), std::range_error);
}
}
...
So it looks like that on this system and GCC compiler that even though the type long double
appears to exist and is larger than double
it seems that the code that implements safeAs<double>()
is not catching this invalid conversion.
Steps to Reproduce
This can be reproduced on white
or ride
as described at:
Just enable the Teuchos package and run the tests for any of the supported builds on white
or ride
. For example, try the build gnu-debug-openmp
.