Commit 437db4b1 authored by Brad King's avatar Brad King
Browse files

Restore VTK header tests removed by the modularization

Teach vtk_module_library to add a <module>.HeaderTest test.  Teach
HeaderTesting.py to exclude headers containing a special comment like
those added by the parent commit.

Exclude GUISupport/Qt* and Views/Qt because the modules have headers
that are not expected to follow VTK conventions.  Temporarily exclude
the Chemistry/Core module until its headers are fixed or marked as
excluded (they came from the Chemistry kit in monolithic VTK which had
no header test).

Change-Id: Ib6e1313a866db154f7b0e94aa340a10b16f8b9ca
parent 002f853f
......@@ -302,6 +302,14 @@ VTK_AUTOINIT(${vtk-module})
set_property(TARGET ${vtk-module} APPEND
PROPERTY COMPILE_FLAGS "${VTK_ABI_CXX_FLAGS}")
if(BUILD_TESTING AND PYTHON_EXECUTABLE AND NOT ${vtk-module}_NO_HeaderTest)
string(TOUPPER "${vtk-module}" MOD)
add_test(NAME ${vtk-module}.HeaderTest
COMMAND ${PYTHON_EXECUTABLE} ${VTK_SOURCE_DIR}/Testing/Core/HeaderTesting.py
${CMAKE_CURRENT_SOURCE_DIR} ${MOD}_EXPORT
)
endif()
# Add the module to the list of wrapped modules if necessary
vtk_add_wrapping(${vtk-module} "${ARGN}")
......
......@@ -333,9 +333,13 @@ find_file(VTK_WRAP_HINTS hints ${VTK_SOURCE_DIR}/Wrapping
NO_CMAKE_FIND_ROOT_PATH)
mark_as_advanced(VTK_WRAP_HINTS)
if(VTK_WRAP_PYTHON)
if(BUILD_TESTING OR VTK_WRAP_PYTHON)
# Need PYTHON_EXECUTABLE for HeaderTesting or python wrapping
find_package(PythonInterp QUIET)
mark_as_advanced(PYTHON_EXECUTABLE)
endif()
if(VTK_WRAP_PYTHON)
set(VTK_WRAP_PYTHON_EXE vtkWrapPython)
set(VTK_WRAP_PYTHON_INIT_EXE vtkWrapPythonInit)
set(VTK_PYTHON_EXE vtkpython)
......
......@@ -27,4 +27,5 @@ set_source_files_properties(
configure_file(${vtkChemistryCore_SOURCE_DIR}/vtkChemistryConfigure.h.in
${vtkChemistryCore_BINARY_DIR}/vtkChemistryConfigure.h IMMEDIATE)
set(${vtk-module}_NO_HeaderTest 1) # TODO: Fix headers and enable test.
vtk_module_library(vtkChemistryCore ${Module_SRCS})
......@@ -58,6 +58,7 @@ include(${QT_USE_FILE})
qt4_wrap_cpp(QVTKLibMocSrcs ${QVTKMocHeaders})
set(${vtk-module}_NO_HeaderTest 1)
vtk_module_library(${vtk-module} ${QVTKLibSrcs} ${QVTKLibMocSrcs})
target_link_libraries(${vtk-module} ${QT_LIBRARIES})
......
......@@ -14,5 +14,6 @@ include(${QT_USE_FILE})
qt4_wrap_cpp(LibMocSrcs ${MocHeaders})
set(${vtk-module}_NO_HeaderTest 1)
vtk_module_library(${vtk-module} ${LibSrcs} ${LibMocSrcs})
target_link_libraries(${vtk-module} ${QT_LIBRARIES})
......@@ -12,6 +12,7 @@ set(QT_USE_QTSQL 1)
find_package(Qt4 REQUIRED QUIET)
include(${QT_USE_FILE})
set(${vtk-module}_NO_HeaderTest 1)
vtk_module_library(${vtk-module} ${LibSrcs})
# Apply user-defined properties to the library target.
......
......@@ -16,6 +16,7 @@ include(${QT_USE_FILE})
qt4_wrap_cpp(LibMocSrcs ${MocHeaders})
set(${vtk-module}_NO_HeaderTest 1)
vtk_module_library(${vtk-module} ${LibSrcs} ${LibMocSrcs})
target_link_libraries(${vtk-module} ${QT_LIBRARIES})
......@@ -7,8 +7,6 @@ later. Remaining tasks include:
- Restore Examples directory build
- Restore HeaderTesting
- Restore Python SIP wrapping
- Restore Install test
......@@ -120,7 +120,21 @@ class TestVTKFiles:
except:
self.Print( "Problem reading file: %s" % filename )
sys.exit(1)
pass
return not self.CheckExclude()
def CheckExclude(self):
prefix = '// VTK-HeaderTest-Exclude:'
exclude = 0
for l in self.FileLines:
if l.startswith(prefix):
e = l[len(prefix):].strip()
if e == os.path.basename(self.FileName):
exclude += 1
else:
self.Error("Wrong exclusion: "+l.rstrip())
if exclude > 1:
self.Error("Multiple VTK-HeaderTest-Exclude lines")
return exclude > 0
def CheckIncludes(self):
count = 0
......@@ -436,9 +450,8 @@ for a in os.listdir(dirname):
## Skip directories
if stat.S_ISDIR(mode):
continue
elif stat.S_ISREG(mode):
elif stat.S_ISREG(mode) and test.TestFile(pathname):
## Do all the tests
test.TestFile(pathname)
test.CheckParent()
test.CheckIncludes()
test.CheckTypeMacro()
......
......@@ -24,6 +24,7 @@ include(${QT_USE_FILE})
qt4_wrap_cpp(LibMocSrcs ${MocHeaders})
set(${vtk-module}_NO_HeaderTest 1)
vtk_module_library(${vtk-module} ${LibSrcs} ${LibMocSrcs})
target_link_libraries(${vtk-module} ${QT_LIBRARIES})
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