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
|
# Test to ensure that code doesn't call exit()
SET(ERROR_COUNT 0)
SET(SKIP_FILES
"^[.]hg/.*$"
"[.]yaml$"
"^application/k3d_main.cpp$"
"^k3dsdk/application_detail.cpp$"
"^k3dsdk/application_detail.h$"
"^k3dsdk/ftgl/ChangeLog$"
"^k3dsdk/ftgl/Makefile.in$"
"^k3dsdk/iapplication.h$"
"^k3dsdk/ngui/application_state.cpp$"
"^k3dsdk/python/object_model_python.cpp$"
"^man/k3d.1.in$"
"^modules/inotify/inotify-cxx.h$"
"^modules/ngui_python_shell/dialog.cpp$"
"^modules/obj_io/obj_specification.txt$"
"^modules/qslim/MxStdModel.cpp$"
"^renderframe/main.cpp$"
"^renderjob/main.cpp$"
"^resource-compiler/main.cpp$"
"^share/lsystem/fractint2.ls$"
"^share/scripts/shell/batch_render.py$"
"^share/scripts/shell/simple_rpc.py$"
"^sl2xml/main.cpp$"
"^tests/CMakeLists.txt$"
"^tests/code/CMakeLists.txt$"
"^tests/code/exit.cmake$"
"^tests/other/document.stress.read_all_properties.py$"
"^tests/python/module.py$"
)
FILE(GLOB_RECURSE SOURCE_FILES "*")
LIST(SORT SOURCE_FILES)
FOREACH(SOURCE_FILE ${SOURCE_FILES})
FILE(RELATIVE_PATH RELATIVE_SOURCE_FILE ${CMAKE_CURRENT_SOURCE_DIR} ${SOURCE_FILE})
SET(TEST_FILE 1)
FOREACH(SKIP_FILE ${SKIP_FILES})
IF(RELATIVE_SOURCE_FILE MATCHES "${SKIP_FILE}")
SET(TEST_FILE 0)
ENDIF()
ENDFOREACH()
IF(TEST_FILE)
FILE(READ ${SOURCE_FILE} SOURCE)
IF(SOURCE MATCHES "exit")
MATH(EXPR ERROR_COUNT "${ERROR_COUNT} + 1")
MESSAGE("${SOURCE_FILE}")
ENDIF()
ENDIF()
ENDFOREACH(SOURCE_FILE)
IF(ERROR_COUNT)
MESSAGE(SEND_ERROR "Found ${ERROR_COUNT} files calling exit(), which should never happen. Contact the mailing list for guidance.")
ENDIF()
|