Commit ef7f0191 authored by Brad King's avatar Brad King

vtkTestingMacros: Remove vtk_tests macro

Use vtk_add_test_cxx and vtk_test_cxx_executable to replace calls to
vtk_tests.  Then remove vtk_tests and parse_optional_arguments.

Change-Id: I73dee627fa87a399c48b409af046b116fc75a0fd
parent 954ca17c
#-----------------------------------------------------------------------------
# Private helper macros.
macro(parse_optional_arguments)
set (BASELINEDIR ${vtk-module})
#set (DATADIR ${VTK_DATA_ROOT}) #don't do this: some tests don't want it
set(argv ${ARGV})
set(MYARGV)
set (i 0)
while (${i} LESS ${ARGC})
math(EXPR iplus1 "${i}+1")
list(GET argv ${i} ARG)
if (${ARG} STREQUAL "BASELINEDIR")
list(GET argv ${iplus1} BASELINEDIR)
set (i ${iplus1})
math(EXPR iplus1 "${i}+1")
elseif(${ARG} STREQUAL "DATADIR")
list(GET argv ${iplus1} DATADIR)
set (i ${iplus1})
math(EXPR iplus1 "${i}+1")
elseif(${ARG} STREQUAL "LABELS" AND ${iplus1} LESS ${ARGC})
# everything after LABELS gets added as a label
set(LABELS)
while (${iplus1} LESS ${ARGC})
list(GET argv ${iplus1} LABEL)
list(APPEND LABELS ${LABEL})
set(i ${iplus1})
math(EXPR iplus1 "${i}+1")
endwhile()
else()
list(APPEND MYARGV ${ARG})
endif()
set(i ${iplus1})
endwhile()
endmacro(parse_optional_arguments)
#-----------------------------------------------------------------------------
# Public interface macros.
# -----------------------------------------------------------------------------
# vtk_tests(cxxfiles [BASELINEDIR baseline_directory] [DATADIR data_directory] [LABELS test_labels])
#
# Takes a list of cxx files which will be driven by the modules
# test driver. This helps reduce a lot of boiler place code in each module
#
# BASELINEDIR a baseline directory to look for correct images in. If not
# specified it will look for a directory named for the module the test is in.
#
# DATADIR a data directory to look for input data to the tests in. If not
# specified the test is assumed to not require input data.
# Ex. ${VTK_DATA_ROOT} or ${VTK_LARGE_DATA_ROOT}
#
# LABELS labels to be added to the tests. Note that the
# [LABELS test_labels] must be at the end of the macro call since all strings
# after LABELS will be added as labels to the tests.
# Ex. PARAVIEW to label that the test is for ParaView and can be run
# with ctest -L PARAVIEW
macro(vtk_tests)
parse_optional_arguments(${ARGV})
create_test_sourcelist(Tests ${vtk-module}CxxTests.cxx
${MYARGV}
EXTRA_INCLUDE vtkTestDriver.h)
vtk_module_test_executable(${vtk-module}CxxTests ${Tests})
set(TestsToRun ${Tests})
list(REMOVE_ITEM TestsToRun ${vtk-module}CxxTests.cxx)
# Add all the executables
foreach(test ${TestsToRun})
get_filename_component(TName ${test} NAME_WE)
if(DATADIR)
add_test(NAME ${vtk-module}Cxx-${TName}
COMMAND ${vtk-module}CxxTests ${TName}
-D ${DATADIR}
-T ${VTK_TEST_OUTPUT_DIR}
-V Baseline/${BASELINEDIR}/${TName}.png)
else()
add_test(NAME ${vtk-module}Cxx-${TName}
COMMAND ${vtk-module}CxxTests ${TName}
${${TName}_ARGS})
endif()
if(LABELS)
set_tests_properties(${vtk-module}Cxx-${TName} PROPERTIES LABELS "${LABELS}")
endif()
endforeach()
endmacro(vtk_tests)
# -----------------------------------------------------------------------------
# Usage: vtk_add_test_mpi(name [VTK_DATA_ROOT|VTK_LARGE_DATA_ROOT])
macro (vtk_add_test_mpi name)
......
# Tests with data
if(VTK_DATA_ROOT)
set(NEEDS_DATA
TestGenericStreamTracer.cxx
)
vtk_add_test_cxx(TestGenericStreamTracer.cxx GenericFiltering)
endif()
vtk_tests(BASELINEDIR GenericFiltering DATADIR ${VTK_DATA_ROOT}
${NEEDS_DATA}
vtk_add_test_cxx(GenericFiltering
TestGenericClip.cxx
TestGenericContourFilter.cxx
TestGenericCutter.cxx
......@@ -14,3 +11,5 @@ vtk_tests(BASELINEDIR GenericFiltering DATADIR ${VTK_DATA_ROOT}
TestGenericGlyph3DFilter.cxx
TestGenericProbeFilter.cxx
otherCreation.cxx)
vtk_test_cxx_executable(${vtk-module}CxxTests)
vtk_tests(
TestReebGraph.cxx)
vtk_add_test_cxx(TestReebGraph.cxx NO_DATA NO_VALID NO_OUTPUT)
vtk_test_cxx_executable(${vtk-module}CxxTests)
vtk_tests(TestExodusImplicitArrays.cxx DATADIR ${VTK_DATA_ROOT})
vtk_add_test_cxx(TestExodusImplicitArrays.cxx NO_VALID)
vtk_test_cxx_executable(${vtk-module}CxxTests)
vtk_tests(TestFieldDataSerialization.cxx)
vtk_add_test_cxx(TestFieldDataSerialization.cxx NO_DATA NO_VALID NO_OUTPUT)
vtk_test_cxx_executable(${vtk-module}CxxTests)
vtk_tests(BASELINEDIR Parallel PrmMagnify.cxx)
vtk_add_test_cxx(PrmMagnify.cxx Parallel)
vtk_test_cxx_executable(${vtk-module}CxxTests)
vtk_module_test_executable(TestClientServerRendering TestClientServerRendering.cxx)
vtk_add_test_mpi(TestDistributedDataCompositeZPass.cxx VTK_DATA_ROOT)
vtk_add_test_mpi(TestPCompositeZPass.cxx VTK_DATA_ROOT)
......
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