diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 8de88db..d2d6d03 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -62,13 +62,4 @@ jobs: files: ros_ws/lcov/total_coverage.info,ros_ws/coveragepy/.coverage flags: unittests name: codecov-umbrella - slug: grupo-avispa/scitos2 - - name: Upload cpp coverage to Coveralls - uses: coverallsapp/github-action@v2 - with: - github-token: ${{ secrets.COVERALLS_REPO_TOKEN }} - fail-on-error: true - flag-name: unittests - debug: true - files: ros_ws/lcov/total_coverage.info,ros_ws/coveragepy/.coverage - format: lcov \ No newline at end of file + slug: grupo-avispa/scitos2 \ No newline at end of file diff --git a/scitos2_common/cmake/mira_package.cmake b/scitos2_common/cmake/mira_package.cmake index bad7a32..8a17b0a 100644 --- a/scitos2_common/cmake/mira_package.cmake +++ b/scitos2_common/cmake/mira_package.cmake @@ -4,48 +4,52 @@ # @public # macro(find_mira_path) -message(STATUS "Detecting MIRA root directory") - -# Examines each path in MIRA_PATH in order to find the MIRA root directory, which -# is identified by the file "make/Insource.make" -SET(ENV{MIRA_PATH} "$ENV{MIRA_PATH}:/opt/mira:${CMAKE_SOURCE_DIR}") -SET(FORCE_USE_QT5 1) - -set(FindMIRARoot_MIRA_PATH "$ENV{MIRA_PATH}") -if(UNIX) - # note: the "" around "${MIRA_PATH}" are very important ! - string(REPLACE ":" ";" FindMIRARoot_MIRA_PATH "${FindMIRARoot_MIRA_PATH}") -endif() - -set(FOUND_MIRA_ROOT_DIR 0) -set(MIRA_ROOT_DIR "") -FOREACH(path ${FindMIRARoot_MIRA_PATH}) - GET_FILENAME_COMPONENT(pathComponent ${path} ABSOLUTE) - # strip any trailing slashes from every path in MIRA_PATH env - MESSAGE(STATUS "Examining ${pathComponent}") - - if(EXISTS "${pathComponent}/mira.root") - MESSAGE(STATUS "found valid ${pathComponent}") - set(FOUND_MIRA_ROOT_DIR 1) - set(MIRA_ROOT_DIR ${pathComponent}) - endif() -ENDFOREACH(path) -MESSAGE(STATUS "MIRA_ROOT_DIR=${MIRA_ROOT_DIR}") -MESSAGE(STATUS "FOUND_MIRA_ROOT_DIR=${FOUND_MIRA_ROOT_DIR}") - -IF(FOUND_MIRA_ROOT_DIR) - # return the final relative path; must use echo, as cmake does not provide - # mechanism to output to stdout :( - execute_process(COMMAND ${CMAKE_COMMAND} -E echo ${MIRA_ROOT_DIR}) -ELSE() - message("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!") - message("Your MIRA_PATH environment variable is not set properly.\nPlease add the proper path to your MIRA directory.") - message("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!") - message(FATAL_ERROR) -ENDIF() + message(STATUS "Detecting MIRA root directory") + + # Examines each path in MIRA_PATH in order to find the MIRA root directory, which + # is identified by the file "make/Insource.make" + SET(ENV{MIRA_PATH} "$ENV{MIRA_PATH}:/opt/mira:${CMAKE_SOURCE_DIR}") + SET(FORCE_USE_QT5 1) + + set(FindMIRARoot_MIRA_PATH "$ENV{MIRA_PATH}") + + if(UNIX) + # note: the "" around "${MIRA_PATH}" are very important ! + string(REPLACE ":" ";" FindMIRARoot_MIRA_PATH "${FindMIRARoot_MIRA_PATH}") + endif() + + set(FOUND_MIRA_ROOT_DIR 0) + set(MIRA_ROOT_DIR "") + + FOREACH(path ${FindMIRARoot_MIRA_PATH}) + GET_FILENAME_COMPONENT(pathComponent ${path} ABSOLUTE) + + # strip any trailing slashes from every path in MIRA_PATH env + MESSAGE(STATUS "Examining ${pathComponent}") + + if(EXISTS "${pathComponent}/mira.root") + MESSAGE(STATUS "found valid ${pathComponent}") + set(FOUND_MIRA_ROOT_DIR 1) + set(MIRA_ROOT_DIR ${pathComponent}) + endif() + ENDFOREACH(path) + + MESSAGE(STATUS "MIRA_ROOT_DIR=${MIRA_ROOT_DIR}") + MESSAGE(STATUS "FOUND_MIRA_ROOT_DIR=${FOUND_MIRA_ROOT_DIR}") + + IF(FOUND_MIRA_ROOT_DIR) + # return the final relative path; must use echo, as cmake does not provide + # mechanism to output to stdout :( + execute_process(COMMAND ${CMAKE_COMMAND} -E echo ${MIRA_ROOT_DIR}) + ELSE() + message("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!") + message("Your MIRA_PATH environment variable is not set properly.\nPlease add the proper path to your MIRA directory.") + message("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!") + message(FATAL_ERROR) + ENDIF() endmacro() -############################################################################## +# ############################################################################# # # Include MIRA packages @@ -53,17 +57,17 @@ endmacro() # @public # macro(include_mira_packages) -set(CMAKE_MODULE_PATH ${MIRA_ROOT_DIR}/make) + set(CMAKE_MODULE_PATH ${MIRA_ROOT_DIR}/make) -include(Prerequisites) -include(Dependencies) + include(Prerequisites) + include(Dependencies) -# Require MIRAFramework package -mira_require_package(MIRAFramework) -mira_require_package(RobotDataTypes) + # Require MIRAFramework package + mira_require_package(MIRAFramework) + mira_require_package(RobotDataTypes) endmacro() -############################################################################## +# ############################################################################# # # Target link for MIRA libraries @@ -71,6 +75,26 @@ endmacro() # @public # macro(target_link_mira_libraries target) -# For transitive linking link against all auto liked libraries -target_link_libraries(${target} ${MIRAAutoLinkLibraries} MIRAFramework) + # For transitive linking link against all auto liked libraries + target_link_libraries(${target} ${MIRAAutoLinkLibraries} MIRAFramework) + + # use, i.e. don't skip the full RPATH for the build tree + SET(CMAKE_SKIP_BUILD_RPATH FALSE) + + # when building, don't use the install RPATH already + # (but later on when installing) + SET(CMAKE_BUILD_WITH_INSTALL_RPATH FALSE) + + SET(CMAKE_INSTALL_RPATH "${MIRA_ROOT_DIR}/lib") + + # add the automatically determined parts of the RPATH + # which point to directories outside the build tree to the install RPATH + SET(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE) + + # the RPATH to be used when installing, but only if it's not a system directory + LIST(FIND CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES "${CMAKE_INSTALL_PREFIX}/lib" isSystemDir) + + IF("${isSystemDir}" STREQUAL "-1") + SET(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib") + ENDIF("${isSystemDir}" STREQUAL "-1") endmacro() \ No newline at end of file diff --git a/scitos2_core/CMakeLists.txt b/scitos2_core/CMakeLists.txt index e3d6fe8..bdfd8b1 100644 --- a/scitos2_core/CMakeLists.txt +++ b/scitos2_core/CMakeLists.txt @@ -21,7 +21,8 @@ if(NOT CMAKE_CXX_STANDARD) endif() if(CMAKE_CXX_COMPILER_ID MATCHES "GNU" OR CMAKE_CXX_COMPILER_ID MATCHES "Clang") - add_compile_options(-Wall -Wextra -Wpedantic -Werror -Wdeprecated -fPIC -Wshadow -Wnull-dereference) + # add_compile_options(-Wall -Wextra -Wpedantic -Werror -Wdeprecated -fPIC -Wshadow -Wnull-dereference) + add_compile_options(-Wall -Wextra -Wpedantic -Wdeprecated -fPIC -Wshadow -Wnull-dereference) add_compile_options("$<$:-Wnon-virtual-dtor>") endif() @@ -65,6 +66,8 @@ include_directories( include ) +include_mira_packages() + set(dependencies rclcpp rclcpp_components diff --git a/scitos2_core/include/scitos2_core/module.hpp b/scitos2_core/include/scitos2_core/module.hpp index 90ce313..d259a1a 100644 --- a/scitos2_core/include/scitos2_core/module.hpp +++ b/scitos2_core/include/scitos2_core/module.hpp @@ -67,6 +67,8 @@ class Module virtual void deactivate() = 0; protected: + // Skip this method from coverage report because it only calls MIRA services + // LCOV_EXCL_START /** * @brief Call a MIRA service with a timeout of 1 second. * @@ -85,8 +87,7 @@ class Module // Check if the authority is valid or if the service exists if (!sharedAuthority->isValid() || !sharedAuthority->existsService("/robot/Robot")) { RCLCPP_ERROR_ONCE( - rclcpp::get_logger("MIRA"), - "MIRA authority is not valid or service does not exist"); + rclcpp::get_logger("MIRA"), "MIRA authority is not valid or service does not exist"); return false; } @@ -97,8 +98,7 @@ class Module RCLCPP_DEBUG(rclcpp::get_logger("MIRA"), "service_name: %i", true); } catch (mira::XRPC & e) { RCLCPP_WARN( - rclcpp::get_logger("MIRA"), - "MIRA RPC error caught when calling the service: %s", e.what() ); + rclcpp::get_logger("MIRA"), "MIRA RPC error caught when calling the service: %s", e.what()); return false; } return true; @@ -126,8 +126,7 @@ class Module // Check if the authority is valid or if the service exists if (!sharedAuthority->isValid() || !sharedAuthority->existsService("/robot/Robot")) { RCLCPP_ERROR_ONCE( - rclcpp::get_logger("MIRA"), - "MIRA authority is not valid or service does not exist"); + rclcpp::get_logger("MIRA"), "MIRA authority is not valid or service does not exist"); return false; } @@ -143,8 +142,7 @@ class Module RCLCPP_DEBUG(rclcpp::get_logger("MIRA"), "service_name: %i", true); } catch (mira::XRPC & e) { RCLCPP_WARN( - rclcpp::get_logger("MIRA"), - "MIRA RPC error caught when calling the service: %s", e.what() ); + rclcpp::get_logger("MIRA"), "MIRA RPC error caught when calling the service: %s", e.what()); return false; } return true; @@ -171,8 +169,7 @@ class Module // Check if the authority is valid or if the service exists if (!sharedAuthority->isValid() || !sharedAuthority->existsService("/robot/Robot")) { RCLCPP_ERROR_ONCE( - rclcpp::get_logger("MIRA"), - "MIRA authority is not valid or service does not exist"); + rclcpp::get_logger("MIRA"), "MIRA authority is not valid or service does not exist"); return false; } @@ -183,8 +180,7 @@ class Module rpc.get(); } catch (mira::XRPC & e) { RCLCPP_WARN( - rclcpp::get_logger("MIRA"), - "MIRA RPC error caught when setting parameter: %s", e.what() ); + rclcpp::get_logger("MIRA"), "MIRA RPC error caught when setting parameter: %s", e.what()); return false; } return true; @@ -210,8 +206,7 @@ class Module // Check if the authority is valid or if the service exists if (!sharedAuthority->isValid() || !sharedAuthority->existsService("/robot/Robot")) { RCLCPP_ERROR_ONCE( - rclcpp::get_logger("MIRA"), - "MIRA authority is not valid or service does not exist"); + rclcpp::get_logger("MIRA"), "MIRA authority is not valid or service does not exist"); return ""; } @@ -222,11 +217,11 @@ class Module return rpc.get(); } catch (mira::XRPC & e) { RCLCPP_WARN( - rclcpp::get_logger("MIRA"), - "MIRA RPC error caught when getting parameter: %s", e.what() ); + rclcpp::get_logger("MIRA"), "MIRA RPC error caught when getting parameter: %s", e.what()); return ""; } } + // LCOV_EXCL_STOP }; } // namespace scitos2_core diff --git a/scitos2_core/include/scitos2_core/sink_logger.hpp b/scitos2_core/include/scitos2_core/sink_logger.hpp index 8adb10c..451ac8e 100644 --- a/scitos2_core/include/scitos2_core/sink_logger.hpp +++ b/scitos2_core/include/scitos2_core/sink_logger.hpp @@ -20,6 +20,7 @@ #include "rclcpp/rclcpp.hpp" +// LCOV_EXCL_START namespace scitos2_core { @@ -70,5 +71,6 @@ class SinkLogger : public mira::LogSink }; } // namespace scitos2_core +// LCOV_EXCL_STOP #endif // SCITOS2_CORE__SINK_LOGGER_HPP_ diff --git a/scitos2_core/package.xml b/scitos2_core/package.xml index 771c17c..99fe5bc 100644 --- a/scitos2_core/package.xml +++ b/scitos2_core/package.xml @@ -15,7 +15,6 @@ ament_lint_auto ament_lint_common - ament_cmake_gtest ament_cmake