Commit 7508d0ac authored by Cory Quammen's avatar Cory Quammen Committed by Kitware Robot

Merge topic 'fix_tecplotreader_tests'

99eb9d4a Merge branch 'master' into 'fix_tecplotreader_tests'
f94c37a5 Update CMakeLists.txt
d6d6e330 Fix the TestTecplotReader2 tests to use whitelisted files
Acked-by: Kitware Robot's avatarKitware Robot <kwrobot@kitware.com>
Acked-by: Cory Quammen's avatarCory Quammen <cory.quammen@kitware.com>
Merge-request: !6133
parents 87096296 99eb9d4a
Pipeline #153249 running with stage
......@@ -17,13 +17,51 @@ vtk_add_test_cxx(vtkIOGeometryCxxTests tests
TestOpenFOAMReaderRegEx.cxx,NO_VALID
TestProStarReader.cxx
TestTecplotReader.cxx
TestTecplotReader2.cxx,NO_VALID
TestAMRReadWrite.cxx,NO_VALID
TestSimplePointsReaderWriter.cxx,NO_VALID
TestHoudiniPolyDataWriter.cxx,NO_VALID
UnitTestSTLWriter.cxx,NO_VALID
)
LIST(APPEND tecplotFiles
3dgeom.dat
block_febrick_3d.dat
block_fetet_3d.dat
channel.dat
crystal_plot.dat
cube.dat
cylinder_3d.dat
cylinder_slice.dat
cylindrical.dat
ell.dat
humanoid_quad.dat
humanoid_tri.dat
movie.dat
multzn2d.dat
plane_slice.dat
point_febrick_3d_01.dat
point_febrick_3d_02.dat
point_fequad_2d.dat
point_fetet_3d.dat
point_fetri_2d_01.dat
point_fetri_2d_03.dat
simp3dbk.dat
simp3dpt.dat
simpscat.dat
simpxy.dat
simpxy2.dat
tecplot_fepolygon.dat
tecplot_fepolyhedron.dat
tiny.dat
)
foreach(item IN LISTS tecplotFiles)
get_filename_component(name "${item}" NAME_WE)
vtk_add_test_cxx(vtkIOGeometryCxxTests tests
TestTecplotReader2_${name},TestTecplotReader2.cxx ${item} NO_VALID NO_OUTPUT)
endforeach()
vtk_add_test_cxx(vtkIOGeometryCxxTests tests
TestSTLReaderSinglePatch,TestSTLReader.cxx DATA{${_vtk_build_TEST_INPUT_DATA_DIRECTORY}/Data/42400-IDGH.stl}
)
......
......@@ -72,62 +72,48 @@ string vtkErrorObserver::ErrorMessage = string();
int TestTecplotReader2(int argc, char* argv[])
{
char* dataRoot = vtkTestUtilities::GetDataRoot(argc, argv);
string tecplotDir = string(dataRoot) + "/Data/TecPlot/";
const string tecplotDir = string(dataRoot) + "/Data/TecPlot/";
vtkNew<vtkDirectory> dir;
if (1 != dir->Open(tecplotDir.c_str()))
if (argc < 2)
{
cerr << "Unable to list files in " << tecplotDir << endl;
return EXIT_FAILURE;
return EXIT_SUCCESS;
}
const char* filename = argv[1];
vtkNew<vtkCallbackCommand> cmd;
cmd->SetCallback(&(vtkErrorObserver::OnError));
int nErrors(0);
for (int i = 0; i < dir->GetNumberOfFiles(); ++i)
const string ext = vtksys::SystemTools::GetFilenameLastExtension(filename);
if (ext != ".dat")
{
string filename = tecplotDir;
filename += dir->GetFile(i);
string ext = vtksys::SystemTools::GetFilenameLastExtension(filename);
if (ext != ".dat")
{
continue;
}
vtkErrorObserver::Reset();
vtkNew<vtkTecplotReader> r;
r->AddObserver("ErrorEvent", cmd);
r->SetFileName(filename.c_str());
r->Update();
r->RemoveAllObservers();
vtkMultiBlockDataSet* ds = r->GetOutput();
if (ds == nullptr)
{
cerr << "Failed to read data set from " << filename << endl;
return EXIT_FAILURE;
}
if (vtkErrorObserver::HasError)
{
nErrors++;
cerr << "Failed to read from " << filename << endl;
if (!vtkErrorObserver::ErrorMessage.empty())
{
cerr << "Error message: " << vtkErrorObserver::ErrorMessage << endl;
}
}
return EXIT_FAILURE;
}
if (nErrors > 0)
vtkErrorObserver::Reset();
vtkNew<vtkTecplotReader> r;
r->AddObserver("ErrorEvent", cmd);
r->SetFileName((tecplotDir + filename).c_str());
r->Update();
r->RemoveAllObservers();
vtkMultiBlockDataSet* ds = r->GetOutput();
if (ds == nullptr)
{
cerr << nErrors << "/" << dir->GetNumberOfFiles() << " files could not be loaded" << endl;
cerr << "Failed to read data set from " << filename << endl;
return EXIT_FAILURE;
}
else
if (vtkErrorObserver::HasError)
{
cout << dir->GetNumberOfFiles() << " files were loaded without errors." << endl;
cerr << "Failed to read from " << filename << endl;
if (!vtkErrorObserver::ErrorMessage.empty())
{
cerr << "Error message: " << vtkErrorObserver::ErrorMessage << endl;
}
return EXIT_FAILURE;
}
cout << filename << " was read without errors." << endl;
delete[] dataRoot;
return nErrors > 0 ? EXIT_FAILURE : EXIT_SUCCESS;
return EXIT_SUCCESS;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment