different strack traces for different machines

This commit is contained in:
nadavi 2019-08-28 18:14:07 -06:00
parent effef1b6ec
commit ac0faa3d97
2 changed files with 14 additions and 4 deletions

@ -50,7 +50,8 @@ public:
// For std::exception compatibility:
const char* what() const noexcept override
{
return (this->Message + "\n" + this->StackTrace).c_str();
std::string tmp = this->Message + "\n" + this->StackTrace;
return tmp.c_str();
}
/// Returns true if this exception is device independent. For exceptions that

@ -32,7 +32,8 @@ void RecursiveFunction(int recurse)
void ValidateError(const vtkm::cont::Error& error)
{
std::string message = "Too much recursion";
std::stringstream stackTraceStream(error.GetStackTrace());
std::string stackTrace = error.GetStackTrace();
std::stringstream stackTraceStream(stackTrace);
std::string tmp;
size_t count = 0;
while (std::getline(stackTraceStream, tmp))
@ -40,9 +41,17 @@ void ValidateError(const vtkm::cont::Error& error)
count++;
}
// StackTrace may be unavailable on certain Devices
if (stackTrace == "(Stack trace unavailable)")
{
VTKM_TEST_ASSERT(count == 1, "Logging disabled, stack trace shouldn't be available");
}
else
{
VTKM_TEST_ASSERT(count > 11, "StackTrace did not recurse enough");
}
VTKM_TEST_ASSERT(test_equal(message, error.GetMessage()), "Message was incorrect");
VTKM_TEST_ASSERT(count > 11, "StackTrace did not recurse enough");
VTKM_TEST_ASSERT(test_equal(message + "\n" + error.GetStackTrace(), std::string(error.what())),
VTKM_TEST_ASSERT(test_equal(message + "\n" + stackTrace, std::string(error.what())),
"what() was incorrect");
}