Skip to content

Commit

Permalink
[Cleanup] Clean testing scripts
Browse files Browse the repository at this point in the history
Use CTest instead of Darts
  • Loading branch information
drdanz committed Nov 5, 2013
1 parent 2855168 commit d35ddd0
Show file tree
Hide file tree
Showing 4 changed files with 98 additions and 108 deletions.
5 changes: 0 additions & 5 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,6 @@ include(YarpCMakeWorkarounds)
# See conf/YarpFindDependencies.cmake.
include(YarpFindDependencies)

# Turn on testing.
if(YARP_COMPILE_TESTS)
enable_testing()
endif()

# Make some custom header files containing compile settings.
add_subdirectory(conf)

Expand Down
8 changes: 2 additions & 6 deletions CTestConfig.cmake
Original file line number Diff line number Diff line change
@@ -1,19 +1,15 @@
# Copyright (C) 2010 RobotCub Consortium
# Authors: Paul Fitzpatrick, Lorenzo Natale
# CopyPolicy: Released under the terms of the LGPLv2.1 or later, see LGPL.TXT

# From: http://www.cmake.org/Wiki/CMake_Testing_With_CTest

## This file should be placed in the root directory of your project.
## Then modify the CMakeLists.txt file in the root directory of your
## project to incorporate the testing dashboard.
## # The following are required to uses Dart and the Cdash dashboard
## ENABLE_TESTING()
## INCLUDE(Dart)
## INCLUDE(CTest)
set(CTEST_PROJECT_NAME "YARP")
set(CTEST_NIGHTLY_START_TIME "00:00:00 CEST")

set(CTEST_DROP_METHOD "http")
set(CTEST_DROP_SITE "dashboard.icub.org")
set(CTEST_DROP_LOCATION "/submit.php?project=YARP")
set(CTEST_DROP_SITE_CDASH TRUE)

58 changes: 29 additions & 29 deletions conf/YarpOptions.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -148,11 +148,11 @@ if(YARP_CLEAN_API)
else(WIN32)
message(STATUS "Since tests access non-public classes, we'll need to leave all symbols in the shared libraries. If this is undesired, turn one of YARP_COMPILE_TESTS or CREATE_SHARED_LIBRARY off.")
endif(WIN32)
else(YARP_COMPILE_TESTS)
else()
set(YARP_FILTER_API TRUE)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${VISIBILITY_HIDDEN_FLAGS}")
endif(YARP_COMPILE_TESTS)
endif(YARP_CLEAN_API)
endif()
endif()


#########################################################################
Expand Down Expand Up @@ -197,9 +197,9 @@ endif(YARP_EXPERIMENTAL_HARDENING)
option(YARP_EXPERIMENTAL_CXX11 "Build YARP using C++11 standard" FALSE)
mark_as_advanced(YARP_EXPERIMENTAL_CXX11)
if(YARP_EXPERIMENTAL_CXX11)
add_definitions("-DYARP_CXX11")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${CXX11_FLAGS}")
set(YARP_HAS_CXX11 TRUE)
add_definitions("-DYARP_CXX11")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${CXX11_FLAGS}")
set(YARP_HAS_CXX11 TRUE)
endif(YARP_EXPERIMENTAL_CXX11)


Expand All @@ -212,13 +212,13 @@ endif(YARP_EXPERIMENTAL_CXX11)

option(YARP_WRAP_STL_STRING "Do you want the yarp string classes to wrap std::string? (as opposed to being exactly std::string)" TRUE)
mark_as_advanced(YARP_WRAP_STL_STRING)
set (YARP_WRAP_STL_STRING_INLINE_DEFAULT TRUE)
if (MSVC)
set (YARP_WRAP_STL_STRING_INLINE_DEFAULT FALSE)
endif ()
set(YARP_WRAP_STL_STRING_INLINE_DEFAULT TRUE)
if(MSVC)
set(YARP_WRAP_STL_STRING_INLINE_DEFAULT FALSE)
endif()
option(YARP_WRAP_STL_STRING_INLINE "If wrapping std::string, should we use an inline implementation? (as opposed to opaque)" ${YARP_WRAP_STL_STRING_INLINE_DEFAULT})
mark_as_advanced(YARP_WRAP_STL_STRING_INLINE)


#########################################################################
# Control compilation of device tests.
Expand All @@ -231,23 +231,23 @@ mark_as_advanced(CREATE_BUILTIN_DEVICE_TESTS)
# Control submission of reports
option(ENABLE_DASHBOARD_SUBMIT "Allow submission of builds to http://dashboard.icub.org/index.php?project=YARP" OFF)
if (ENABLE_DASHBOARD_SUBMIT)
include(Dart)
endif (ENABLE_DASHBOARD_SUBMIT)
include(CTest)
endif()


