As a comment when creating a plugin test case:
In addition to https://gitlab.kitware.com/vtk/vtk/-/blob/master/Documentation/dev/git/data.md on shall not forget in the plugin’s CMakeLists.txt a
if (BUILD_TESTING)
add_subdirectory(Testing)
endif ()
I could not make the GmshIO example run, as both make GmshIO and ctest -R GmshIO fail. However, it works for GMVReader.
My test was running, when I run the recording manually. As a test case with external data I have an issue.
I have
ExternalData_Expand_Arguments(ParaViewData _
"DATA{${CMAKE_CURRENT_SOURCE_DIR}/Data/openCFS/Single_Region_Opt.cfs}"
"DATA{${CMAKE_CURRENT_SOURCE_DIR}/Data/Baseline/Single_Region_Opt_last_PSD.png}"
)
But that gave me the following error on make
SHA512/106137f13bae250b692fb8f6f221de6821fb66ac01ae6b27b371dde0431d6a3953cea8f09f606e4fd01053dd47a7873f82f070f28444b5613e1ed6700b34f182
-- Linked Plugins/CFSReader/Testing/Data/Baseline/Single_Region_Opt_last_PSD.png.sha512 to ExternalData SHA512/09b9b43589921733ac06af33f71b1230c4118e99f4ba641c3d49accf27af37bf7684b5f247157e03395f0e762f39f78330c9bf083e9bd110e384186a116e29a6
CMake Warning (dev) at /opt/homebrew/Cellar/cmake/3.22.2/share/cmake/Modules/ExternalData.cmake:738 (message):
Data file referenced by argument
DATA{/Users/fwein/code/pv_10/paraview_cfsreader/Plugins/CFSReader/Testing/Data/Baseline/CFSReaderTest.png}
corresponds to source tree path
Plugins/CFSReader/Testing/Data/Baseline/CFSReaderTest.png
that does not exist as a file (with or without an extension)!
Call Stack (most recent call first):
/opt/homebrew/Cellar/cmake/3.22.2/share/cmake/Modules/ExternalData.cmake:542 (_ExternalData_arg)
/opt/homebrew/Cellar/cmake/3.22.2/share/cmake/Modules/ExternalData.cmake:355 (ExternalData_expand_arguments)
CMake/ParaViewTesting.cmake:232 (ExternalData_add_test)
CMake/ParaViewTesting.cmake:289 (_paraview_add_tests)
Plugins/CFSReader/Testing/CMakeLists.txt:13 (paraview_add_client_tests)
An this Plugins/CFSReader/Testing/Data/Baseline/CFSReaderTest.png
instead of Data/Baseline/Single_Region_Opt_last_PSD.png
seems to be problem.
When I run the test, I see, that everything works, but I get the error
80: debug: Test "CFSReaderTest.xml" is finished. Success = true
80: <DartMeasurement name="ImageError" type="numeric/double">0</DartMeasurement><DartMeasurement name="BaselineImage" type="text/string">Standard</DartMeasurement><DartMeasurement name="WallTime" type="numeric/double">0.00658298</DartMeasurement>
80: <DartMeasurement name="CPUTime" type="numeric/double">0.006587</DartMeasurement>
80: <DartMeasurement name="ImageNotFound" type="text/string">/Users/fwein/code/pv_10/paraview_cfsreader/Plugins/CFSReader/Testing/Data/Baseline/CFSReaderTest.png</DartMeasurement>
So it is again CFSReaderTest.png
instead of Single_Region_Opt_last_PSD.png
.
This is my CMakeLists.txt in my plugins’s Testing
set(module_tests
CFSReaderTest.xml)
if (BUILD_SHARED_LIBS)
set(_paraview_add_tests_default_test_data_target ParaViewData)
ExternalData_Expand_Arguments(ParaViewData _
"DATA{${CMAKE_CURRENT_SOURCE_DIR}/Data/openCFS/Single_Region_Opt.cfs}"
"DATA{${CMAKE_CURRENT_SOURCE_DIR}/Data/Baseline/Single_Region_Opt_last_PSD.png}"
)
paraview_add_client_tests(
LOAD_PLUGIN "CFSReader"
BASELINE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/Data/Baseline"
TEST_DATA_TARGET ParaViewData
TEST_SCRIPTS ${module_tests})
paraview_add_client_server_tests(
LOAD_PLUGIN "CFSReader"
BASELINE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/Data/Baseline"
TEST_DATA_TARGET ParaViewData
TEST_SCRIPTS ${module_tests})
paraview_add_client_server_render_tests(
LOAD_PLUGIN "CFSReader"
BASELINE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/Data/Baseline"
TEST_DATA_TARGET ParaViewData
TEST_SCRIPTS ${module_tests})
endif ()