Skip to content

Commit

Permalink
Convert VTKData test inputs to ExternalData content links
Browse files Browse the repository at this point in the history
Add to the Testing/Data directory ExternalData content links mirroring
the content and layout we use from the VTKData/Data directory.

Add a CMake/vtkLegacyData.cmake module, included from CMakeLists.txt and
Testing/External/CMakeLists.txt, to call ExternalData_Expand_Arguments
for all data directories added from VTKData/Data.  This will bulk-fetch
all test input data currently used by tests of any module, enabled or
not.  We can make the DATA{} references more granular later.

Add a VTK_TEST_DATA_DIR variable to refer to the directory we tell the
ExternalData module to populate the real data files.  Replace references
to VTK_DATA_ROOT in test command lines (after -D) with references to
VTK_TEST_DATA_DIR.  Drop the VTK_DATA_ROOT CMake option and stop using
the VTKData repository.

Remove the TESTING_DATA option from the vtk_add_test_cxx API and remove
the VTK_DATA_ROOT option from the vtk_add_test_mpi API since all test
input data are now handled through ExternalData and Testing/Data content
links.

Change-Id: Id02490b76ea2e161b9038188264a4830485039d8
  • Loading branch information
bradking committed Jun 4, 2013
1 parent 7b3f3da commit 3797f83
Show file tree
Hide file tree
Showing 842 changed files with 1,371 additions and 788 deletions.
25 changes: 9 additions & 16 deletions Accelerators/Piston/Testing/Cxx/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ vtk_add_test_cxx(

vtk_test_cxx_executable(${vtk-module}CxxTests)

if(VTK_DATA_ROOT AND (VTK_MPI_MAX_NUMPROCS GREATER 1))
if(VTK_MPI_MAX_NUMPROCS GREATER 1)
find_package(MPI REQUIRED)
include_directories(${MPI_INCLUDE_PATH})

Expand All @@ -13,21 +13,14 @@ if(VTK_DATA_ROOT AND (VTK_MPI_MAX_NUMPROCS GREATER 1))
foreach(test ${PistonMPITests})

vtk_module_test_executable(${vtk-module}Cxx-${test} ${test}.cxx)
if(VTK_DATA_ROOT)
ExternalData_add_test(VTKData
NAME ${vtk-module}Cxx-${test}
COMMAND ${MPIEXEC} ${MPIEXEC_NUMPROC_FLAG} 2 ${MPIEXEC_PREFLAGS}
$<TARGET_FILE:${vtk-module}Cxx-${test}>
-D ${VTK_DATA_ROOT}
-T ${VTK_TEST_OUTPUT_DIR}
-V DATA{../Data/Baseline/${test}.png,:}
${VTK_MPI_POSTFLAGS})
else()
add_test(NAME ${vtk-module}Cxx-${test}
COMMAND ${MPIEXEC} ${MPIEXEC_NUMPROC_FLAG} 2 ${MPIEXEC_PREFLAGS}
$<TARGET_FILE:${vtk-module}Cxx-${test}>
${VTK_MPI_POSTFLAGS})
endif()
ExternalData_add_test(VTKData
NAME ${vtk-module}Cxx-${test}
COMMAND ${MPIEXEC} ${MPIEXEC_NUMPROC_FLAG} 2 ${MPIEXEC_PREFLAGS}
$<TARGET_FILE:${vtk-module}Cxx-${test}>
-D ${VTK_TEST_DATA_DIR}
-T ${VTK_TEST_OUTPUT_DIR}
-V DATA{../Data/Baseline/${test}.png,:}
${VTK_MPI_POSTFLAGS})
endforeach()

endif()
4 changes: 2 additions & 2 deletions Accelerators/Piston/Testing/Python/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ if (VTK_PYTHON_EXE)
COMMAND ${VTK_PYTHON_EXE}
${CMAKE_CURRENT_SOURCE_DIR}/Test${tfile}.py
-B "DATA{../Data/Baseline/,REGEX:Test${tfile}(_[0-9]+)?.png}"
-D ${VTK_DATA_ROOT}/Data)
-D ${VTK_TEST_DATA_DIR}/Data)
endforeach ( )

#
Expand All @@ -40,7 +40,7 @@ if (VTK_PYTHON_EXE)
COMMAND ${VTK_PYTHON_EXE}
${CMAKE_CURRENT_SOURCE_DIR}/TestRendering.py
-B "DATA{../Data/Baseline/,REGEX:TestRendering(_[0-9]+)?.png}"
-D ${VTK_DATA_ROOT}/Data
-D ${VTK_TEST_DATA_DIR}/Data
--gpu_render)