#########################################################################
# Control setting an rpath
if (NOT MSVC)
option(INSTALL_WITH_RPATH "When installing YARP, give executables a full RPATH" FALSE)
option(ENABLE_FORCE_RPATH "Set an rpath after installing the executables (deprecated, please use INSTALL_WITH_RPATH" FALSE)
mark_as_advanced(ENABLE_FORCE_RPATH)
endif (NOT MSVC)
if(NOT MSVC)
option(INSTALL_WITH_RPATH "When installing YARP, give executables a full RPATH" FALSE)
option(ENABLE_FORCE_RPATH "Set an rpath after installing the executables (deprecated, please use INSTALL_WITH_RPATH" FALSE)
mark_as_advanced(INSTALL_WITH_RPATH ENABLE_FORCE_RPATH)
endif()

if (INSTALL_WITH_RPATH OR ENABLE_FORCE_RPATH)
set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib")
set(CMAKE_INSTALL_NAME_DIR "${CMAKE_INSTALL_PREFIX}/lib")
set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
endif ()
if(INSTALL_WITH_RPATH OR ENABLE_FORCE_RPATH)
set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib")
set(CMAKE_INSTALL_NAME_DIR "${CMAKE_INSTALL_PREFIX}/lib")
set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
endif()


#########################################################################
Expand All @@ -268,8 +268,8 @@ if(CXX_HAS_WERROR)
mark_as_advanced(YARP_ABORT_ON_WARNING)
if(YARP_ABORT_ON_WARNING)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Werror")
endif(YARP_ABORT_ON_WARNING)
endif(CXX_HAS_WERROR)
endif()
endif()


### -Wfatal-errors
Expand All @@ -278,14 +278,14 @@ if(CXX_HAS_WFATAL_ERROR)
mark_as_advanced(YARP_FATAL_ERRORS)
if(YARP_FATAL_ERRORS)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wfatal-errors")
endif(YARP_FATAL_ERRORS)
endif(CXX_HAS_WFATAL_ERROR)
endif()
endif()

#########################################################################
# Display test machine options for reference, if they are set

if (TEST_MACHINE_HOSTNAME)
if(TEST_MACHINE_HOSTNAME)
message(STATUS "TEST_MACHINE_HOSTNAME: ${TEST_MACHINE_HOSTNAME}")
message(STATUS "TEST_MACHINE_OS_TYPE: ${TEST_MACHINE_OS_TYPE}")
message(STATUS "TEST_MACHINE_TEST_TYPE: ${TEST_MACHINE_TEST_TYPE}")
endif ()
endif()
135 changes: 67 additions & 68 deletions src/tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,78 +4,77 @@

option(YARP_COMPILE_TESTS "Compile YARP tests" TRUE)

if (YARP_COMPILE_TESTS)
if(YARP_COMPILE_TESTS)
enable_testing()

if (YARP_USE_PERSISTENT_NAMESERVER)
add_definitions(-DYARP_USE_PERSISTENT_NAMESERVER=1)
include_directories(${CMAKE_SOURCE_DIR}/src/yarpserver/include)
endif()
if(YARP_USE_PERSISTENT_NAMESERVER)
add_definitions(-DYARP_USE_PERSISTENT_NAMESERVER=1)
include_directories(${CMAKE_SOURCE_DIR}/src/yarpserver/include)
endif()

add_executable(testModule ../libYARP_OS/harness/testModule/module.cpp)
target_link_libraries(testModule YARP_init YARP_OS)

#### temporary variable for debug
set(ENABLE_YARPRUNTESTS FALSE CACHE BOOL "Enable yarprun tests")
if (ENABLE_YARPRUNTESTS)
add_definitions(-DYARPRUN_TEST)
endif()
mark_as_advanced(ENABLE_YARPRUNTESTS)

set(targets OS sig dev)
get_property(YARP_HAS_MATH_LIB GLOBAL PROPERTY YARP_HAS_MATH_LIB)
if (YARP_HAS_MATH_LIB)
set(targets ${targets} math)
endif (YARP_HAS_MATH_LIB)
add_executable(testModule ../libYARP_OS/harness/testModule/module.cpp)
target_link_libraries(testModule YARP_init YARP_OS)

