2 # NewGeom unit test system
6 # ADD_UNIT_TESTS(TestUndoRedo.py
9 # SET(PROJECT_UNIT_TESTS
13 # ADD_UNIT_TESTS(${PROJECT_UNIT_TESTS})
15 # Where "TestUndoRedo.py" and "TestResultBody.py" are names
16 # of python test scripts in the "./Test" directory.
17 # This macro will add "Subproject_" as prefix and
18 # remove ".py" for the test name automaticaly.
20 # Start building of the "RUN_TESTS" project in the Visual studio
21 # or run "make test" on linux stations to start the testing procedure.
27 foreach(eachFileName ${ARGN})
28 # Strip the ".py" suffix
29 GET_FILENAME_COMPONENT(aTestName ${eachFileName} NAME_WE)
31 # Add "SubprojectName_" prefix
32 GET_FILENAME_COMPONENT(aSubprojectName ${CMAKE_CURRENT_SOURCE_DIR} NAME)
33 SET(aTestName "${aSubprojectName}_${aTestName}")
35 # Full path to the python test file beeing executed
36 SET(aTestFileName "${CMAKE_CURRENT_SOURCE_DIR}/Test/${eachFileName}")
37 IF(EXISTS ${aTestFileName})
38 ADD_TEST(NAME ${aTestName}
39 COMMAND ${PYTHON_EXECUTABLE} ${aTestFileName})
41 #MESSAGE(STATUS "Test added: ${aTestName} file: ${aTestFileName}")
42 ELSE(EXISTS ${aTestFileName})
43 MESSAGE(WARNING "Can not find the test file: ${aTestFileName}")
44 ENDIF(EXISTS ${aTestFileName})
45 endforeach(eachFileName ${ARGN})
46 ENDMACRO(ADD_UNIT_TESTS)