endif ()
36 changes: 36 additions & 0 deletions CMake/vtkLegacyData.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# Make testing data from the legacy VTKData repository available.
# DO NOT ADD NEW DATA HERE!!
# TODO: Reference testing data from each module only as needed.
set(data "DATA{${VTK_TEST_INPUT_DIR}/,REGEX:.*}")
foreach(d
Infovis
Infovis/SQLite
Infovis/XML
Infovis/Images
Infovis/DimacsGraphs
Tango
SemiDisk
GIS
many_blocks
many_blocks/many_blocks
Quadratic
Dave_Karelitz_Small
MetaIO
libtiff
AMR
AMR/HierarchicalBoxDataset.v1.0
AMR/HierarchicalBoxDataset.v1.1
AMR/Enzo
AMR/Enzo/DD0010
UCD2D
ex-blow_5
chombo3d
foot
chi_field
headsq
Viewpoint
EnSight
)
list(APPEND data "DATA{${VTK_TEST_INPUT_DIR}/${d}/,REGEX:.*}")
endforeach()
ExternalData_Expand_Arguments(VTKData _ ${data})
35 changes: 12 additions & 23 deletions CMake/vtkTestingMacros.cmake
Original file line number Diff line number Diff line change
@@ -1,15 +1,13 @@
# -----------------------------------------------------------------------------
# Usage: vtk_add_test_mpi(name [VTK_DATA_ROOT|TESTING_DATA])
# Usage: vtk_add_test_mpi(name [TESTING_DATA])
macro (vtk_add_test_mpi name)
get_filename_component(TName ${name} NAME_WE)
set(argn "${ARGN}")
set(data_dir "")
set(test_extra "")
foreach(a IN LISTS argn)
if("[${a}]" STREQUAL "[VTK_DATA_ROOT]")
set(data_dir ${VTK_DATA_ROOT})
elseif("[${a}]" STREQUAL "[TESTING_DATA]")
set(data_dir ${ExternalData_BINARY_ROOT}/Testing)
if("[${a}]" STREQUAL "[TESTING_DATA]")
set(data_dir ${VTK_TEST_DATA_DIR})
elseif("x${a}" MATCHES "\\.cxx$")
list(APPEND test_extra ${a})
else()
Expand Down Expand Up @@ -48,16 +46,13 @@ function(vtk_add_test_cxx)
set(no_data 0)
set(no_valid 0)
set(no_output 0)
set(test_data 0)
foreach(a IN LISTS ARGN)
if("[${a}]" STREQUAL "[NO_DATA]")
set(no_data 1)
elseif("[${a}]" STREQUAL "[NO_VALID]")
set(no_valid 1)
elseif("[${a}]" STREQUAL "[NO_OUTPUT]")
set(no_output 1)
elseif("[${a}]" STREQUAL "[TESTING_DATA]")
set(test_data 1)
elseif("x${a}" MATCHES "^x([^.]*)\\.cxx,?(.*)$")
set(name "${CMAKE_MATCH_1}")
string(REPLACE "," ";" _${name}_OPTIONS "${CMAKE_MATCH_2}")
Expand All @@ -67,14 +62,8 @@ function(vtk_add_test_cxx)
endif()
endforeach()

if(test_data)
set(data_dir "${ExternalData_BINARY_ROOT}/Testing")
else()
set(data_dir "${VTK_DATA_ROOT}")
endif()