foreach(test_family ${targets})
file(GLOB harness_code ${CMAKE_SOURCE_DIR}/src/libYARP_${test_family}/harness/*.cpp ${CMAKE_SOURCE_DIR}/src/libYARP_${test_family}/harness/*.h)
get_property(YARP_TREE_INCLUDE_DIRS TARGET YARP_${test_family}
PROPERTY INCLUDE_DIRS)
get_property(YARP_LIBRARIES GLOBAL PROPERTY YARP_LIBS)
include_directories(${YARP_TREE_INCLUDE_DIRS})
if (YARP_HAS_ACE)
include_directories(${ACE_INCLUDE_DIRS})
else (YARP_HAS_ACE)
endif (YARP_HAS_ACE)
set(EXE harness_${test_family})
string(TOLOWER ${EXE} EXE)
add_executable(${EXE} ${harness_code})
target_link_libraries(${EXE} ${YARP_LIBRARIES})
target_link_libraries(${EXE} ${ACE_LIBRARIES})
if (YARP_USE_PERSISTENT_NAMESERVER)
target_link_libraries(${EXE} YARP_serversql)
endif ()
# added by Lorenzo, to fix windows problem. I assume we test RELEASE
# builds.
get_target_property(EXELOC ${EXE} LOCATION_RELEASE)
#message(STATUS "Exeloc: ${EXELOC}")
if (NOT YARP_HAS_ACE)
# Without ACE, we don't currently have UDP
list(REMOVE_ITEM harness_code ${CMAKE_SOURCE_DIR}/src/libYARP_${test_family}/harness/DgramTwoWayStreamTest.cpp)
endif ()
foreach(test ${harness_code})
get_filename_component(XN ${test} NAME_WE)
#message(STATUS ${XN})
add_test("${test_family}::${XN}" ${EXELOC} regression ${XN})
endforeach()
endforeach()
#### temporary variable for debug
set(ENABLE_YARPRUNTESTS FALSE CACHE BOOL "Enable yarprun tests")
if(ENABLE_YARPRUNTESTS)
add_definitions(-DYARPRUN_TEST)
endif()
mark_as_advanced(ENABLE_YARPRUNTESTS)

set(targets OS sig dev)
get_property(YARP_HAS_MATH_LIB GLOBAL PROPERTY YARP_HAS_MATH_LIB)
if(YARP_HAS_MATH_LIB)
set(targets ${targets} math)
endif()

# Add in hardware specific tests, if requested
option(CREATE_PLUGIN_TESTS "Compile plugin tests" FALSE)
mark_as_advanced(CREATE_PLUGIN_TESTS)
if (CREATE_PLUGIN_TESTS)
# add in our tests
file(GLOB inis ../libYARP_dev/harness/*.ini)
foreach(X ${inis})
get_filename_component(XN ${X} NAME_WE)
get_filename_component(XINI ${X} ABSOLUTE)
# need to cache examples for reference
set(DOC_DIR "${CMAKE_SOURCE_DIR}/src/doc/device_invocation")
set(XDOX ${DOC_DIR}/${XN}.dox)
add_test(device::${XN} ${CMAKE_COMMAND} -E chdir ${CMAKE_SOURCE_DIR}/src/libYARP_dev/harness ${EXECUTABLE_OUTPUT_PATH}/harness_dev --file "${XINI}" --doc "${XDOX}")
endforeach(X ${inis})
endif (CREATE_PLUGIN_TESTS)
foreach(test_family ${targets})
file(GLOB harness_code ${CMAKE_SOURCE_DIR}/src/libYARP_${test_family}/harness/*.cpp ${CMAKE_SOURCE_DIR}/src/libYARP_${test_family}/harness/*.h)
get_property(YARP_TREE_INCLUDE_DIRS TARGET YARP_${test_family}
PROPERTY INCLUDE_DIRS)
get_property(YARP_LIBRARIES GLOBAL PROPERTY YARP_LIBS)
include_directories(${YARP_TREE_INCLUDE_DIRS})
if(YARP_HAS_ACE)
include_directories(${ACE_INCLUDE_DIRS})
endif()
set(EXE harness_${test_family})
string(TOLOWER ${EXE} EXE)
add_executable(${EXE} ${harness_code})
target_link_libraries(${EXE} ${YARP_LIBRARIES})
target_link_libraries(${EXE} ${ACE_LIBRARIES})
if(YARP_USE_PERSISTENT_NAMESERVER)
target_link_libraries(${EXE} YARP_serversql)
endif()
# added by Lorenzo, to fix windows problem. I assume we test RELEASE
# builds.
get_target_property(EXELOC ${EXE} LOCATION_RELEASE)
#message(STATUS "Exeloc: ${EXELOC}")
if(NOT YARP_HAS_ACE)
# Without ACE, we don't currently have UDP
list(REMOVE_ITEM harness_code ${CMAKE_SOURCE_DIR}/src/libYARP_${test_family}/harness/DgramTwoWayStreamTest.cpp)
endif()
foreach(test ${harness_code})
get_filename_component(XN ${test} NAME_WE)
#message(STATUS ${XN})
add_test("${test_family}::${XN}" ${EXELOC} regression ${XN})
endforeach()
endforeach()

endif (YARP_COMPILE_TESTS)
# Add in hardware specific tests, if requested
option(CREATE_PLUGIN_TESTS "Compile plugin tests" FALSE)
mark_as_advanced(CREATE_PLUGIN_TESTS)
if(CREATE_PLUGIN_TESTS)
# add in our tests
file(GLOB inis ../libYARP_dev/harness/*.ini)
foreach(X ${inis})
get_filename_component(XN ${X} NAME_WE)
get_filename_component(XINI ${X} ABSOLUTE)
# need to cache examples for reference
set(DOC_DIR "${CMAKE_SOURCE_DIR}/src/doc/device_invocation")
set(XDOX ${DOC_DIR}/${XN}.dox)
add_test(device::${XN} ${CMAKE_COMMAND} -E chdir ${CMAKE_SOURCE_DIR}/src/libYARP_dev/harness ${EXECUTABLE_OUTPUT_PATH}/harness_dev --file "${XINI}" --doc "${XDOX}")
endforeach(X ${inis})
endif()
endif()

# touch 1 2

0 comments on commit d35ddd0

Please sign in to comment.