improve regression test error output when args aren't set

This commit is contained in:
nadavi 2021-02-22 19:01:54 +00:00
parent 561db99b30
commit bd72d72471
2 changed files with 19 additions and 6 deletions

@ -208,7 +208,7 @@ private:
{
static std::string TestDataBasePath;
if (path != "")
if (!path.empty())
{
TestDataBasePath = path;
if ((TestDataBasePath.back() != '/') && (TestDataBasePath.back() != '\\'))
@ -217,6 +217,13 @@ private:
}
}
if (TestDataBasePath.empty())
{
VTKM_LOG_S(
vtkm::cont::LogLevel::Error,
"TestDataBasePath was never set, was --data-dir set correctly? (hint: ../data/data)");
}
return TestDataBasePath;
}
@ -224,7 +231,7 @@ private:
{
static std::string RegressionTestImageBasePath;
if (path != "")
if (!path.empty())
{
RegressionTestImageBasePath = path;
if ((RegressionTestImageBasePath.back() != '/') &&
@ -234,6 +241,13 @@ private:
}
}
if (RegressionTestImageBasePath.empty())
{
VTKM_LOG_S(vtkm::cont::LogLevel::Error,
"RegressionTestImageBasePath was never set, was --baseline-dir set correctly? "
"(hint: ../data/baseline)");
}
return RegressionTestImageBasePath;
}
@ -241,7 +255,7 @@ private:
{
static std::string WriteDirBasePath;
if (path != "")
if (!path.empty())
{
WriteDirBasePath = path;
if ((WriteDirBasePath.back() != '/') && (WriteDirBasePath.back() != '\\'))

@ -73,7 +73,7 @@ inline TestEqualResult test_equal_images(const std::shared_ptr<ViewType> view,
}
catch (const vtkm::cont::ErrorExecution& error)
{
VTKM_LOG_S(vtkm::cont::LogLevel::Error, error.what());
VTKM_LOG_S(vtkm::cont::LogLevel::Error, error.GetMessage());
imageResult.PushMessage(error.GetMessage());
const std::string outputImagePath = vtkm::cont::testing::Testing::WriteDirPath(fileName);
@ -85,7 +85,7 @@ inline TestEqualResult test_equal_images(const std::shared_ptr<ViewType> view,
}
catch (const vtkm::cont::ErrorBadValue& error)
{
VTKM_LOG_S(vtkm::cont::LogLevel::Error, error.what());
VTKM_LOG_S(vtkm::cont::LogLevel::Error, error.GetMessage());
imageResult.PushMessage(error.GetMessage());
imageResult.PushMessage("Unsupported file type for image: " + fileName);
testResults.PushMessage(imageResult.GetMergedMessage());
@ -199,5 +199,4 @@ inline TestEqualResult test_equal_images_matching_name(
returnOnPass);
}
#endif // vtk_m_rendering_testing_Testing_h