[vtk-developers] Testing of header files

Andy Cedilnik andy.cedilnik at kitware.com
Wed Aug 14 14:07:16 EDT 2002


Hello All,

Just wanted to let you know that I wrote a simple python script which
tests VTK header files of a specific kit. Currently it tests Hybrid,
Patented, Parallel, and IO. The script is called HeaderTesting.py.

Its tests include:

* copy constructor and assignment operator 
	(if they exist, what format they are etc.)

* other constructors (if they exist) 
  // It only allows one constructor in format:
  vtkSomeClass();

* check for include files

   - header file has to include parent class
   - it should not include any other classes
   - if some class is absolutely necessary to be included, it has
      to include a comment why it is included
   - system headers should never be included in header files

* check for vtkTypeRevisionMacro, if there is vtkTypeMacro, it reports
  about old type macro, reports if there is none, or if the arguments
  are wrong (such as wrong superclass)

And more.

Please when modifying header files in VTK and/or adding new classes,
check these tests if they passed. They may not run on all dashboards as
some do not have python executable.

If you have idea for more stylistic or syntactic checks we should do,
let me know and I will add them.

If you want to add this test to your project (which is derived from
VTK), include the following in the CMakeLists.txt:

IF(PYTHON_EXECUTABLE)
  ADD_TEST(HeaderTesting-Kit ${PYTHON_EXECUTABLE}
           ${VTK_SOURCE_DIR}/Common/Testing/HeaderTesting.py
	   "${VTK_SOURCE_DIR}/Kit"
           vtkFoo.h
           vtkBar.h
           )
ENDIF(PYTHON_EXECUTABLE)

Where Kit is the name of directory that you are testing and vtkFoo.h and
vtkBar.h are files that should be excluded. 

				Andy Cedilnik






More information about the vtk-developers mailing list