Updating testing

This commit is contained in:
James 2020-03-11 13:37:52 -04:00
parent 3ef10a6cb4
commit 7a73b0f547
11 changed files with 25 additions and 40 deletions

@ -103,10 +103,10 @@ function(vtkm_unit_tests)
list(APPEND vtkm_default_test_log_level "-v" "INFO")
# Add the path to the data directory so tests can find and use data files for testing
list(APPEND VTKm_UT_TEST_ARGS "--data-dir=${VTKm_SOURCE_DIR}/data")
list(APPEND VTKm_UT_TEST_ARGS "--data-dir=${VTKm_SOURCE_DIR}/data/data")
# Add the path to the location where regression test images are to be stored
list(APPEND VTKm_UT_TEST_ARGS "--baseline-dir=${VTKm_SOURCE_DIR}")
list(APPEND VTKm_UT_TEST_ARGS "--baseline-dir=${VTKm_SOURCE_DIR}/data/baseline")
if(VTKm_UT_MPI)
# for MPI tests, suffix test name and add MPI_Init/MPI_Finalize calls.

3
data/data.readme Normal file

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:9fa8928893e3a34e24a6d675f66001df373c51657f9c5acb9606950e6e7f0b65
size 456

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:8c23821f7436bce6d71593698e3cb0047752b4dd671513f8c4e961d4489f199f
size 12110311

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:9a178b29073f2aa0d15375b07d0bdd28369422a352b5dcb5155cf67aebe54bbc
size 286099

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:9dc63465d864ec7a4546f1d006ca0153a5bb4c78fd4a42d16ad1177dabc70d75
size 80263

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:dca8105bf888e67a9fe476a563d69ac708925aec519814fb520c6057e5ca0a1f
size 1327116

@ -14,8 +14,6 @@
#include <vtkm/cont/Error.h>
#include <vtkm/cont/Initialize.h>
#include <vtkm/cont/internal/OptionParser.h>
#include <vtkm/cont/internal/OptionParser.h>
#include <vtkm/cont/internal/OptionParser.h>
#include <vtkm/testing/Testing.h>
#include <vtkm/thirdparty/diy/Configure.h>
@ -40,8 +38,8 @@ namespace testing
enum TestOptionsIndex
{
TEST_UNKNOWN,
DATADIR, // base dir containing test data files
IMGDIR // base dir for saving regression test images
DATADIR, // base dir containing test data files
BASELINEDIR // base dir for regression test images
};
struct TestVtkmArg : public opt::Arg
@ -100,11 +98,11 @@ struct TestVtkmArg : public opt::Arg
struct Testing
{
public:
static VTKM_CONT const std::string GetTestDataBasePath() { return setAndGetTestDataBasePath(); }
static VTKM_CONT const std::string GetTestDataBasePath() { return SetAndGetTestDataBasePath(); }
static VTKM_CONT const std::string GetRegressionTestImageBasePath()
{
return setAndGetRegressionImageBasePath();
return SetAndGetRegressionImageBasePath();
}
template <class Func>
@ -177,7 +175,7 @@ public:
}
private:
static std::string& setAndGetTestDataBasePath(std::string path = "")
static std::string& SetAndGetTestDataBasePath(std::string path = "")
{
static std::string TestDataBasePath;
@ -187,7 +185,7 @@ private:
return TestDataBasePath;
}
static std::string& setAndGetRegressionImageBasePath(std::string path = "")
static std::string& SetAndGetRegressionImageBasePath(std::string path = "")
{
static std::string RegressionTestImageBasePath;
@ -212,7 +210,7 @@ private:
"<data-dir-path> \tPath to the "
"base data directory in the VTK-m "
"src dir." });
usage.push_back({ IMGDIR,
usage.push_back({ BASELINEDIR,
0,
"baseline",
"baseline-dir",
@ -229,7 +227,7 @@ private:
// Remove argv[0] (executable name) if present:
int vtkmArgc = argc > 0 ? argc - 1 : 0;
char** vtkmArgv = vtkmArgc > 0 ? argv + 1 : argv;
char** vtkmArgv = argc > 0 ? argv + 1 : argv;
opt::Stats stats(usage.data(), vtkmArgc, vtkmArgv);
std::unique_ptr<opt::Option[]> options{ new opt::Option[stats.options_max] };
@ -244,34 +242,24 @@ private:
if (options[DATADIR])
{
setAndGetTestDataBasePath(options[DATADIR].arg);
SetAndGetTestDataBasePath(options[DATADIR].arg);
}
if (options[IMGDIR])
if (options[BASELINEDIR])
{
setAndGetRegressionImageBasePath(options[IMGDIR].arg);
SetAndGetRegressionImageBasePath(options[BASELINEDIR].arg);
}
for (const opt::Option* opt = options[TEST_UNKNOWN]; opt != nullptr; opt = opt->next())
{
VTKM_LOG_S(vtkm::cont::LogLevel::Info,
"Unknown option to internal Initialize: " << opt->name << "\n");
if ((InitializeOptions::ErrorOnBadOption) != InitializeOptions::None)
{
std::cerr << "Unknown internal option: " << opt->name << std::endl;
exit(1);
}
}
for (int nonOpt = 0; nonOpt < parse.nonOptionsCount(); ++nonOpt)
{
VTKM_LOG_S(vtkm::cont::LogLevel::Info,
"Unknown argument to internal Initialize: " << parse.nonOption(nonOpt) << "\n");
if ((InitializeOptions::ErrorOnBadArgument) != InitializeOptions::None)
{
std::cerr << "Unknown internal argument: " << parse.nonOption(nonOpt) << std::endl;
exit(1);
}
}
}
}

@ -35,32 +35,26 @@ void RenderTests()
colorTable.AddPointAlpha(0.0, .01f);
colorTable.AddPointAlpha(1.0, .01f);
vtkm::cont::DataSet rectDS, regDS;
vtkm::cont::DataSet rectDS, unsDS;
std::string basePath = vtkm::cont::testing::Testing::GetTestDataBasePath();
std::string rectfname = basePath + "/magField.vtk";
std::string regfname = basePath + "/magField.vtk";
std::string rectfname = basePath + "/rectilinear/noise.vtk";
vtkm::io::reader::VTKDataSetReader rectReader(rectfname);
vtkm::io::reader::VTKDataSetReader regReader(regfname);
try
{
rectDS = rectReader.ReadDataSet();
regDS = regReader.ReadDataSet();
}
catch (vtkm::io::ErrorIO& e)
{
std::string message("Error reading: ");
message += rectfname;
message += ", and ";
message += regfname;
message += ", ";
message += e.GetMessage();
VTKM_TEST_FAIL(message.c_str());
}
vtkm::rendering::testing::Render<M, C, V3>(regDS, "vec_magnitude", colorTable, "reg3D.pnm");
vtkm::rendering::testing::Render<M, C, V3>(rectDS, "vec_magnitude", colorTable, "rect3D.pnm");
vtkm::rendering::testing::Render<M, C, V3>(rectDS, "hardyglobal", colorTable, "rect3D.pnm");
}
} //namespace