Merge pull request #3356 from jet47:ctest-support

pull/3336/head
Vadim Pisarevsky 10 years ago
commit 1692801fc5
  1. 2
      CMakeLists.txt
  2. 37
      cmake/OpenCVModule.cmake

@ -58,6 +58,8 @@ if(DEFINED CMAKE_BUILD_TYPE AND CMAKE_VERSION VERSION_GREATER "2.8")
set_property( CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS ${CMAKE_CONFIGURATION_TYPES} ) set_property( CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS ${CMAKE_CONFIGURATION_TYPES} )
endif() endif()
enable_testing()
project(OpenCV CXX C) project(OpenCV CXX C)
if(MSVC) if(MSVC)

@ -761,6 +761,22 @@ function(ocv_add_perf_tests)
ocv_add_precompiled_headers(${the_target}) ocv_add_precompiled_headers(${the_target})
if(CMAKE_VERSION VERSION_GREATER "2.8" AND OPENCV_TEST_DATA_PATH)
add_test(NAME ${the_target} COMMAND ${the_target} --perf_min_samples=1 --perf_force_samples=1 --perf_verify_sanity)
get_filename_component(cur_modules_loc "${CMAKE_CURRENT_SOURCE_DIR}/.." ABSOLUTE)
get_filename_component(default_modules_loc "${CMAKE_SOURCE_DIR}/modules" ABSOLUTE)
if("${cur_modules_loc}" STREQUAL "${default_modules_loc}")
set(test_category "Public")
else()
set(test_category "Extra")
endif()
set_tests_properties(${the_target} PROPERTIES
LABELS "${test_category};Sanity"
ENVIRONMENT "OPENCV_TEST_DATA_PATH=${OPENCV_TEST_DATA_PATH}")
endif()
else(OCV_DEPENDENCIES_FOUND) else(OCV_DEPENDENCIES_FOUND)
# TODO: warn about unsatisfied dependencies # TODO: warn about unsatisfied dependencies
endif(OCV_DEPENDENCIES_FOUND) endif(OCV_DEPENDENCIES_FOUND)
@ -812,11 +828,24 @@ function(ocv_add_accuracy_tests)
set_target_properties(${the_target} PROPERTIES FOLDER "tests accuracy") set_target_properties(${the_target} PROPERTIES FOLDER "tests accuracy")
endif() endif()
enable_testing()
get_target_property(LOC ${the_target} LOCATION)
add_test(${the_target} "${LOC}")
ocv_add_precompiled_headers(${the_target}) ocv_add_precompiled_headers(${the_target})
if(CMAKE_VERSION VERSION_GREATER "2.8" AND OPENCV_TEST_DATA_PATH AND NOT "${the_target}" MATCHES "opencv_test_viz")
add_test(NAME ${the_target} COMMAND ${the_target})
get_filename_component(cur_modules_loc "${CMAKE_CURRENT_SOURCE_DIR}/.." ABSOLUTE)
get_filename_component(default_modules_loc "${CMAKE_SOURCE_DIR}/modules" ABSOLUTE)
if("${cur_modules_loc}" STREQUAL "${default_modules_loc}")
set(test_category "Public")
else()
set(test_category "Extra")
endif()
set_tests_properties(${the_target} PROPERTIES
LABELS "${test_category};Accuracy"
ENVIRONMENT "OPENCV_TEST_DATA_PATH=${OPENCV_TEST_DATA_PATH}")
endif()
else(OCV_DEPENDENCIES_FOUND) else(OCV_DEPENDENCIES_FOUND)
# TODO: warn about unsatisfied dependencies # TODO: warn about unsatisfied dependencies
endif(OCV_DEPENDENCIES_FOUND) endif(OCV_DEPENDENCIES_FOUND)

Loading…
Cancel
Save