if(data_dir AND NOT no_data)
set(_D -D ${data_dir})
if(NOT no_data)
set(_D -D ${VTK_TEST_DATA_DIR})
else()
set(_D "")
endif()
Expand Down Expand Up @@ -107,7 +96,7 @@ function(vtk_add_test_cxx)
message(FATAL_ERROR "Test ${name} has unknown option \"${opt}\"")
endif()
endforeach()
if(data_dir AND NOT tmp_no_valid)
if(NOT tmp_no_valid)
set(_V -V "DATA{${base_dir}/${name}.png,:}")
endif()
ExternalData_add_test(VTKData
Expand Down Expand Up @@ -172,8 +161,8 @@ function(vtk_add_test_python name)
endif()
endforeach()

if(VTK_DATA_ROOT AND NOT no_data)
set(_D -D ${VTK_DATA_ROOT})
if(NOT no_data)
set(_D -D ${VTK_TEST_DATA_DIR})
else()
set(_D "")
endif()
Expand All @@ -183,7 +172,7 @@ function(vtk_add_test_python name)
set(_V "")
set(_T "")
set(_A "")
if(VTK_DATA_ROOT AND NOT no_valid)
if(NOT no_valid)
if(no_rt)
set(_B -B "DATA{${${vtk-module}_SOURCE_DIR}/Testing/Data/Baseline/,REGEX:${TName}(_[0-9]+)?.png}")
else()
Expand Down Expand Up @@ -229,8 +218,8 @@ function(vtk_add_test_tcl name)
endif()
endforeach()

if(VTK_DATA_ROOT AND NOT no_data)
set(_D -D ${VTK_DATA_ROOT})
if(NOT no_data)
set(_D -D ${VTK_TEST_DATA_DIR})
elseif(no_rt)
set(_D "")
else()
Expand All @@ -242,7 +231,7 @@ function(vtk_add_test_tcl name)
set(_T "")
if(NOT no_rt)
set(rtImageTest ${vtkTestingRendering_SOURCE_DIR}/rtImageTest.tcl)
if(VTK_DATA_ROOT AND NOT no_valid)
if(NOT no_valid)
set(_V -V "DATA{${${vtk-module}_SOURCE_DIR}/Testing/Data/Baseline/${TName}.png,:}")
endif()
if(NOT no_output)
Expand Down
2 changes: 1 addition & 1 deletion CMake/vtkTestingRenderingDriver.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ SET(CMAKE_TESTDRIVER_BEFORE_TESTMAIN
vtkTestingInteractor::TempDirectory =
std::string(\"${VTK_TEST_OUTPUT_DIR}\");
vtkTestingInteractor::DataDirectory =
std::string(\"${VTK_DATA_ROOT}\");
std::string(\"Use_-D_for_Data\");
int interactive = 0;
for (int ii = 0; ii < ac; ++ii)
Expand Down
18 changes: 4 additions & 14 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@ if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
"MinSizeRel" "RelWithDebInfo")
endif()

# Test input data staging directory.
set(VTK_TEST_DATA_DIR "${ExternalData_BINARY_ROOT}/Testing")

# Test input data directory.
set(VTK_TEST_INPUT_DIR "${VTK_SOURCE_DIR}/Testing/Data")

Expand Down Expand Up @@ -169,20 +172,7 @@ include(vtkDetermineCompilerFlags)
add_definitions(-DVTK_IN_VTK)

#-----------------------------------------------------------------------------
# Configure the default VTK_DATA_ROOT for the location of VTKData. To get
# the VTKData repository from git, issue the following command:
#
# git clone git://vtk.org/VTKData.git
#
# To see the web hosted repository, visit http://vtk.org/VTKData.git
FIND_PATH(VTK_DATA_ROOT VTKData.readme
${VTK_SOURCE_DIR}/VTKData
${VTK_SOURCE_DIR}/../VTKData
${VTK_SOURCE_DIR}/../../VTKData
$ENV{VTK_DATA_ROOT}
DOC "The repository for data used for testing. To obtain from git: \"git clone git://vtk.org/VTKData.git\""
)
mark_as_advanced(VTK_DATA_ROOT)
include(vtkLegacyData)

# Provide an option for tests requiring "large" input data
option(VTK_USE_LARGE_DATA "Enable tests requiring \"large\" data" OFF)
Expand Down
80 changes: 39 additions & 41 deletions Charts/Core/Testing/Cxx/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,46 +5,44 @@ vtk_add_test_cxx(NO_DATA NO_VALID
TestControlPointsItemEvents.cxx
)

if(VTK_DATA_ROOT)
# add tests that require data
vtk_add_test_cxx(
TestAxes.cxx
TestBarGraph.cxx
TestBarGraphHorizontal.cxx
TestColorTransferFunction.cxx,-E80
TestChartMatrix.cxx
TestChartsOn3D.cxx,-E16
TestChartXYZ.cxx
TestContext.cxx
TestContextImage.cxx
TestControlPointsHandleItem.cxx,-E30
TestDiagram.cxx
TestHistogram2D.cxx
TestInteractiveChartXYZ.cxx
TestLegendHiddenPlots.cxx
TestLinePlot.cxx,-E25
TestLinePlot3D.cxx
TestLinePlotAxisFonts.cxx
TestLinePlot2.cxx,-E25
TestLinePlotInteraction.cxx,-E25
TestLinePlotSelection.cxx
TestLinePlotSelection2.cxx
TestMultipleChartRenderers.cxx
TestMultipleRenderers.cxx,-E25
TestMultipleScalarsToColors.cxx,-E25
TestParallelCoordinates.cxx,-E15
TestPieChart.cxx
TestPlotMatrix.cxx
TestScalarsToColors.cxx
TestScatterPlot.cxx
TestScatterPlotMatrix.cxx
TestScatterPlotMatrixVehicles.cxx
TestScatterPlotMatrixVisible.cxx
TestScientificPlot.cxx
TestStackedBarGraph.cxx
TestStackedPlot.cxx
TestSurfacePlot.cxx
)
endif()
# add tests that require data
vtk_add_test_cxx(
TestAxes.cxx
TestBarGraph.cxx
TestBarGraphHorizontal.cxx
TestColorTransferFunction.cxx,-E80
TestChartMatrix.cxx
TestChartsOn3D.cxx,-E16
TestChartXYZ.cxx
TestContext.cxx
TestContextImage.cxx
TestControlPointsHandleItem.cxx,-E30
TestDiagram.cxx
TestHistogram2D.cxx
TestInteractiveChartXYZ.cxx
TestLegendHiddenPlots.cxx
TestLinePlot.cxx,-E25
TestLinePlot3D.cxx
TestLinePlotAxisFonts.cxx
TestLinePlot2.cxx,-E25
TestLinePlotInteraction.cxx,-E25
TestLinePlotSelection.cxx
TestLinePlotSelection2.cxx
TestMultipleChartRenderers.cxx
TestMultipleRenderers.cxx,-E25
TestMultipleScalarsToColors.cxx,-E25
TestParallelCoordinates.cxx,-E15
TestPieChart.cxx
TestPlotMatrix.cxx
TestScalarsToColors.cxx
TestScatterPlot.cxx
TestScatterPlotMatrix.cxx
TestScatterPlotMatrixVehicles.cxx
TestScatterPlotMatrixVisible.cxx
TestScientificPlot.cxx
TestStackedBarGraph.cxx
TestStackedPlot.cxx
TestSurfacePlot.cxx
)

vtk_test_cxx_executable(${vtk-module}CxxTests RENDERING_FACTORY)
35 changes: 11 additions & 24 deletions Charts/Core/Testing/Python/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,29 +1,16 @@
if(VTK_PYTHON_EXE)
set(tests)
if(VTK_DATA_ROOT)
# Tests written in Python that require VTKData
# These tests should use vtk.test.Testing.
set(tests
${tests}
TestBarGraph
TestLinePlot
TestStackedPlot
TestLinePlotColors
TestParallelCoordinatesColors
TestScatterPlotColors
# These tests should use vtk.test.Testing.
set(tests
TestBarGraph
TestLinePlot
TestStackedPlot
TestLinePlotColors
TestParallelCoordinatesColors
TestScatterPlotColors
)
else()
# Tests written in Python that do NOT require VTKData
# These tests should use vtk.test.Testing.
set(tests
${tests}
)
endif()
if(tests)
foreach(tfile ${tests})
vtk_add_test_python(${tfile}.py NO_RT NO_OUTPUT)
endforeach()
endif()
foreach(tfile ${tests})
vtk_add_test_python(${tfile}.py NO_RT NO_OUTPUT)
endforeach()
else()
message(FATAL_ERROR "No Python tests added!")
endif()
8 changes: 3 additions & 5 deletions Common/Color/Testing/Cxx/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,8 @@ vtk_add_test_cxx(NO_VALID
TestNamedColors.cxx
)

if (VTK_DATA_ROOT)
vtk_add_test_cxx(
TestColorSeries.cxx
)
endif()
vtk_add_test_cxx(
TestColorSeries.cxx
)

vtk_test_cxx_executable(${vtk-module}CxxTests)
4 changes: 1 addition & 3 deletions Common/ComputationalGeometry/Testing/Tcl/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
if(VTK_DATA_ROOT)
vtk_add_test_tcl(TestParametricFunctions)
endif()
vtk_add_test_tcl(TestParametricFunctions)
vtk_add_test_tcl(CSpline)
vtk_add_test_tcl(KSpline)
vtk_add_test_tcl(closedSplines)
7 changes: 1 addition & 6 deletions Common/DataModel/Testing/Tcl/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,11 +1,6 @@
# Tests without test images
#
vtk_add_test_tcl(otherDataSetAttributes.tcl NO_DATA NO_RT)

# Tests with images
if(VTK_DATA_ROOT)
vtk_add_test_tcl(headBone)
endif()
vtk_add_test_tcl(headBone)

vtk_add_test_tcl(ImplicitSum)
vtk_add_test_tcl(PerlinNoise)
Expand Down
Loading

0 comments on commit 3797f83

Please sign in to comment.