Commit ade9d2a0 authored by saubatn's avatar saubatn
Browse files

UPDATED Functionnal tests: better readibility within the macro to understand...

UPDATED Functionnal tests: better readibility within the macro to understand how it works and output when running the tests.

git-svn-id: svn+ssh://scm.forge.imag.fr/var/lib/gforge/chroot/scmrepos/svn/camitk/trunk/camitk@2195 ec899d31-69d1-42ba-9299-647d76f65fb3
parent fefba26f
......@@ -1397,23 +1397,27 @@ macro(camitk_extension)
# Retrieve the current directory name to properly name the test
get_directory_name( ${CMAKE_CURRENT_SOURCE_DIR} COMP_DIR_NAME )
# Test should pass because application test runs with no arguments - shows usage and exit success
camitk_add_test( TEST_SUFFIX ${COMP_DIR_NAME} PROJECT_NAME ${${TYPE_EXTENSION_CMAKE}_TARGET_NAME} )
# Retrieve the files in testdata directory - a test will be applied for each of these files
get_subdirectoryfiles( ${CMAKE_CURRENT_SOURCE_DIR}/testdata/ctestdata TESTFILES )
# Different the test level to proceed
set( LEVEL0 0 )
set( LEVEL1 1 )
set( LEVEL2 2 )
set( LEVEL3 3 )
set( TESTLEVEL ${LEVEL3} )
# 1st test should pass because application test runs with no arguments - shows usage and exit success
camitk_add_test( TEST_SUFFIX LEVEL${LEVEL0}_
PROJECT_NAME ${${TYPE_EXTENSION_CMAKE}_TARGET_NAME}
)
# According options defined in Cmakelist enable or disable some tests
set(TEST_DESCRIPTION "Test opening the component, saving it as a file and compare the saved file with the original one.")
if( ${EXTENSION_NAME_CMAKE}_DISABLE_TESTLEVEL1 )
set( TESTLEVEL 0 )
set(TEST_DESCRIPTION "Run camitk-config.")
set(TESTLEVEL 0 )
set(TEST_DESCRIPTION "Run camitk-config." )
elseif( ${EXTENSION_NAME_CMAKE}_DISABLE_TESTLEVEL2 )
set( TESTLEVEL ${LEVEL1} )
set(TEST_DESCRIPTION "Test opening the component.")
......@@ -1428,29 +1432,63 @@ macro(camitk_extension)
# Give the file name (full path cut)
get_directory_name( ${COMPONENT_TESTDATA_FILE} DATA_FILE )
# Test procedure: Open an extension and a component(level1) - save it(level2) - Compare saved file to original file(level3)
# Test procedure: Open an extension and a component- save it - Compare saved file to original file(level3)
if( ${TESTLEVEL} EQUAL ${LEVEL3} )
if(MSVC)
camitk_add_test( EXECUTABLE_ARGS "-i ${CAMITK_BUILD_TESTDATA_DIR}/ctestdata/${DATA_FILE} -c ${CAMITK_BUILD_PRIVATE_LIB_DIR}/${TYPE_EXTENSION}s/${${TYPE_EXTENSION_CMAKE}_OUTPUT_NAME}${CAMITK_DEBUG_POSTFIX}.dll -l ${TESTLEVEL}" PASS_FILE_OUTPUT ${CAMITK_BUILD_TESTDATA_DIR}/ctestdata/${DATA_FILE} TEST_SUFFIX ${COMP_DIR_NAME}_LEVEL${TESTLEVEL}_ PROJECT_NAME ${${TYPE_EXTENSION_CMAKE}_TARGET_NAME} )
camitk_add_test( EXECUTABLE_ARGS "-i ${CAMITK_BUILD_TESTDATA_DIR}/ctestdata/${DATA_FILE}
-c ${CAMITK_BUILD_PRIVATE_LIB_DIR}/${TYPE_EXTENSION}s/${${TYPE_EXTENSION_CMAKE}_OUTPUT_NAME}${CAMITK_DEBUG_POSTFIX}.dll
-l ${TESTLEVEL}"
PASS_FILE_OUTPUT ${CAMITK_BUILD_TESTDATA_DIR}/ctestdata/${DATA_FILE}
TEST_SUFFIX LEVEL ${TESTLEVEL}_
PROJECT_NAME ${${TYPE_EXTENSION_CMAKE}_TARGET_NAME}
)
elseif(APPLE)
camitk_add_test( EXECUTABLE_ARGS "-i ${CAMITK_BUILD_TESTDATA_DIR}/ctestdata/${DATA_FILE} -c ${CAMITK_BUILD_PRIVATE_LIB_DIR}/${TYPE_EXTENSION}s/lib${${TYPE_EXTENSION_CMAKE}_OUTPUT_NAME}.dylib -l ${TESTLEVEL}" PASS_FILE_OUTPUT ${CAMITK_BUILD_TESTDATA_DIR}/ctestdata/${DATA_FILE} TEST_SUFFIX ${COMP_DIR_NAME}_LEVEL${TESTLEVEL}_ PROJECT_NAME ${${TYPE_EXTENSION_CMAKE}_TARGET_NAME} )
camitk_add_test( EXECUTABLE_ARGS "-i ${CAMITK_BUILD_TESTDATA_DIR}/ctestdata/${DATA_FILE}
-c ${CAMITK_BUILD_PRIVATE_LIB_DIR}/${TYPE_EXTENSION}s/lib${${TYPE_EXTENSION_CMAKE}_OUTPUT_NAME}.dylib
-l ${TESTLEVEL}"
PASS_FILE_OUTPUT ${CAMITK_BUILD_TESTDATA_DIR}/ctestdata/${DATA_FILE}
TEST_SUFFIX LEVEL ${TESTLEVEL}_
PROJECT_NAME ${${TYPE_EXTENSION_CMAKE}_TARGET_NAME}
)
elseif(UNIX)
camitk_add_test( EXECUTABLE_ARGS "-i ${CAMITK_BUILD_TESTDATA_DIR}/ctestdata/${DATA_FILE} -c ${CAMITK_BUILD_PRIVATE_LIB_DIR}/${TYPE_EXTENSION}s/lib${${TYPE_EXTENSION_CMAKE}_OUTPUT_NAME}.so -l ${TESTLEVEL}" PASS_FILE_OUTPUT ${CAMITK_BUILD_TESTDATA_DIR}/ctestdata/${DATA_FILE} TEST_SUFFIX ${COMP_DIR_NAME}_LEVEL${TESTLEVEL}_ PROJECT_NAME ${${TYPE_EXTENSION_CMAKE}_TARGET_NAME} )
camitk_add_test( EXECUTABLE_ARGS "-i ${CAMITK_BUILD_TESTDATA_DIR}/ctestdata/${DATA_FILE}
-c ${CAMITK_BUILD_PRIVATE_LIB_DIR}/${TYPE_EXTENSION}s/lib${${TYPE_EXTENSION_CMAKE}_OUTPUT_NAME}.so
-l ${TESTLEVEL}"
PASS_FILE_OUTPUT ${CAMITK_BUILD_TESTDATA_DIR}/ctestdata/${DATA_FILE}
TEST_SUFFIX LEVEL ${TESTLEVEL}_
PROJECT_NAME ${${TYPE_EXTENSION_CMAKE}_TARGET_NAME}
)
endif()
camitk_parse_test_add(NAME ${CAMITK_TEST_NAME} LEVEL ${TESTLEVEL} DESCRIPTION ${TEST_DESCRIPTION})
MATH(EXPR TESTLEVEL "${TESTLEVEL}-1")#Decrease the test level to proceed less arduous tests
camitk_parse_test_add(NAME ${CAMITK_TEST_NAME} LEVEL ${TESTLEVEL} DESCRIPTION ${TEST_DESCRIPTION})
MATH(EXPR TESTLEVEL "${TESTLEVEL}-1") #Decrease the test level to proceed less arduous tests
endif()
# Test procedure: Open an extension and a component(level1) - save it(level2)
while( ${TESTLEVEL} GREATER 0)
if(MSVC)
camitk_add_test( EXECUTABLE_ARGS "-i ${CAMITK_BUILD_TESTDATA_DIR}/ctestdata/${DATA_FILE} -c ${CAMITK_BUILD_PRIVATE_LIB_DIR}/${TYPE_EXTENSION}s/${${TYPE_EXTENSION_CMAKE}_OUTPUT_NAME}${CAMITK_DEBUG_POSTFIX}.dll -l ${TESTLEVEL}" TEST_SUFFIX ${COMP_DIR_NAME}_LEVEL${TESTLEVEL}_ PROJECT_NAME ${${TYPE_EXTENSION_CMAKE}_TARGET_NAME} )
camitk_add_test( EXECUTABLE_ARGS "-i ${CAMITK_BUILD_TESTDATA_DIR}/ctestdata/${DATA_FILE}
-c ${CAMITK_BUILD_PRIVATE_LIB_DIR}/${TYPE_EXTENSION}s/${${TYPE_EXTENSION_CMAKE}_OUTPUT_NAME}${CAMITK_DEBUG_POSTFIX}.dll
-l ${TESTLEVEL}"
TEST_SUFFIX LEVEL ${TESTLEVEL}_
PROJECT_NAME ${${TYPE_EXTENSION_CMAKE}_TARGET_NAME}
)
elseif(APPLE)
camitk_add_test( EXECUTABLE_ARGS "-i ${CAMITK_BUILD_TESTDATA_DIR}/ctestdata/${DATA_FILE} -c ${CAMITK_BUILD_PRIVATE_LIB_DIR}/${TYPE_EXTENSION}s/lib${${TYPE_EXTENSION_CMAKE}_OUTPUT_NAME}.dylib -l ${TESTLEVEL}" TEST_SUFFIX ${COMP_DIR_NAME}_LEVEL${TESTLEVEL}_ PROJECT_NAME ${${TYPE_EXTENSION_CMAKE}_TARGET_NAME} )
camitk_add_test( EXECUTABLE_ARGS "-i ${CAMITK_BUILD_TESTDATA_DIR}/ctestdata/${DATA_FILE}
-c ${CAMITK_BUILD_PRIVATE_LIB_DIR}/${TYPE_EXTENSION}s/lib${${TYPE_EXTENSION_CMAKE}_OUTPUT_NAME}.dylib
-l ${TESTLEVEL}"
TEST_SUFFIX LEVEL ${TESTLEVEL}_
PROJECT_NAME ${${TYPE_EXTENSION_CMAKE}_TARGET_NAME}
)
elseif(UNIX)
camitk_add_test( EXECUTABLE_ARGS "-i ${CAMITK_BUILD_TESTDATA_DIR}/ctestdata/${DATA_FILE} -c ${CAMITK_BUILD_PRIVATE_LIB_DIR}/${TYPE_EXTENSION}s/lib${${TYPE_EXTENSION_CMAKE}_OUTPUT_NAME}.so -l ${TESTLEVEL}" TEST_SUFFIX ${COMP_DIR_NAME}_LEVEL${TESTLEVEL}_ PROJECT_NAME ${${TYPE_EXTENSION_CMAKE}_TARGET_NAME} )
camitk_add_test( EXECUTABLE_ARGS "-i ${CAMITK_BUILD_TESTDATA_DIR}/ctestdata/${DATA_FILE}
-c ${CAMITK_BUILD_PRIVATE_LIB_DIR}/${TYPE_EXTENSION}s/lib${${TYPE_EXTENSION_CMAKE}_OUTPUT_NAME}.so
-l ${TESTLEVEL}"
TEST_SUFFIX LEVEL ${TESTLEVEL}_
PROJECT_NAME ${${TYPE_EXTENSION_CMAKE}_TARGET_NAME}
)
endif()
camitk_parse_test_add(NAME ${CAMITK_TEST_NAME} LEVEL ${TESTLEVEL} DESCRIPTION ${TEST_DESCRIPTION})
MATH(EXPR TESTLEVEL "${TESTLEVEL}-1")#Decrease the test level to proceed less arduous tests
MATH(EXPR TESTLEVEL "${TESTLEVEL}-1")# Decrease the test level to proceed less arduous tests
endwhile()
set( TESTLEVEL ${LEVELORIGIN} )
endforeach()
......@@ -1468,23 +1506,35 @@ macro(camitk_extension)
get_directory_name( ${CMAKE_CURRENT_SOURCE_DIR} COMP_DIR_NAME )
# Test should pass because application test runs with no arguments - shows usage and exit success
camitk_add_test( TEST_SUFFIX ${COMP_DIR_NAME} PROJECT_NAME ${${TYPE_EXTENSION_CMAKE}_TARGET_NAME} )
camitk_add_test( TEST_SUFFIX LEVEL${LEVEL0}_ PROJECT_NAME ${${TYPE_EXTENSION_CMAKE}_TARGET_NAME} )
#get the names of actions .dlls in lib directory
get_subdirectoryfiles( ${CAMITK_BUILD_PRIVATE_LIB_DIR}/actions/ ACTIONSDLLS )
foreach( ACTION_TESTDATA_FILE ${${EXTENSION_NAME_CMAKE}_TEST_FILES} )
# Next line is only useful macro debug => comment from now
#message( STATUS "Action extension: " ${${TYPE_EXTENSION_CMAKE}_OUTPUT_NAME} " Test file: " ${ACTION_TESTDATA_FILE} )
# message( STATUS "Action extension: " ${${TYPE_EXTENSION_CMAKE}_OUTPUT_NAME} " Test file: " ${ACTION_TESTDATA_FILE} )
if( NOT ( ${${TYPE_EXTENSION_CMAKE}_OUTPUT_NAME} MATCHES "application" ) )#We do not apply tests on actions like (close, save, save as)
if( NOT ( ${${TYPE_EXTENSION_CMAKE}_OUTPUT_NAME} MATCHES "application" ) )# We do not apply tests on actions like (close, save, save as)
# Test procedure: Open a file - load an action extension - Apply an action on the component wrapping the file
if(MSVC)
camitk_add_test( EXECUTABLE_ARGS "-i ${CAMITK_BUILD_TESTDATA_DIR}/ctestdata/${ACTION_TESTDATA_FILE} -a lib${${TYPE_EXTENSION_CMAKE}_OUTPUT_NAME}${CAMITK_DEBUG_POSTFIX}.dll" TEST_SUFFIX ${COMP_DIR_NAME} PROJECT_NAME ${${TYPE_EXTENSION_CMAKE}_TARGET_NAME} )
camitk_add_test( EXECUTABLE_ARGS "-i ${CAMITK_BUILD_TESTDATA_DIR}/ctestdata/${ACTION_TESTDATA_FILE}
-a lib${${TYPE_EXTENSION_CMAKE}_OUTPUT_NAME}${CAMITK_DEBUG_POSTFIX}.dll"
TEST_SUFFIX ${COMP_DIR_NAME}
PROJECT_NAME ${${TYPE_EXTENSION_CMAKE}_TARGET_NAME}
)
elseif(APPLE)
camitk_add_test( EXECUTABLE_ARGS "-i ${CAMITK_BUILD_TESTDATA_DIR}/ctestdata/${ACTION_TESTDATA_FILE} -a lib${${TYPE_EXTENSION_CMAKE}_OUTPUT_NAME}.dylib" TEST_SUFFIX ${COMP_DIR_NAME} PROJECT_NAME ${${TYPE_EXTENSION_CMAKE}_TARGET_NAME} )
camitk_add_test( EXECUTABLE_ARGS "-i ${CAMITK_BUILD_TESTDATA_DIR}/ctestdata/${ACTION_TESTDATA_FILE}
-a lib${${TYPE_EXTENSION_CMAKE}_OUTPUT_NAME}.dylib"
TEST_SUFFIX ${COMP_DIR_NAME}
PROJECT_NAME ${${TYPE_EXTENSION_CMAKE}_TARGET_NAME}
)
elseif(UNIX)
camitk_add_test( EXECUTABLE_ARGS "-i ${CAMITK_BUILD_TESTDATA_DIR}/ctestdata/${ACTION_TESTDATA_FILE} -a lib${${TYPE_EXTENSION_CMAKE}_OUTPUT_NAME}.so" TEST_SUFFIX ${COMP_DIR_NAME} PROJECT_NAME ${${TYPE_EXTENSION_CMAKE}_TARGET_NAME} )
camitk_add_test( EXECUTABLE_ARGS "-i ${CAMITK_BUILD_TESTDATA_DIR}/ctestdata/${ACTION_TESTDATA_FILE}
-a lib${${TYPE_EXTENSION_CMAKE}_OUTPUT_NAME}.so"
TEST_SUFFIX LEVEL1_
PROJECT_NAME ${${TYPE_EXTENSION_CMAKE}_TARGET_NAME}
)
endif()
camitk_parse_test_add(NAME ${CAMITK_TEST_NAME} LEVEL 3 DESCRIPTION "Open a file, load the action and apply it on the component.")
endif()
......
Supports Markdown
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