Commit 42baebf3 authored by Brad King's avatar Brad King
Browse files

Use ExternalData to reference test baselines

Teach vtk_add_test_* to use ExternalData_add_test to add tests and use
DATA{} syntax to reference test baseline images.  Also update direct
add_test calls in several modules.

Change-Id: I1ddcec1c109ea9ca7840be9b6ccf015393039cba
parent 4362dcb5
......@@ -14,12 +14,13 @@ if(VTK_DATA_ROOT AND (VTK_MPI_MAX_NUMPROCS GREATER 1))
vtk_module_test_executable(${vtk-module}Cxx-${test} ${test}.cxx)
if(VTK_DATA_ROOT)
add_test(NAME ${vtk-module}Cxx-${test}
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 Baseline/${_baselinedname}/${test}.png
-V DATA{../Data/Baseline/${test}.png,:}
${VTK_MPI_POSTFLAGS})
else()
add_test(NAME ${vtk-module}Cxx-${test}
......
......@@ -24,20 +24,22 @@ if (VTK_PYTHON_EXE)
Slice
Sort
)
add_test(NAME ${vtk-module}Python-TestPlaced${tfile}
ExternalData_add_test(VTKData
NAME ${vtk-module}Python-TestPlaced${tfile}
COMMAND ${VTK_PYTHON_EXE}
${CMAKE_CURRENT_SOURCE_DIR}/Test${tfile}.py
-B ${VTK_DATA_ROOT}/Baseline/AcceleratorsPiston
-B "DATA{../Data/Baseline/,REGEX:Test${tfile}(_[0-9]+)?.png}"
-D ${VTK_DATA_ROOT}/Data)
endforeach ( )
#
# Exercise thrust to gl direct on GPU rendering.
#
add_test(NAME ${vtk-module}Python-TestDirectRendering
ExternalData_add_test(VTKData
NAME ${vtk-module}Python-TestDirectRendering
COMMAND ${VTK_PYTHON_EXE}
${CMAKE_CURRENT_SOURCE_DIR}/TestRendering.py
-B ${VTK_DATA_ROOT}/Baseline/AcceleratorsPiston
-B "DATA{../Data/Baseline/,REGEX:TestRendering(_[0-9]+)?.png}"
-D ${VTK_DATA_ROOT}/Data
--gpu_render)
......
......@@ -20,14 +20,14 @@ macro (vtk_add_test_mpi name)
if(data_dir)
set(_D -D ${data_dir})
set(_T -T ${VTK_BINARY_DIR}/Testing/Temporary)
set(_V -V ${data_dir}/Baseline/Parallel/${TName}.png)
set(_V -V "DATA{${${vtk-module}_SOURCE_DIR}/Testing/Data/Baseline/${TName}.png,:}")
else()
set(_D "")
set(_T "")
set(_V "")
endif()
add_test(
ExternalData_add_test(VTKData
NAME ${vtk-module}Cxx-MPI-${TName}
COMMAND ${VTK_MPIRUN_EXE}
${VTK_MPI_PRENUMPROC_FLAGS} ${VTK_MPI_NUMPROC_FLAG} ${VTK_MPI_MAX_NUMPROCS}
......@@ -107,9 +107,10 @@ function(vtk_add_test_cxx)
endif()
endforeach()
if(data_dir AND tmp_base)
set(_V -V Baseline/${tmp_base}/${name}.png)
set(_V -V "DATA{${${vtk-module}_SOURCE_DIR}/Testing/Data/Baseline/${name}.png,:}")
endif()
add_test(NAME ${vtk-module}Cxx-${name}
ExternalData_add_test(VTKData
NAME ${vtk-module}Cxx-${name}
COMMAND ${vtk-module}CxxTests ${name} ${${name}_ARGS}
${_D} ${_T} ${_V} ${_E})
set_property(DIRECTORY APPEND PROPERTY VTK_TEST_CXX_SOURCES ${name}.cxx)
......@@ -185,10 +186,10 @@ function(vtk_add_test_python name)
set(_A "")
if(VTK_DATA_ROOT AND base_dir)
if(no_rt)
set(_B -B ${VTK_DATA_ROOT}/Baseline/${base_dir})
set(_B -B "DATA{${${vtk-module}_SOURCE_DIR}/Testing/Data/Baseline/,REGEX:${TName}(_[0-9]+)?.png}")
else()
set(rtImageTest ${VTK_BINARY_DIR}/Utilities/vtkTclTest2Py/rtImageTest.py)
set(_V -V Baseline/${base_dir}/${TName}.png)
set(_V -V "DATA{${${vtk-module}_SOURCE_DIR}/Testing/Data/Baseline/${TName}.png,:}")
set(_A -A ${VTK_BINARY_DIR}/Utilities/vtkTclTest2Py)
endif()
if(NOT no_output)
......@@ -196,7 +197,8 @@ function(vtk_add_test_python name)
endif()
endif()
add_test(NAME ${vtk-module}Python-${TName}
ExternalData_add_test(VTKData
NAME ${vtk-module}Python-${TName}
COMMAND ${VTK_PYTHON_EXE} ${rtImageTest}
${CMAKE_CURRENT_SOURCE_DIR}/${TName}.py ${${TName}_ARGS}
${_D} ${_B} ${_T} ${_V} ${_A})
......@@ -251,7 +253,7 @@ function(vtk_add_test_tcl name)
if(NOT no_rt)
set(rtImageTest ${vtkTestingRendering_SOURCE_DIR}/rtImageTest.tcl)
if(VTK_DATA_ROOT AND base_dir)
set(_V -V Baseline/${base_dir}/${TName}.png)
set(_V -V "DATA{${${vtk-module}_SOURCE_DIR}/Testing/Data/Baseline/${TName}.png,:}")
endif()
if(NOT no_output)
set(_T -T ${VTK_TEST_OUTPUT_DIR})
......@@ -259,7 +261,8 @@ function(vtk_add_test_tcl name)
endif()
set(_A -A ${VTK_SOURCE_DIR}/Wrapping/Tcl)
add_test(NAME ${vtk-module}Tcl-${TName}
ExternalData_add_test(VTKData
NAME ${vtk-module}Tcl-${TName}
COMMAND ${VTK_TCL_EXE} ${rtImageTest}
${CMAKE_CURRENT_SOURCE_DIR}/${TName}.tcl ${${TName}_ARGS}
${_D} ${_T} ${_V} ${_A})
......
vtk_module_test_executable(TestPStream TestPStream.cxx)
add_test(NAME ${vtk-module}Cxx-TestPStream-image
ExternalData_add_test(VTKData
NAME ${vtk-module}Cxx-TestPStream-image
COMMAND ${MPIEXEC} ${MPIEXEC_NUMPROC_FLAG} 2 ${MPIEXEC_PREFLAGS}
$<TARGET_FILE:TestPStream>
-D ${VTK_DATA_ROOT}
-T ${VTK_TEST_OUTPUT_DIR}
-V Baseline/Parallel/TestPStream.cxx.png
-V DATA{../Data/Baseline/TestPStream.cxx.png,:}
${VTK_MPI_POSTFLAGS})
vtk_module_test_executable(TestPStreamGeometry TestVectorFieldSource.cxx
......
......@@ -49,12 +49,13 @@ if(GL2PSTests)
set(_error_threshold 15)
endif()
# Image diff rasterized png with baseline
add_test(NAME ${vtk-module}Cxx-${TName}-VerifyRasterizedPNG
ExternalData_add_test(VTKData
NAME ${vtk-module}Cxx-${TName}-VerifyRasterizedPNG
COMMAND vtkRenderingGL2PSCxxTests PNGCompare
-D ${VTK_DATA_ROOT}
-T ${VTK_TEST_OUTPUT_DIR}
-E ${_error_threshold}
-V Baseline/Hybrid/${TName}-rasterRef.png
-V DATA{../Data/Baseline/${TName}-rasterRef.png,:}
--test-file ${VTK_TEST_OUTPUT_DIR}/${TName}-raster.png
)
set_tests_properties("${vtk-module}Cxx-${TName}-VerifyRasterizedPNG"
......
......@@ -3,12 +3,13 @@ if(VTK_DATA_ROOT)
include_directories(${MPI_INCLUDE_PATH})
vtk_module_test_executable(ParallelIsoTest ParallelIso.cxx)
if(VTK_MPI_MAX_NUMPROCS GREATER 1)
add_test(NAME ParallelIso-image
ExternalData_add_test(VTKData
NAME ParallelIso-image
COMMAND ${MPIEXEC} ${MPIEXEC_NUMPROC_FLAG} 2 ${MPIEXEC_PREFLAGS}
$<TARGET_FILE:ParallelIsoTest>
-D ${VTK_DATA_ROOT}
-T ${VTK_TEST_OUTPUT_DIR}
-V Baseline/Parallel/ParallelIso.cxx.png
-V DATA{../Data/Baseline/ParallelIso.cxx.png,:}
${VTK_MPI_POSTFLAGS})
endif()
endif()
......@@ -9,11 +9,12 @@ if (VTK_LARGE_DATA_ROOT AND _known_little_endian AND NOT WIN32)
find_package(MPI REQUIRED)
include_directories(${MPI_INCLUDE_PATH})
vtk_module_test_executable(${vtk-module}CxxTests TestPWindBladeReader.cxx)
add_test(NAME ${vtk-module}Cxx-TestPWindBladeReader
ExternalData_add_test(VTKData
NAME ${vtk-module}Cxx-TestPWindBladeReader
COMMAND ${MPIEXEC} ${MPIEXEC_NUMPROC_FLAG} 1 ${MPIEXEC_PREFLAGS}
$<TARGET_FILE:${vtk-module}CxxTests> TestPWindBladeReader
-D ${VTK_LARGE_DATA_ROOT}
-T ${VTK_TEST_OUTPUT_DIR}
-V Baseline/Parallel/TestWindBladeReader.png
-V DATA{../Data/Baseline/TestWindBladeReader.png,:}
${VTK_MPI_POSTFLAGS})
endif()
......@@ -8,10 +8,10 @@ if(VTK_MYSQL_TEST_URL)
if(VTK_DATA_ROOT)
if(WIN32)
set(TestMySQLTableReadWrite_ARGS
${VTK_DATA_ROOT}/Baseline/IO/simple_table_win.vtk)
DATA{../Data/Input/simple_table_win.vtk})
else()
set(TestMySQLTableReadWrite_ARGS
${VTK_DATA_ROOT}/Baseline/IO/simple_table.vtk)
DATA{../Data/Input/simple_table.vtk})
endif()
vtk_add_test_cxx(TestMySQLTableReadWrite.cxx NO_DATA NO_VALID)
endif()
......
......@@ -8,10 +8,10 @@ if(VTK_PSQL_TEST_URL)
if(VTK_DATA_ROOT)
if(WIN32)
set(TestPostgreSQLTableReadWrite_ARGS
${VTK_DATA_ROOT}/Baseline/IO/simple_table_win.vtk)
DATA{../Data/Input/simple_table_win.vtk})
else()
set(TestPostgreSQLTableReadWrite_ARGS
${VTK_DATA_ROOT}/Baseline/IO/simple_table.vtk)
DATA{../Data/Input/simple_table.vtk})
endif()
vtk_add_test_cxx(TestPostgreSQLTableReadWrite.cxx NO_DATA NO_VALID)
endif()
......
......@@ -4,7 +4,7 @@ vtk_add_test_cxx(NO_VALID
)
if(VTK_DATA_ROOT)
set(TestSQLiteTableReadWrite_ARGS ${VTK_DATA_ROOT}/Baseline/IO/simple_table.vtk)
set(TestSQLiteTableReadWrite_ARGS DATA{../Data/Input/simple_table.vtk})
vtk_add_test_cxx(TestSQLiteTableReadWrite.cxx NO_DATA NO_VALID NO_OUTPUT)
set_tests_properties(vtkIOSQLCxx-TestSQLiteTableReadWrite PROPERTIES RUN_SERIAL 1)
endif()
......
......@@ -18,21 +18,24 @@ set_property(DIRECTORY APPEND PROPERTY VTK_TEST_CXX_SOURCES
TestImageStencilData.cxx
)
if(VTK_DATA_ROOT)
add_test(NAME ${vtk-module}Cxx-AddStencilData
ExternalData_add_test(VTKData
NAME ${vtk-module}Cxx-AddStencilData
COMMAND ${vtk-module}CxxTests TestImageStencilData 1
-D ${VTK_DATA_ROOT}
-T ${VTK_TEST_OUTPUT_DIR}
-V Baseline/Hybrid/TestAddStencilData.png)
add_test(NAME ${vtk-module}Cxx-SubtractStencilData
-V DATA{../Data/Baseline/TestAddStencilData.png,:})
ExternalData_add_test(VTKData
NAME ${vtk-module}Cxx-SubtractStencilData
COMMAND ${vtk-module}CxxTests TestImageStencilData 2
-D ${VTK_DATA_ROOT}
-T ${VTK_TEST_OUTPUT_DIR}
-V Baseline/Hybrid/TestSubtractStencilData.png)
add_test(NAME ${vtk-module}Cxx-ClipStencilData
-V DATA{../Data/Baseline/TestSubtractStencilData.png,:})
ExternalData_add_test(VTKData
NAME ${vtk-module}Cxx-ClipStencilData
COMMAND ${vtk-module}CxxTests TestImageStencilData 3
-D ${VTK_DATA_ROOT}
-T ${VTK_TEST_OUTPUT_DIR}
-V Baseline/Hybrid/TestClipStencilData.png)
-V DATA{../Data/Baseline/TestClipStencilData.png,:})
endif()
vtk_test_cxx_executable(${vtk-module}CxxTests)
# Tests with test images in Baseline/Parallel
#
unset(tests)
if(VTK_DATA_ROOT)
set(tests
......@@ -8,14 +6,15 @@ if(VTK_DATA_ROOT)
endif()
foreach( tfile ${tests})
add_test(NAME ${vtk-module}Tcl-${tfile} COMMAND
ExternalData_add_test(VTKData
NAME ${vtk-module}Tcl-${tfile} COMMAND
${VTK_MPIRUN_EXE} ${VTK_MPI_PRENUMPROC_FLAGS} ${VTK_MPI_NUMPROC_FLAG} 2 ${VTK_MPI_PREFLAGS}
$<TARGET_FILE:pvtk>
${vtkTestingRendering_SOURCE_DIR}/prtImageTest.tcl
${CMAKE_CURRENT_SOURCE_DIR}/${tfile}.tcl
-D ${VTK_DATA_ROOT}
-T ${VTK_TEST_OUTPUT_DIR}
-V Baseline/Parallel/${tfile}.png
-V DATA{../Data/Baseline/${tfile}.png}
-A ${VTK_SOURCE_DIR}/Wrapping/Tcl
${VTK_MPI_POSTFLAGS}
)
......
......@@ -65,11 +65,12 @@ if(GL2PSTests)
"${VTK_TEST_OUTPUT_DIR}/${TName}.ps"
)
# Image diff rasterized png with baseline
add_test(NAME ${vtk-module}Cxx-${TName}-VerifyRasterizedPNG
ExternalData_add_test(VTKData
NAME ${vtk-module}Cxx-${TName}-VerifyRasterizedPNG
COMMAND vtkRenderingGL2PSCxxTests PNGCompare
-D ${VTK_DATA_ROOT}
-T ${VTK_TEST_OUTPUT_DIR}
-V Baseline/Rendering/${TName}-rasterRef.png
-V DATA{../Data/Baseline/${TName}-rasterRef.png,:}
--test-file ${VTK_TEST_OUTPUT_DIR}/${TName}-raster.png
)
set_tests_properties("${vtk-module}Cxx-${TName}-VerifyRasterizedPNG"
......
......@@ -279,10 +279,11 @@ if(BUILD_TESTING)
# If JAVA_DATAMODEL_FLAG is set, pass it as first argument. Otherwise, it's empty.
# For example, use "-d64" to force 64-bit java jvm.
#
add_test(JavaRegression ${JAVA_RUNTIME} ${VTK_TEST_JAVA_DATAMODEL_FLAG}
ExternalData_add_test(VTKData
JavaRegression ${JAVA_RUNTIME} ${VTK_TEST_JAVA_DATAMODEL_FLAG}
-classpath ${VTK_JAR_PATH}/vtk.jar${SEPARATOR}${VTK_BINARY_DIR}/Wrapping/Java
vtk.test.Regression -D ${VTK_DATA_ROOT}
-V Baseline/Graphics/Cone.png
-V DATA{Baseline/Cone.png,:}
-T ${VTK_TEST_OUTPUT_DIR}
)
endif()
......
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