Commit 5b018861 authored by Brad King's avatar Brad King

Use vtk_add_test_cxx function

Refactor */*/Testing/Cxx/CMakeLists.txt to use the vtk_add_test_cxx
function instead of direct add_test calls.

Change-Id: I73dee627fa87a399c48b409af046b116fc75a0fd
parent ef7f0191
vtk_add_test_cxx(AcceleratorsPiston
create_test_sourcelist(Tests ${vtk-module}CxxTests.cxx TestUsePiston.cxx
TestUsePiston
EXTRA_INCLUDE vtkTestDriver.h
) )
vtk_module_test_executable(${vtk-module}CxxTests ${Tests}) vtk_test_cxx_executable(${vtk-module}CxxTests)
set(TestsToRun ${Tests})
list(REMOVE_ITEM TestsToRun ${vtk-module}CxxTests.cxx)
string (REPLACE "vtk" "" _baselinedname ${vtk-module})
# Add all the executables
foreach(test ${TestsToRun})
get_filename_component(TName ${test} NAME_WE)
if(VTK_DATA_ROOT)
add_test(NAME ${vtk-module}Cxx-${TName}
COMMAND ${vtk-module}CxxTests ${TName}
-D ${VTK_DATA_ROOT}
-T ${VTK_TEST_OUTPUT_DIR}
-V Baseline/${_baselinedname}/${TName}.png)
else()
add_test(NAME ${vtk-module}Cxx-${TName}
COMMAND ${vtk-module}CxxTests ${TName})
endif()
endforeach()
if(VTK_DATA_ROOT AND (VTK_MPI_MAX_NUMPROCS GREATER 1)) if(VTK_DATA_ROOT AND (VTK_MPI_MAX_NUMPROCS GREATER 1))
find_package(MPI REQUIRED) find_package(MPI REQUIRED)
......
# if we have rendering and views add the following tests # add tests that do not require data
# add tests that do not require data vtk_add_test_cxx(NO_DATA NO_VALID
set(MyTests TestContextScene.cxx
TestContextScene.cxx TestControlPointsItem.cxx
TestControlPointsItem.cxx TestControlPointsItemEvents.cxx
TestControlPointsItemEvents.cxx )
)
if(VTK_DATA_ROOT)
# add tests that require data
set(MyTests ${MyTests}
TestAxes.cxx
TestBarGraph.cxx
TestBarGraphHorizontal.cxx
TestColorTransferFunction.cxx
TestChartMatrix.cxx
TestChartsOn3D.cxx
TestChartXYZ.cxx
TestContext.cxx
TestContextImage.cxx
TestControlPointsHandleItem.cxx
TestDiagram.cxx
TestHistogram2D.cxx
TestInteractiveChartXYZ.cxx
TestLegendHiddenPlots.cxx
TestLinePlot.cxx
TestLinePlot3D.cxx
TestLinePlotAxisFonts.cxx
TestLinePlot2.cxx
TestLinePlotInteraction.cxx
TestLinePlotSelection.cxx
TestLinePlotSelection2.cxx
TestMultipleChartRenderers.cxx
TestMultipleRenderers.cxx
TestMultipleScalarsToColors.cxx
TestParallelCoordinates.cxx
TestPieChart.cxx
TestPlotMatrix.cxx
TestScalarsToColors.cxx
TestScatterPlot.cxx
TestScatterPlotMatrix.cxx
TestScatterPlotMatrixVehicles.cxx
TestScatterPlotMatrixVisible.cxx
TestScientificPlot.cxx
TestStackedBarGraph.cxx
TestStackedPlot.cxx
TestSurfacePlot.cxx
)
# Set the tolerance higher for a few tests that need it
set(TestGLSLError 12)
set(TestChartsOn3DError 16)
set(TestLinePlotError 25)
set(TestLinePlot2Error 25)
set(TestLinePlotInteractionError 25)
set(TestMultipleRenderersError 25)
set(TestMultipleScalarsToColorsError 25)
set(TestParallelCoordinatesError 15)
set(TestControlPointsHandleItemError 30)
set(TestColorTransferFunctionError 80)
endif()
# Use the testing object factory, to reduce boilerplate code in tests. if(VTK_DATA_ROOT)
include(vtkTestingObjectFactory) # add tests that require data
vtk_module_test_executable(${vtk-module}CxxTests ${Tests}) vtk_add_test_cxx(Charts
TestAxes.cxx
set(TestsToRun ${Tests}) TestBarGraph.cxx
list(REMOVE_ITEM TestsToRun CxxTests.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 all the executables vtk_test_cxx_executable(${vtk-module}CxxTests RENDERING_FACTORY)
foreach(test ${TestsToRun})
get_filename_component(TName ${test} NAME_WE)
if(VTK_DATA_ROOT)
if(${${TName}Error})
set(_error_threshold ${${TName}Error})
else()
set(_error_threshold 10)
endif()
add_test(NAME ${vtk-module}Cxx-${TName}
COMMAND ${vtk-module}CxxTests ${TName}
-D ${VTK_DATA_ROOT}
-T ${VTK_TEST_OUTPUT_DIR}
-V Baseline/Charts/${TName}.png
-E ${_error_threshold})
else()
add_test(NAME ${vtk-module}Cxx-${TName}
COMMAND ${vtk-module}CxxTests ${TName})
endif()
endforeach()
set(CommonColorTests vtk_add_test_cxx(Common
TestCategoricalColors.cxx TestCategoricalColors.cxx
TestNamedColors.cxx TestNamedColors.cxx
) )
if (VTK_DATA_ROOT) if (VTK_DATA_ROOT)
set(CommonColorTestsWithArgs vtk_add_test_cxx(Common
TestColorSeries.cxx TestColorSeries.cxx
) )
endif() endif()
create_test_sourcelist(Tests ${vtk-module}CxxTests.cxx vtk_test_cxx_executable(${vtk-module}CxxTests)
${CommonColorTests}
${CommonColorTestsWithArgs}
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 (VTK_DATA_ROOT)
add_test(NAME ${vtk-module}Cxx-${TName}
COMMAND ${vtk-module}CxxTests ${TName}
-D ${VTK_DATA_ROOT}
-T ${VTK_TEST_OUTPUT_DIR}
-V Baseline/Common/${TName}.png)
else()
add_test(NAME ${vtk-module}Cxx-${TName}
COMMAND ${vtk-module}CxxTests ${TName})
endif()
endforeach()
create_test_sourcelist(Tests ${vtk-module}CxxTests.cxx # Tell TestSystemInformation where to find the build trees.
set(TestSystemInformation_ARGS ${CMAKE_BINARY_DIR})
# Tell TestXMLFileOutputWindow where to write test file
set(TestXMLFileOutputWindow_ARGS ${CMAKE_BINARY_DIR}/Testing/Temporary/XMLFileOutputWindow.txt)
vtk_add_test_cxx(NO_DATA NO_VALID NO_OUTPUT
TestArrayAPI.cxx TestArrayAPI.cxx
TestArrayAPIConvenience.cxx TestArrayAPIConvenience.cxx
TestArrayAPIDense.cxx TestArrayAPIDense.cxx
...@@ -46,24 +52,7 @@ create_test_sourcelist(Tests ${vtk-module}CxxTests.cxx ...@@ -46,24 +52,7 @@ create_test_sourcelist(Tests ${vtk-module}CxxTests.cxx
#otherLookupTable.cxx #otherLookupTable.cxx
#otherLookupTableWithEnabling.cxx #otherLookupTableWithEnabling.cxx
otherStringArray.cxx otherStringArray.cxx
)
EXTRA_INCLUDE vtkTestDriver.h vtk_test_cxx_executable(${vtk-module}CxxTests
)
vtk_module_test_executable(${vtk-module}CxxTests ${Tests}
vtkTestNewVar.cxx) vtkTestNewVar.cxx)
set(TestsToRun ${Tests})
list(REMOVE_ITEM TestsToRun ${vtk-module}CxxTests.cxx)
# Tell TestSystemInformation where to find the build trees.
set(TestSystemInformation_ARGS ${CMAKE_BINARY_DIR})
# Tell TestXMLFileOutputWindow where to write test file
set(TestXMLFileOutputWindow_ARGS ${CMAKE_BINARY_DIR}/Testing/Temporary/XMLFileOutputWindow.txt)
# Add all the executables
foreach(test ${TestsToRun})
get_filename_component(TName ${test} NAME_WE)
add_test(NAME ${vtk-module}-${TName} COMMAND ${vtk-module}CxxTests ${TName} ${${TName}_ARGS})
endforeach()
create_test_sourcelist(Tests ${vtk-module}CxxTests.cxx vtk_add_test_cxx(NO_DATA NO_VALID NO_OUTPUT
TestColor.cxx TestColor.cxx
TestVector.cxx TestVector.cxx
TestVectorOperators.cxx TestVectorOperators.cxx
...@@ -40,17 +40,5 @@ create_test_sourcelist(Tests ${vtk-module}CxxTests.cxx ...@@ -40,17 +40,5 @@ create_test_sourcelist(Tests ${vtk-module}CxxTests.cxx
TestPlane.cxx TestPlane.cxx
TestStructuredData.cxx TestStructuredData.cxx
TestDataObjectTypes.cxx TestDataObjectTypes.cxx
EXTRA_INCLUDE vtkTestDriver.h )
) vtk_test_cxx_executable(${vtk-module}CxxTests)
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)
add_test(NAME ${vtk-module}Cxx-${TName}
COMMAND ${vtk-module}CxxTests ${TName})
endforeach()
create_test_sourcelist(Tests ${vtk-module}CxxTests.cxx vtk_add_test_cxx(NO_DATA NO_VALID
TestCopyAttributeData.cxx TestCopyAttributeData.cxx
TestImageDataToStructuredGrid.cxx TestImageDataToStructuredGrid.cxx
TestSetInputDataObject.cxx TestSetInputDataObject.cxx
TestTemporalSupport.cxx TestTemporalSupport.cxx
EXTRA_INCLUDE vtkTestDriver.h )
) vtk_test_cxx_executable(${vtk-module}CxxTests)
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(VTK_DATA_ROOT)
add_test(NAME ${TName}
COMMAND ${vtk-module}CxxTests ${TName}
-D ${VTK_DATA_ROOT}
-T ${VTK_TEST_OUTPUT_DIR}
-V Baseline/${vtk-module}/${TName}.png)
else()
add_test(NAME ${TName}
COMMAND ${vtk-module}CxxTests ${TName}
-T ${VTK_TEST_OUTPUT_DIR}
)
endif()
endforeach()
set(Test_SRCS vtk_add_test_cxx(NO_DATA NO_VALID NO_OUTPUT
TestAmoebaMinimizer.cxx TestAmoebaMinimizer.cxx
TestMatrix3x3.cxx TestMatrix3x3.cxx
TestPolynomialSolversUnivariate.cxx TestPolynomialSolversUnivariate.cxx
TestQuaternion.cxx TestQuaternion.cxx
) )
if(NOT VTK_LEGACY_REMOVE) if(NOT VTK_LEGACY_REMOVE)
list(APPEND Test_SRCS vtk_add_test_cxx(NO_DATA NO_VALID NO_OUTPUT
TestFastNumericConversion.cxx TestFastNumericConversion.cxx
) )
endif() endif()
create_test_sourcelist(Tests ${vtk-module}CxxTests.cxx vtk_test_cxx_executable(${vtk-module}CxxTests)
${Test_SRCS}
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)
add_test(NAME ${vtk-module}Cxx-${TName} COMMAND ${vtk-module}CxxTests ${TName})
endforeach()
create_test_sourcelist(Tests ${vtk-module}CxxTests.cxx vtk_add_test_cxx(TestPolygonBuilder.cxx NO_DATA NO_VALID NO_OUTPUT)
TestPolygonBuilder.cxx vtk_test_cxx_executable(${vtk-module}CxxTests)
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)
add_test(NAME ${vtk-module}Cxx-${TName}
COMMAND ${vtk-module}CxxTests ${TName})
endforeach()
create_test_sourcelist(Tests ${vtk-module}CxxTests.cxx vtk_add_test_cxx(NO_DATA NO_VALID NO_OUTPUT
TestDirectory.cxx TestDirectory.cxx
otherTimerLog.cxx otherTimerLog.cxx
EXTRA_INCLUDE vtkTestDriver.h )
) vtk_test_cxx_executable(${vtk-module}CxxTests)
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)
add_test(NAME ${TName} COMMAND ${vtk-module}CxxTests ${TName})
endforeach()
set(MyTests vtk_add_test_cxx(Chemistry
TestBallAndStick.cxx TestBallAndStick.cxx
TestPDBBallAndStick.cxx TestPDBBallAndStick.cxx
TestBondColorModeDiscreteByAtom.cxx TestBondColorModeDiscreteByAtom.cxx
...@@ -20,36 +20,7 @@ set(MyTests ...@@ -20,36 +20,7 @@ set(MyTests
# Tests with data # Tests with data
if(VTK_DATA_ROOT) if(VTK_DATA_ROOT)
set(MyTests vtk_add_test_cxx(TestCMLMoleculeReader.cxx Chemistry)
${MyTests}
TestCMLMoleculeReader.cxx
)
endif() endif()
# Use the testing object factory, to reduce boilerplate code in tests. vtk_test_cxx_executable(${vtk-module}CxxTests RENDERING_FACTORY)
include(vtkTestingObjectFactory)
vtk_module_test_executable(${vtk-module}CxxTests ${Tests})
set(TestsToRun ${Tests})
list(REMOVE_ITEM TestsToRun CxxTests.cxx)
# Add all the executables
foreach(test ${TestsToRun})
get_filename_component(TName ${test} NAME_WE)
if(VTK_DATA_ROOT)
if(${${TName}Error})
set(_error_threshold ${${TName}Error})
else()
set(_error_threshold 10)
endif()
add_test(NAME ${vtk-module}Cxx-${TName}
COMMAND ${vtk-module}CxxTests ${TName}
-D ${VTK_DATA_ROOT}
-T ${VTK_TEST_OUTPUT_DIR}
-V Baseline/Chemistry/${TName}.png
-E ${_error_threshold})
else()
add_test(NAME ${vtk-module}Cxx-${TName}
COMMAND ${vtk-module}CxxTests ${TName})
endif()
endforeach ()
## List all test sources set(tests
set(MyTests TestAMRGhostLayerStripping
TestAMRGhostLayerStripping.cxx TestAMRBlanking
TestAMRBlanking.cxx TestAMRIterator
TestAMRIterator.cxx TestImageToAMR
TestImageToAMR.cxx )
) foreach(t ${tests})
vtk_add_test_cxx(${t}.cxx NO_VALID NO_OUTPUT)
## Create test source list set_property(TEST ${vtk-module}Cxx-${t} PROPERTY FAIL_REGULAR_EXPRESSION "Error")
create_test_sourcelist(Tests ${vtk-module}CxxTests.cxx
${MyTests}
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 executables
foreach(test ${TestsToRun})
get_filename_component(t ${test} NAME_WE)
add_test(NAME ${vtk-module}Cxx-${t}
COMMAND ${vtk-module}CxxTests ${t} -D ${VTK_DATA_ROOT})
set_tests_properties(${vtk-module}Cxx-${t} PROPERTIES FAIL_REGULAR_EXPRESSION "Error")
endforeach() endforeach()
vtk_test_cxx_executable(${vtk-module}CxxTests)
# Tests with data # Tests with data
if(VTK_DATA_ROOT) if(VTK_DATA_ROOT)
set(NEEDS_DATA vtk_add_test_cxx(Graphics
TestArrayCalculator TestArrayCalculator.cxx
) )
endif() endif()
create_test_sourcelist(Tests ${vtk-module}CxxTests.cxx vtk_add_test_cxx(Graphics
${NEEDS_DATA}
TestGhostArray.cxx TestGhostArray.cxx
# TestAppendPolyData.cxx # TestAppendPolyData.cxx
TestAppendSelection.cxx TestAppendSelection.cxx
...@@ -20,25 +19,5 @@ create_test_sourcelist(Tests ${vtk-module}CxxTests.cxx ...@@ -20,25 +19,5 @@ create_test_sourcelist(Tests ${vtk-module}CxxTests.cxx
TestImplicitPolyDataDistance.cxx TestImplicitPolyDataDistance.cxx
TestCutter.cxx TestCutter.cxx
TestThreshold.cxx TestThreshold.cxx
)
EXTRA_INCLUDE vtkTestDriver.h) vtk_test_cxx_executable(${vtk-module}CxxTests)
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(VTK_DATA_ROOT)
add_test(NAME ${vtk-module}Cxx-${TName}
COMMAND ${vtk-module}CxxTests ${TName}
-D ${VTK_DATA_ROOT}
-T ${VTK_TEST_OUTPUT_DIR}
-V Baseline/Graphics/${TName}.png)
else()
add_test(NAME ${vtk-module}Cxx-${TName}
COMMAND ${vtk-module}CxxTests ${TName})
endif()
endforeach()
\ No newline at end of file
create_test_sourcelist(Tests ${vtk-module}CxxTests.cxx vtk_add_test_cxx(Graphics
TestConvertSelection.cxx TestConvertSelection.cxx
TestExtractSelection.cxx TestExtractSelection.cxx
TestExtraction.cxx TestExtraction.cxx
EXTRA_INCLUDE vtkTestDriver.h )
) vtk_test_cxx_executable(${vtk-module}CxxTests)
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(VTK_DATA_ROOT)
add_test(NAME ${vtk-module}Cxx-${TName}
COMMAND ${vtk-module}CxxTests ${TName}
-D ${VTK_DATA_ROOT}
-T ${VTK_TEST_OUTPUT_DIR}
-V Baseline/Graphics/${TName}.png)
else()
add_test(NAME ${vtk-module}Cxx-${TName}
COMMAND ${vtk-module}CxxTests ${TName})
endif()
endforeach()
set(MyTests vtk_add_test_cxx(Graphics
TestBSPTree.cxx TestBSPTree.cxx
TestStreamTracer TestStreamTracer.cxx
TestAMRInterpolatedVelocityField TestAMRInterpolatedVelocityField.cxx
TestParticleTracers TestParticleTracers.cxx
) )
vtk_test_cxx_executable(${vtk-module}CxxTests RENDERING_FACTORY)
include(vtkTestingObjectFactory)
vtk_module_test_executable(${vtk-module}CxxTests ${Tests})