Commit 3797f83d authored by Brad King's avatar Brad King

Convert VTKData test inputs to ExternalData content links

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
parent 7b3f3da0
......@@ -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})
......@@ -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()
......@@ -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 ( )
#
......@@ -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 ()
# 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})
# -----------------------------------------------------------------------------
# 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()
......@@ -48,7 +46,6 @@ 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)
......@@ -56,8 +53,6 @@ function(vtk_add_test_cxx)
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}")
......@@ -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()
......@@ -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
......@@ -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()
......@@ -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()
......@@ -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()
......@@ -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)
......
......@@ -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)
......
......@@ -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")
......@@ -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)
......
......@@ -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