33 if (NOT PACKAGING_NSIS AND BUILD_TESTING)
36 set(multiValueArgs ACTION_EXTENSIONS TEST_FILES)
37 cmake_parse_arguments(CAMITK_ADDITIONAL_ACTION_TEST
"${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
39 # COMPONENT_EXTENSION_PLUGIN_FILE
40 # determine the extension full file name depending on the plateform
42 set(COMPONENT_EXTENSION_PLUGIN_FILE
"components/${${TYPE_EXTENSION_CMAKE}_OUTPUT_NAME}${CAMITK_DEBUG_POSTFIX}.dll")
44 set(COMPONENT_EXTENSION_PLUGIN_FILE
"components/lib${${TYPE_EXTENSION_CMAKE}_OUTPUT_NAME}.dylib")
47 set(COMPONENT_EXTENSION_PLUGIN_FILE
"components/lib${${TYPE_EXTENSION_CMAKE}_OUTPUT_NAME}.so")
50 # if this is not SDK, then it is required 51 if(NOT CAMITK_COMMUNITY_EDITION_BUILD)
52 set(ADDITIONAL_COMPONENT_EXTENSION_ARG
"-c ${CAMITK_BUILD_PRIVATE_LIB_DIR}/${COMPONENT_EXTENSION_PLUGIN_FILE}")
56 # if (action extension exists in repository) CAMITK_USER_PRIVATE_LIB_DIR CAMITK_PRIVATE_LIB_DIR CAMITK_BUILD_PRIVATE_LIB_DIR 57 # loop over test files 59 # math(EXPR CAMITK_ADDITIONNAL_TEST_ID "${CAMITK_ADDITIONNAL_TEST_ID} + 1") 60 foreach(ACTION_EXTENSION ${CAMITK_ADDITIONAL_ACTION_TEST_ACTION_EXTENSIONS})
61 # determine the extension full file name depending on the plateform
63 set(EXTENSION_FILE
"actions/${ACTION_EXTENSION}${CAMITK_DEBUG_POSTFIX}.dll")
65 set(EXTENSION_FILE
"$actions/lib${ACTION_EXTENSION}.dylib")
68 set(EXTENSION_FILE
"actions/lib${ACTION_EXTENSION}.so")
71 # check if action can be found in (this order) : build dir (CAMITK_BUILD_PRIVATE_LIB_DIR), 72 # local user install (CAMITK_USER_PRIVATE_LIB_DIR, and global install (CAMITK_PRIVATE_LIB_DIR) 73 set(ACTION_EXTENSION_PLUGIN_FILE ${CAMITK_BUILD_PRIVATE_LIB_DIR}/${EXTENSION_FILE})
74 set(ACTION_EXTENSION_TARGET
"action-${ACTION_EXTENSION}")
75 # The action should already be compiled. 76 # if the action does not yet exists, if there is a target of the current project 77 # that will build it, then it is ok as well. 78 # otherwise, it should be already installed locally or globally 79 if ((NOT EXISTS ${ACTION_EXTENSION_PLUGIN_FILE}) AND (NOT TARGET ${ACTION_EXTENSION_TARGET}))
80 set(ACTION_EXTENSION_PLUGIN_FILE ${CAMITK_USER_PRIVATE_LIB_DIR}/${EXTENSION_FILE})
81 if (NOT EXISTS ${ACTION_EXTENSION_PLUGIN_FILE})
82 set(ACTION_EXTENSION_PLUGIN_FILE ${CAMITK_PRIVATE_LIB_DIR}/${EXTENSION_FILE})
83 if (NOT EXISTS ${ACTION_EXTENSION_PLUGIN_FILE})
84 message(SEND_ERROR
"Action extension \"${ACTION_EXTENSION}\" not found: no additional test added")
90 message(STATUS "Adding additional autotest for action-${ACTION_EXTENSION}
") 91 if (CAMITK_COMMUNITY_EDITION_BUILD) 92 camitk_init_test(application-testactions) 94 camitk_init_test(camitk-testactions) 97 # add a separator to the wiki page information 98 camitk_parse_test_add_separator(EXTENSION_TYPE actions EXTENSION_NAME ${ACTION_EXTENSION}) 100 # Retrieve the files in testdata directory - a test will be applied for each of these files 101 # or use only the given files 102 if (CAMITK_ADDITIONAL_ACTION_TEST_TEST_FILES) 103 # add testdata dir to filename 105 foreach(COMPONENT_TESTDATA_FILE ${CAMITK_ADDITIONAL_ACTION_TEST_TEST_FILES}) 106 list(APPEND TESTFILES ${CMAKE_CURRENT_SOURCE_DIR}/testdata/${COMPONENT_TESTDATA_FILE}) 109 get_subdirectoryfiles( ${CMAKE_CURRENT_SOURCE_DIR}/testdata TESTFILES ) 112 foreach( ACTION_TESTDATA_FILE ${TESTFILES}) 113 # Test procedure: Open a file - load an action extension - Apply an action on the component wrapping the file 114 camitk_add_test(EXECUTABLE_ARGS "-i ${ACTION_TESTDATA_FILE} -
a ${ACTION_EXTENSION_PLUGIN_FILE} ${ADDITIONAL_COMPONENT_EXTENSION_ARG}
" 115 TEST_SUFFIX "-additional-${ACTION_EXTENSION}-level1-
" 116 PROJECT_NAME "component-${EXTENSION_NAME}
" 118 # add test to the wiki page information 119 camitk_parse_test_add(NAME ${CAMITK_TEST_NAME} LEVEL 1 DESCRIPTION "Open
a file, load the action and apply it on the component.
") cmake modules macros camitk test endif() add_custom_target(camitk-ce-iwyu COMMAND $
Definition: CamiTKIncludeWhatYouUse.h:37
camitk_additional_action_test()
camitk_additional_action_test is a macro to create additional level1 test of CamiTK action to the CTe...
Definition: CamiTKAdditionalActionTest.h:32