/usr/lib/cmake/vtk-6.1/vtkTestingMacros.cmake is in libvtk6-dev 6.1.0+dfsg2-6.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 | # -----------------------------------------------------------------------------
# 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 "[TESTING_DATA]")
set(data_dir ${VTK_TEST_DATA_DIR})
elseif("x${a}" MATCHES "\\.cxx$")
list(APPEND test_extra ${a})
else()
message(FATAL_ERROR "Unknown argument \"${a}\"")
endif()
endforeach()
if(data_dir)
set(_D -D ${data_dir})
set(_T -T ${VTK_BINARY_DIR}/Testing/Temporary)
set(_V -V "DATA{${${vtk-module}_SOURCE_DIR}/Testing/Data/Baseline/${TName}.png,:}")
else()
set(_D "")
set(_T "")
set(_V "")
endif()
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}
${VTK_MPI_PREFLAGS}
$<TARGET_FILE:${TName}>
${_D} ${_T} ${_V}
${VTK_MPI_POSTFLAGS})
vtk_module_test_executable(${TName} ${TName}.cxx ${test_extra})
endmacro()
# -----------------------------------------------------------------------------
# Usage: vtk_add_test_cxx([name.cxx[,-E<n>][,NO_VALID]]...
# [NO_DATA] [NO_VALID] [VALID_ERROR <n>])
function(vtk_add_test_cxx)
# Parse Command line args
set(names "")
set(no_data 0)
set(no_valid 0)
set(no_output 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("x${a}" MATCHES "^x([^.]*)\\.cxx,?(.*)$")
set(name "${CMAKE_MATCH_1}")
string(REPLACE "," ";" _${name}_OPTIONS "${CMAKE_MATCH_2}")
list(APPEND names ${name})
else()
message(FATAL_ERROR "Unknown argument \"${a}\"")
endif()
endforeach()
if(NOT no_data)
set(_D -D ${VTK_TEST_DATA_DIR})
else()
set(_D "")
endif()
set(_T "")
if(NOT no_output)
set(_T -T ${VTK_TEST_OUTPUT_DIR})
endif()
if(vtk-module)
set(prefix ${vtk-module})
set(base_dir ${${vtk-module}_SOURCE_DIR}/Testing/Data/Baseline)
elseif(vtk-example)
set(prefix ${vtk-example})
set(base_dir ${CMAKE_CURRENT_SOURCE_DIR}/Baseline)
else()
message(FATAL_ERROR "Neither vtk-module nor vtk-example is set!")
endif()
foreach(name ${names})
set(_V "")
set(_E "")
set(tmp_no_valid "${no_valid}")
foreach(opt IN LISTS _${name}_OPTIONS)
if("x${opt}" MATCHES "^x-E([0-9]+)$")
set(_E -E ${CMAKE_MATCH_1})
elseif("[${opt}]" STREQUAL "[NO_VALID]")
set(tmp_no_valid 1)
else()
message(FATAL_ERROR "Test ${name} has unknown option \"${opt}\"")
endif()
endforeach()
if(NOT tmp_no_valid)
set(_V -V "DATA{${base_dir}/${name}.png,:}")
endif()
ExternalData_add_test(VTKData
NAME ${prefix}Cxx-${name}
COMMAND ${prefix}CxxTests ${name} ${${name}_ARGS}
${_D} ${_T} ${_V} ${_E})
set_property(DIRECTORY APPEND PROPERTY VTK_TEST_CXX_SOURCES ${name}.cxx)
endforeach()
endfunction()
macro(vtk_test_cxx_executable exe_name)
set(argn "${ARGN}")
set(test_driver vtkTestDriver.h)
set(test_extra "")
foreach(a IN LISTS argn)
if("[${a}]" STREQUAL "[RENDERING_FACTORY]")
include(vtkTestingRenderingDriver)
set(test_driver ${vtkTestingRendering_SOURCE_DIR}/vtkTestingObjectFactory.h)
elseif("x${a}" MATCHES "\\.cxx$")
list(APPEND test_extra ${a})
else()
message(FATAL_ERROR "Unknown argument \"${a}\"")
endif()
endforeach()
get_property(vtk_test_cxx_sources DIRECTORY PROPERTY VTK_TEST_CXX_SOURCES)
if(vtk-module)
set(tmp_before_tm ${CMAKE_TESTDRIVER_BEFORE_TESTMAIN})
set(CMAKE_TESTDRIVER_BEFORE_TESTMAIN
" vtksys::SystemInformation::SetStackTraceOnError(1);\n ${tmp_before_tm}")
endif()
create_test_sourcelist(Tests ${exe_name}.cxx ${vtk_test_cxx_sources}
EXTRA_INCLUDE ${test_driver})
if(vtk-module)
set(CMAKE_TESTDRIVER_BEFORE_TESTMAIN "${tmp_before_tm}")
vtk_module_test_executable(${exe_name} ${Tests} ${test_extra})
elseif(vtk-example)
add_executable(${exe_name} ${Tests} ${test_extra})
target_link_libraries(${exe_name} ${VTK_LIBRARIES})
else()
message(FATAL_ERROR "Neither vtk-module nor vtk-example is set!")
endif()
endmacro()
# -----------------------------------------------------------------------------
# Usage: vtk_add_test_python(name [NO_RT] [NO_DATA] [NO_VALID])
# NO_RT is for tests using vtk.test.testing
function(vtk_add_test_python name)
if(NOT VTK_PYTHON_EXE)
message(FATAL_ERROR "VTK_PYTHON_EXE not set")
endif()
# Parse Command line args
get_filename_component(TName ${name} NAME_WE)
set(no_data 0)
set(no_valid 0)
set(no_output 0)
set(no_rt 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 "[NO_RT]")
set(no_rt 1)
else()
message(FATAL_ERROR "Unknown argument \"${a}\"")
endif()
endforeach()
if(NOT no_data)
set(_D -D ${VTK_TEST_DATA_DIR})
else()
set(_D "")
endif()
set(rtImageTest "")
set(_B "")
set(_V "")
set(_T "")
set(_A "")
if(NOT no_valid)
if(no_rt)
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 "DATA{${${vtk-module}_SOURCE_DIR}/Testing/Data/Baseline/${TName}.png,:}")
set(_A -A ${VTK_BINARY_DIR}/Utilities/vtkTclTest2Py)
endif()
if(NOT no_output)
set(_T -T ${VTK_TEST_OUTPUT_DIR})
endif()
endif()
ExternalData_add_test(VTKData
NAME ${vtk-module}Python-${TName}
COMMAND ${VTK_PYTHON_EXE} --enable-bt ${rtImageTest}
${CMAKE_CURRENT_SOURCE_DIR}/${TName}.py ${${TName}_ARGS}
${_D} ${_B} ${_T} ${_V} ${_A})
endfunction()
# -----------------------------------------------------------------------------
# Usage: vtk_add_test_tcl(name [NO_DATA] [NO_VALID])
function(vtk_add_test_tcl name)
if(NOT VTK_TCL_EXE)
message(FATAL_ERROR "VTK_TCL_EXE not set")
endif()
# Parse Command line args
get_filename_component(TName ${name} NAME_WE)
set(no_data 0)
set(no_valid 0)
set(no_output 0)
set(no_rt 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 "[NO_RT]")
set(no_rt 1)
else()
message(FATAL_ERROR "Unknown argument \"${a}\"")
endif()
endforeach()
if(NOT no_data)
set(_D -D ${VTK_TEST_DATA_DIR})
elseif(no_rt)
set(_D "")
else()
set(_D -D VTK_DATA_ROOT-NOTFOUND)
endif()
set(rtImageTest "")
set(_V "")
set(_T "")
if(NOT no_rt)
set(rtImageTest ${vtkTestingRendering_SOURCE_DIR}/rtImageTest.tcl)
if(NOT no_valid)
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})
endif()
endif()
set(_A -A ${VTK_SOURCE_DIR}/Wrapping/Tcl)
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})
endfunction()
|