From 2251d635530ef2b7c44bb1b97aca20fb5662cf9b Mon Sep 17 00:00:00 2001 From: Mathias Kraus Date: Wed, 20 Sep 2023 14:18:14 +0200 Subject: [PATCH 01/12] iox-#1030 Fix another typo and adjust 'expect' message --- iceoryx_hoofs/test/moduletests/test_unix_domain_sockets.cpp | 4 ++-- iceoryx_posh/source/popo/building_blocks/locking_policy.cpp | 2 +- iceoryx_posh/source/roudi/port_manager.cpp | 6 +++--- iceoryx_posh/source/roudi/roudi.cpp | 2 +- iceoryx_posh/source/runtime/posh_runtime_impl.cpp | 2 +- 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/iceoryx_hoofs/test/moduletests/test_unix_domain_sockets.cpp b/iceoryx_hoofs/test/moduletests/test_unix_domain_sockets.cpp index 013264582a..8ccc40f947 100644 --- a/iceoryx_hoofs/test/moduletests/test_unix_domain_sockets.cpp +++ b/iceoryx_hoofs/test/moduletests/test_unix_domain_sockets.cpp @@ -115,14 +115,14 @@ class UnixDomainSocket_test : public Test .maxMsgSize(UnixDomainSocket::MAX_MESSAGE_SIZE) .maxMsgNumber(MaxMsgNumber) .create() - .expect("Valid UnixDomainSocket")}; + .expect("Failed to create UnixDomainSocket")}; UnixDomainSocket client{UnixDomainSocketBuilder() .name(goodName) .channelSide(IpcChannelSide::CLIENT) .maxMsgSize(UnixDomainSocket::MAX_MESSAGE_SIZE) .maxMsgNumber(MaxMsgNumber) .create() - .expect("Valid UnixDomainSocket")}; + .expect("Failed to create UnixDomainSocket")}; }; constexpr uint64_t UnixDomainSocket_test::MaxMsgNumber; diff --git a/iceoryx_posh/source/popo/building_blocks/locking_policy.cpp b/iceoryx_posh/source/popo/building_blocks/locking_policy.cpp index c98f86aa5d..2006061a05 100644 --- a/iceoryx_posh/source/popo/building_blocks/locking_policy.cpp +++ b/iceoryx_posh/source/popo/building_blocks/locking_policy.cpp @@ -29,7 +29,7 @@ ThreadSafePolicy::ThreadSafePolicy() noexcept .isInterProcessCapable(true) .mutexType(posix::MutexType::RECURSIVE) .create(m_mutex) - .expect("Valid Mutex"); + .expect("Failed to create Mutex"); } void ThreadSafePolicy::lock() const noexcept diff --git a/iceoryx_posh/source/roudi/port_manager.cpp b/iceoryx_posh/source/roudi/port_manager.cpp index 10d8a802b9..ea8b1d3b87 100644 --- a/iceoryx_posh/source/roudi/port_manager.cpp +++ b/iceoryx_posh/source/roudi/port_manager.cpp @@ -53,13 +53,13 @@ PortManager::PortManager(RouDiMemoryInterface* roudiMemoryInterface) noexcept } m_portPool = maybePortPool.value(); - auto maybediscoveryMemoryManager = m_roudiMemoryInterface->discoveryMemoryManager(); - if (!maybediscoveryMemoryManager.has_value()) + auto maybeDiscoveryMemoryManager = m_roudiMemoryInterface->discoveryMemoryManager(); + if (!maybeDiscoveryMemoryManager.has_value()) { IOX_LOG(FATAL) << "Could not get MemoryManager for discovery!"; errorHandler(PoshError::PORT_MANAGER__DISCOVERY_MEMORY_MANAGER_UNAVAILABLE, iox::ErrorLevel::FATAL); } - auto& discoveryMemoryManager = maybediscoveryMemoryManager.value(); + auto& discoveryMemoryManager = maybeDiscoveryMemoryManager.value(); popo::PublisherOptions registryPortOptions; registryPortOptions.historyCapacity = 1U; diff --git a/iceoryx_posh/source/roudi/roudi.cpp b/iceoryx_posh/source/roudi/roudi.cpp index 12e2fb37ef..3b82b5b07b 100644 --- a/iceoryx_posh/source/roudi/roudi.cpp +++ b/iceoryx_posh/source/roudi/roudi.cpp @@ -210,7 +210,7 @@ void RouDi::monitorAndDiscoveryUpdate() noexcept popo::ConditionVariableData conditionVariableData; DiscoveryWaitSet discoveryLoopWaitset{conditionVariableData}; - discoveryLoopWaitset.attachEvent(m_discoveryLoopTrigger).expect("Successfully attaching a single event"); + discoveryLoopWaitset.attachEvent(m_discoveryLoopTrigger).expect("Failed to attach a single event"); bool manuallyTriggered{false}; while (m_runMonitoringAndDiscoveryThread) diff --git a/iceoryx_posh/source/runtime/posh_runtime_impl.cpp b/iceoryx_posh/source/runtime/posh_runtime_impl.cpp index 7f967578cc..20d065d6be 100644 --- a/iceoryx_posh/source/runtime/posh_runtime_impl.cpp +++ b/iceoryx_posh/source/runtime/posh_runtime_impl.cpp @@ -49,7 +49,7 @@ PoshRuntimeImpl::PoshRuntimeImpl(optional name, const Runt .isInterProcessCapable(false) .mutexType(posix::MutexType::NORMAL) .create(m_appIpcRequestMutex) - .expect("Valid Mutex"); + .expect("Failed to create Mutex"); } PoshRuntimeImpl::~PoshRuntimeImpl() noexcept From 65e0e26cb2526072df607f51fef779280d678cc5 Mon Sep 17 00:00:00 2001 From: Mathias Kraus Date: Wed, 6 Sep 2023 14:59:07 +0200 Subject: [PATCH 02/12] iox-#1533 Move 'RouDiEnvironment' to new location --- .../test/moduletests/test_chunk.cpp | 2 +- .../test/moduletests/test_node.cpp | 2 +- .../test/moduletests/test_publisher.cpp | 2 +- .../test/moduletests/test_runtime.cpp | 2 +- .../moduletests/test_service_discovery.cpp | 2 +- .../test/moduletests/test_subscriber.cpp | 2 +- iceoryx_posh/CMakeLists.txt | 1 + .../cmake/iceoryx_posh_roudi_env.cmake | 27 ++++++ iceoryx_posh/roudi_env/CMakeLists.txt | 45 ++++++++++ .../roudi_env}/minimal_roudi_config.hpp | 6 +- .../roudi_env/roudi_environment.hpp | 83 +++++++++++++++++++ .../roudi_env}/runtime_test_interface.hpp | 0 .../source}/minimal_roudi_config.cpp | 2 +- .../source}/roudi_environment.cpp | 4 +- .../source}/runtime_test_interface.cpp | 2 +- .../integrationtests/test_client_server.cpp | 2 +- .../test_interface_port_stack_blowup.cpp | 2 +- .../test_popo_pub_sub_listener.cpp | 2 +- ...est_publisher_subscriber_communication.cpp | 2 +- .../test_roudi_roudi_environment.cpp | 2 +- .../test_service_discovery.cpp | 2 +- .../test/moduletests/test_posh_runtime.cpp | 2 +- .../moduletests/test_posh_runtime_node.cpp | 2 +- .../test_posh_runtime_single_process.cpp | 2 +- ...test_roudi_iceoyx_roudi_memory_manager.cpp | 2 +- .../test_roudi_portmanager_fixture.hpp | 2 +- .../test_roudi_process_manager.cpp | 2 +- iceoryx_posh/testing/CMakeLists.txt | 6 +- .../roudi_environment/roudi_environment.hpp | 63 +------------- .../iceoryx_posh/testing/roudi_gtest.hpp | 7 +- iceoryx_posh/testing/source/roudi_gtest.cpp | 23 +++++ 31 files changed, 210 insertions(+), 95 deletions(-) create mode 100644 iceoryx_posh/cmake/iceoryx_posh_roudi_env.cmake create mode 100644 iceoryx_posh/roudi_env/CMakeLists.txt rename iceoryx_posh/{testing/include/iceoryx_posh/testing/roudi_environment => roudi_env/include/iceoryx_posh/roudi_env}/minimal_roudi_config.hpp (89%) create mode 100644 iceoryx_posh/roudi_env/include/iceoryx_posh/roudi_env/roudi_environment.hpp rename iceoryx_posh/{testing/include/iceoryx_posh/testing/roudi_environment => roudi_env/include/iceoryx_posh/roudi_env}/runtime_test_interface.hpp (100%) rename iceoryx_posh/{testing/roudi_environment => roudi_env/source}/minimal_roudi_config.cpp (94%) rename iceoryx_posh/{testing/roudi_environment => roudi_env/source}/roudi_environment.cpp (95%) rename iceoryx_posh/{testing/roudi_environment => roudi_env/source}/runtime_test_interface.cpp (98%) create mode 100644 iceoryx_posh/testing/source/roudi_gtest.cpp diff --git a/iceoryx_binding_c/test/moduletests/test_chunk.cpp b/iceoryx_binding_c/test/moduletests/test_chunk.cpp index cc0864db4e..81f3f2922e 100644 --- a/iceoryx_binding_c/test/moduletests/test_chunk.cpp +++ b/iceoryx_binding_c/test/moduletests/test_chunk.cpp @@ -22,7 +22,7 @@ extern "C" { #include "iceoryx_hoofs/error_handling/error_handling.hpp" #include "iceoryx_hoofs/testing/fatal_failure.hpp" -#include "iceoryx_posh/testing/roudi_environment/minimal_roudi_config.hpp" +#include "iceoryx_posh/roudi_env/minimal_roudi_config.hpp" #include "iceoryx_posh/testing/roudi_gtest.hpp" namespace diff --git a/iceoryx_binding_c/test/moduletests/test_node.cpp b/iceoryx_binding_c/test/moduletests/test_node.cpp index 7dc156b68f..6c9e186eff 100644 --- a/iceoryx_binding_c/test/moduletests/test_node.cpp +++ b/iceoryx_binding_c/test/moduletests/test_node.cpp @@ -17,8 +17,8 @@ #include "iceoryx_hoofs/error_handling/error_handling.hpp" #include "iceoryx_hoofs/testing/fatal_failure.hpp" +#include "iceoryx_posh/roudi_env/minimal_roudi_config.hpp" #include "iceoryx_posh/runtime/posh_runtime.hpp" -#include "iceoryx_posh/testing/roudi_environment/minimal_roudi_config.hpp" #include "iceoryx_posh/testing/roudi_gtest.hpp" #include diff --git a/iceoryx_binding_c/test/moduletests/test_publisher.cpp b/iceoryx_binding_c/test/moduletests/test_publisher.cpp index 7b0ddf7f86..93d9f594d8 100644 --- a/iceoryx_binding_c/test/moduletests/test_publisher.cpp +++ b/iceoryx_binding_c/test/moduletests/test_publisher.cpp @@ -24,7 +24,7 @@ #include "iceoryx_posh/internal/popo/ports/publisher_port_roudi.hpp" #include "iceoryx_posh/internal/popo/ports/publisher_port_user.hpp" #include "iceoryx_posh/mepoo/mepoo_config.hpp" -#include "iceoryx_posh/testing/roudi_environment/minimal_roudi_config.hpp" +#include "iceoryx_posh/roudi_env/minimal_roudi_config.hpp" #include "iceoryx_posh/testing/roudi_environment/roudi_environment.hpp" using namespace iox; diff --git a/iceoryx_binding_c/test/moduletests/test_runtime.cpp b/iceoryx_binding_c/test/moduletests/test_runtime.cpp index 11fb1ce848..5dab0bec03 100644 --- a/iceoryx_binding_c/test/moduletests/test_runtime.cpp +++ b/iceoryx_binding_c/test/moduletests/test_runtime.cpp @@ -21,7 +21,7 @@ extern "C" { #include "iceoryx_hoofs/error_handling/error_handling.hpp" #include "iceoryx_hoofs/testing/fatal_failure.hpp" #include "iceoryx_posh/iceoryx_posh_types.hpp" -#include "iceoryx_posh/testing/roudi_environment/minimal_roudi_config.hpp" +#include "iceoryx_posh/roudi_env/minimal_roudi_config.hpp" #include "iceoryx_posh/testing/roudi_gtest.hpp" namespace diff --git a/iceoryx_binding_c/test/moduletests/test_service_discovery.cpp b/iceoryx_binding_c/test/moduletests/test_service_discovery.cpp index db97aa233d..d7f51a3772 100644 --- a/iceoryx_binding_c/test/moduletests/test_service_discovery.cpp +++ b/iceoryx_binding_c/test/moduletests/test_service_discovery.cpp @@ -16,8 +16,8 @@ #include "iceoryx_hoofs/error_handling/error_handling.hpp" #include "iceoryx_hoofs/testing/fatal_failure.hpp" +#include "iceoryx_posh/roudi_env/minimal_roudi_config.hpp" #include "iceoryx_posh/runtime/service_discovery.hpp" -#include "iceoryx_posh/testing/roudi_environment/minimal_roudi_config.hpp" #include "iceoryx_posh/testing/roudi_gtest.hpp" using namespace iox; diff --git a/iceoryx_binding_c/test/moduletests/test_subscriber.cpp b/iceoryx_binding_c/test/moduletests/test_subscriber.cpp index 64d32f6aaa..bb4afa8175 100644 --- a/iceoryx_binding_c/test/moduletests/test_subscriber.cpp +++ b/iceoryx_binding_c/test/moduletests/test_subscriber.cpp @@ -26,7 +26,7 @@ #include "iceoryx_posh/internal/popo/ports/subscriber_port_single_producer.hpp" #include "iceoryx_posh/internal/popo/ports/subscriber_port_user.hpp" #include "iceoryx_posh/mepoo/mepoo_config.hpp" -#include "iceoryx_posh/testing/roudi_environment/minimal_roudi_config.hpp" +#include "iceoryx_posh/roudi_env/minimal_roudi_config.hpp" #include "iceoryx_posh/testing/roudi_environment/roudi_environment.hpp" #include "mocks/wait_set_mock.hpp" diff --git a/iceoryx_posh/CMakeLists.txt b/iceoryx_posh/CMakeLists.txt index ee16919595..ab76579a11 100644 --- a/iceoryx_posh/CMakeLists.txt +++ b/iceoryx_posh/CMakeLists.txt @@ -299,6 +299,7 @@ setup_install_directories_and_export_package( INCLUDE_DIRECTORIES include/ ) +add_subdirectory(roudi_env) add_subdirectory(testing) if(BUILD_TEST) diff --git a/iceoryx_posh/cmake/iceoryx_posh_roudi_env.cmake b/iceoryx_posh/cmake/iceoryx_posh_roudi_env.cmake new file mode 100644 index 0000000000..143b0daf07 --- /dev/null +++ b/iceoryx_posh/cmake/iceoryx_posh_roudi_env.cmake @@ -0,0 +1,27 @@ +# Copyright (c) 2020 by Robert Bosch GmbH. All rights reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# SPDX-License-Identifier: Apache-2.0 + +# +########## dummyConfig.cmake to be able to use find_package with the source tree ########## +# + +if(NOT ${CMAKE_FIND_PACKAGE_NAME}_FOUND_PRINTED) + message(STATUS "The package '${CMAKE_FIND_PACKAGE_NAME}' is used in source code version.") + set(${CMAKE_FIND_PACKAGE_NAME}_FOUND_PRINTED true CACHE INTERNAL "") +endif() + +list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_LIST_DIR}) + diff --git a/iceoryx_posh/roudi_env/CMakeLists.txt b/iceoryx_posh/roudi_env/CMakeLists.txt new file mode 100644 index 0000000000..2016659aa4 --- /dev/null +++ b/iceoryx_posh/roudi_env/CMakeLists.txt @@ -0,0 +1,45 @@ +# Copyright (c) 2020 by Robert Bosch GmbH. All rights reserved. +# Copyright (c) 2020 - 2022 by Apex.AI Inc. All rights reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# SPDX-License-Identifier: Apache-2.0 + +# NOTE +# This package must NOT depend in any way on gtest or any other testing framework since +# it will be used from other languages like Rust for integration testing. + +if(ROUDI_ENVIRONMENT OR BUILD_TEST) + # + ######### posh roudi env ########## + # + find_package(iceoryx_hoofs_testing REQUIRED) + iox_add_library( + STATIC + TARGET iceoryx_posh_roudi_env + NAMESPACE iceoryx_posh + PROJECT_PREFIX ${PREFIX} + BUILD_INTERFACE ${CMAKE_CURRENT_SOURCE_DIR}/include + INSTALL_INTERFACE include/${PREFIX} + EXPORT_INCLUDE_DIRS include/ + PRIVATE_LIBS iceoryx_posh::iceoryx_posh + iceoryx_hoofs::iceoryx_hoofs + iceoryx_hoofs_testing::iceoryx_hoofs_testing + iceoryx_posh::iceoryx_posh_roudi + FILES + source/minimal_roudi_config.cpp + source/roudi_environment.cpp + source/runtime_test_interface.cpp + ) +endif() + diff --git a/iceoryx_posh/testing/include/iceoryx_posh/testing/roudi_environment/minimal_roudi_config.hpp b/iceoryx_posh/roudi_env/include/iceoryx_posh/roudi_env/minimal_roudi_config.hpp similarity index 89% rename from iceoryx_posh/testing/include/iceoryx_posh/testing/roudi_environment/minimal_roudi_config.hpp rename to iceoryx_posh/roudi_env/include/iceoryx_posh/roudi_env/minimal_roudi_config.hpp index d0714e8bbc..f3407fb526 100644 --- a/iceoryx_posh/testing/include/iceoryx_posh/testing/roudi_environment/minimal_roudi_config.hpp +++ b/iceoryx_posh/roudi_env/include/iceoryx_posh/roudi_env/minimal_roudi_config.hpp @@ -14,8 +14,8 @@ // // SPDX-License-Identifier: Apache-2.0 -#ifndef IOX_POSH_ROUDI_ENVIRONMENT_MINIMAL_ROUDI_CONFIG_HPP -#define IOX_POSH_ROUDI_ENVIRONMENT_MINIMAL_ROUDI_CONFIG_HPP +#ifndef IOX_POSH_ROUDI_ENV_MINIMAL_ROUDI_CONFIG_HPP +#define IOX_POSH_ROUDI_ENV_MINIMAL_ROUDI_CONFIG_HPP #include "iceoryx_posh/iceoryx_posh_config.hpp" #include "iox/builder.hpp" @@ -47,4 +47,4 @@ class MinimalRouDiConfigBuilder } // namespace testing } // namespace iox -#endif // IOX_POSH_ROUDI_ENVIRONMENT_MINIMAL_ROUDI_CONFIG_HPP +#endif // IOX_POSH_ROUDI_ENV_MINIMAL_ROUDI_CONFIG_HPP diff --git a/iceoryx_posh/roudi_env/include/iceoryx_posh/roudi_env/roudi_environment.hpp b/iceoryx_posh/roudi_env/include/iceoryx_posh/roudi_env/roudi_environment.hpp new file mode 100644 index 0000000000..c7e0001778 --- /dev/null +++ b/iceoryx_posh/roudi_env/include/iceoryx_posh/roudi_env/roudi_environment.hpp @@ -0,0 +1,83 @@ +// Copyright (c) 2019 by Robert Bosch GmbH. All rights reserved. +// Copyright (c) 2021 by Apex.AI Inc. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// SPDX-License-Identifier: Apache-2.0 + +#ifndef IOX_POSH_ROUDI_ENV_ROUDI_ENVIRONMENT_HPP +#define IOX_POSH_ROUDI_ENV_ROUDI_ENVIRONMENT_HPP + +#include "iceoryx_posh/iceoryx_posh_config.hpp" +#include "iceoryx_posh/iceoryx_posh_types.hpp" +#include "iceoryx_posh/internal/roudi/roudi.hpp" +#include "iceoryx_posh/roudi/iceoryx_roudi_components.hpp" +#include "iceoryx_posh/roudi/memory/iceoryx_roudi_memory_manager.hpp" +#include "iceoryx_posh/roudi_env/runtime_test_interface.hpp" +#include "iox/duration.hpp" + +#include +#include +#include + +namespace iox +{ +namespace roudi +{ +class RouDi; + +class RouDiEnvironment +{ + public: + RouDiEnvironment(const RouDiConfig_t& roudiConfig = RouDiConfig_t().setDefaults(), + roudi::MonitoringMode monitoringMode = roudi::MonitoringMode::OFF, + const uint16_t uniqueRouDiId = 0u); + virtual ~RouDiEnvironment(); + + RouDiEnvironment(RouDiEnvironment&& rhs) = default; + RouDiEnvironment& operator=(RouDiEnvironment&& rhs) = default; + + RouDiEnvironment(const RouDiEnvironment&) = delete; + RouDiEnvironment& operator=(const RouDiEnvironment&) = delete; + + void SetInterOpWaitingTime(const std::chrono::milliseconds& v); + void InterOpWait(); + + void CleanupAppResources(const RuntimeName_t& name); + + protected: + /// @note this is due to ambiguity of the cTor with the default parameter + enum class BaseCTor + { + BASE, + }; + /// @brief for implementations on top of RouDiEnvironment + RouDiEnvironment(BaseCTor, const uint16_t uniqueRouDiId = 0u); + + void CleanupRuntimes(); + + private: + RuntimeTestInterface m_runtimes; +#if defined(__APPLE__) + iox::units::Duration m_interOpWaitingTimeout{iox::units::Duration::fromMilliseconds(1000)}; +#else + iox::units::Duration m_interOpWaitingTimeout{iox::units::Duration::fromMilliseconds(200)}; +#endif + std::unique_ptr m_roudiComponents; + std::unique_ptr m_roudiApp; +}; + +} // namespace roudi +} // namespace iox + +#endif // IOX_POSH_ROUDI_ENV_ROUDI_ENVIRONMENT_HPP diff --git a/iceoryx_posh/testing/include/iceoryx_posh/testing/roudi_environment/runtime_test_interface.hpp b/iceoryx_posh/roudi_env/include/iceoryx_posh/roudi_env/runtime_test_interface.hpp similarity index 100% rename from iceoryx_posh/testing/include/iceoryx_posh/testing/roudi_environment/runtime_test_interface.hpp rename to iceoryx_posh/roudi_env/include/iceoryx_posh/roudi_env/runtime_test_interface.hpp diff --git a/iceoryx_posh/testing/roudi_environment/minimal_roudi_config.cpp b/iceoryx_posh/roudi_env/source/minimal_roudi_config.cpp similarity index 94% rename from iceoryx_posh/testing/roudi_environment/minimal_roudi_config.cpp rename to iceoryx_posh/roudi_env/source/minimal_roudi_config.cpp index 21ecf03152..f8431324db 100644 --- a/iceoryx_posh/testing/roudi_environment/minimal_roudi_config.cpp +++ b/iceoryx_posh/roudi_env/source/minimal_roudi_config.cpp @@ -14,7 +14,7 @@ // // SPDX-License-Identifier: Apache-2.0 -#include "iceoryx_posh/testing/roudi_environment/minimal_roudi_config.hpp" +#include "iceoryx_posh/roudi_env/minimal_roudi_config.hpp" namespace iox { diff --git a/iceoryx_posh/testing/roudi_environment/roudi_environment.cpp b/iceoryx_posh/roudi_env/source/roudi_environment.cpp similarity index 95% rename from iceoryx_posh/testing/roudi_environment/roudi_environment.cpp rename to iceoryx_posh/roudi_env/source/roudi_environment.cpp index 5ad459cbdd..db366a4cea 100644 --- a/iceoryx_posh/testing/roudi_environment/roudi_environment.cpp +++ b/iceoryx_posh/roudi_env/source/roudi_environment.cpp @@ -15,9 +15,9 @@ // // SPDX-License-Identifier: Apache-2.0 -#include "iceoryx_posh/testing/roudi_environment/roudi_environment.hpp" +#include "iceoryx_posh/roudi_env/roudi_environment.hpp" #include "iceoryx_hoofs/internal/posix_wrapper/shared_memory_object/memory_map.hpp" -#include "iceoryx_hoofs/testing/mocks/error_handler_mock.hpp" +#include "iceoryx_hoofs/testing/mocks/error_handler_mock.hpp" // get rid of this #include "iceoryx_posh/internal/popo/building_blocks/unique_port_id.hpp" #include "iceoryx_posh/internal/roudi/roudi.hpp" #include "iceoryx_posh/runtime/posh_runtime.hpp" diff --git a/iceoryx_posh/testing/roudi_environment/runtime_test_interface.cpp b/iceoryx_posh/roudi_env/source/runtime_test_interface.cpp similarity index 98% rename from iceoryx_posh/testing/roudi_environment/runtime_test_interface.cpp rename to iceoryx_posh/roudi_env/source/runtime_test_interface.cpp index 74b6b726e8..54ba04b096 100644 --- a/iceoryx_posh/testing/roudi_environment/runtime_test_interface.cpp +++ b/iceoryx_posh/roudi_env/source/runtime_test_interface.cpp @@ -15,7 +15,7 @@ // // SPDX-License-Identifier: Apache-2.0 -#include "iceoryx_posh/testing/roudi_environment/runtime_test_interface.hpp" +#include "iceoryx_posh/roudi_env/runtime_test_interface.hpp" #include "iceoryx_posh/internal/runtime/posh_runtime_impl.hpp" namespace iox diff --git a/iceoryx_posh/test/integrationtests/test_client_server.cpp b/iceoryx_posh/test/integrationtests/test_client_server.cpp index 9540b09af9..aef095b236 100644 --- a/iceoryx_posh/test/integrationtests/test_client_server.cpp +++ b/iceoryx_posh/test/integrationtests/test_client_server.cpp @@ -20,8 +20,8 @@ #include "iceoryx_posh/popo/server.hpp" #include "iceoryx_posh/popo/untyped_client.hpp" #include "iceoryx_posh/popo/untyped_server.hpp" +#include "iceoryx_posh/roudi_env/minimal_roudi_config.hpp" #include "iceoryx_posh/runtime/posh_runtime.hpp" -#include "iceoryx_posh/testing/roudi_environment/minimal_roudi_config.hpp" #include "iceoryx_posh/testing/roudi_gtest.hpp" #include "test.hpp" diff --git a/iceoryx_posh/test/integrationtests/test_interface_port_stack_blowup.cpp b/iceoryx_posh/test/integrationtests/test_interface_port_stack_blowup.cpp index 0c2f822789..ddc722967f 100644 --- a/iceoryx_posh/test/integrationtests/test_interface_port_stack_blowup.cpp +++ b/iceoryx_posh/test/integrationtests/test_interface_port_stack_blowup.cpp @@ -17,8 +17,8 @@ #include "iceoryx_posh/gateway/gateway_base.hpp" +#include "iceoryx_posh/roudi_env/minimal_roudi_config.hpp" #include "iceoryx_posh/runtime/posh_runtime.hpp" -#include "iceoryx_posh/testing/roudi_environment/minimal_roudi_config.hpp" #include "iceoryx_posh/testing/roudi_gtest.hpp" #include "test.hpp" diff --git a/iceoryx_posh/test/integrationtests/test_popo_pub_sub_listener.cpp b/iceoryx_posh/test/integrationtests/test_popo_pub_sub_listener.cpp index 4658d1c4e7..06a4222e40 100644 --- a/iceoryx_posh/test/integrationtests/test_popo_pub_sub_listener.cpp +++ b/iceoryx_posh/test/integrationtests/test_popo_pub_sub_listener.cpp @@ -18,7 +18,7 @@ #include "iceoryx_posh/popo/publisher.hpp" #include "iceoryx_posh/popo/subscriber.hpp" #include "iceoryx_posh/popo/untyped_subscriber.hpp" -#include "iceoryx_posh/testing/roudi_environment/minimal_roudi_config.hpp" +#include "iceoryx_posh/roudi_env/minimal_roudi_config.hpp" #include "iceoryx_posh/testing/roudi_gtest.hpp" #include "test.hpp" diff --git a/iceoryx_posh/test/integrationtests/test_publisher_subscriber_communication.cpp b/iceoryx_posh/test/integrationtests/test_publisher_subscriber_communication.cpp index 3c4b4d1a79..e82f60fcf6 100644 --- a/iceoryx_posh/test/integrationtests/test_publisher_subscriber_communication.cpp +++ b/iceoryx_posh/test/integrationtests/test_publisher_subscriber_communication.cpp @@ -21,8 +21,8 @@ #include "iceoryx_hoofs/testing/watch_dog.hpp" #include "iceoryx_posh/popo/publisher.hpp" #include "iceoryx_posh/popo/subscriber.hpp" +#include "iceoryx_posh/roudi_env/minimal_roudi_config.hpp" #include "iceoryx_posh/runtime/posh_runtime.hpp" -#include "iceoryx_posh/testing/roudi_environment/minimal_roudi_config.hpp" #include "iceoryx_posh/testing/roudi_gtest.hpp" #include "iox/optional.hpp" #include "iox/stack.hpp" diff --git a/iceoryx_posh/test/integrationtests/test_roudi_roudi_environment.cpp b/iceoryx_posh/test/integrationtests/test_roudi_roudi_environment.cpp index 1a93101897..4900162539 100644 --- a/iceoryx_posh/test/integrationtests/test_roudi_roudi_environment.cpp +++ b/iceoryx_posh/test/integrationtests/test_roudi_roudi_environment.cpp @@ -15,7 +15,7 @@ // SPDX-License-Identifier: Apache-2.0 -#include "iceoryx_posh/testing/roudi_environment/minimal_roudi_config.hpp" +#include "iceoryx_posh/roudi_env/minimal_roudi_config.hpp" #include "iceoryx_posh/testing/roudi_environment/roudi_environment.hpp" #include "test.hpp" diff --git a/iceoryx_posh/test/integrationtests/test_service_discovery.cpp b/iceoryx_posh/test/integrationtests/test_service_discovery.cpp index d6a4d455e0..e6ddaeb082 100644 --- a/iceoryx_posh/test/integrationtests/test_service_discovery.cpp +++ b/iceoryx_posh/test/integrationtests/test_service_discovery.cpp @@ -22,10 +22,10 @@ #include "iceoryx_posh/popo/untyped_publisher.hpp" #include "iceoryx_posh/popo/untyped_server.hpp" #include "iceoryx_posh/popo/wait_set.hpp" +#include "iceoryx_posh/roudi_env/minimal_roudi_config.hpp" #include "iceoryx_posh/runtime/posh_runtime.hpp" #include "iceoryx_posh/runtime/service_discovery.hpp" #include "iceoryx_posh/testing/mocks/posh_runtime_mock.hpp" -#include "iceoryx_posh/testing/roudi_environment/minimal_roudi_config.hpp" #include "iceoryx_posh/testing/roudi_gtest.hpp" #include "test.hpp" diff --git a/iceoryx_posh/test/moduletests/test_posh_runtime.cpp b/iceoryx_posh/test/moduletests/test_posh_runtime.cpp index 8cf0bcaacc..6f6a0826d6 100644 --- a/iceoryx_posh/test/moduletests/test_posh_runtime.cpp +++ b/iceoryx_posh/test/moduletests/test_posh_runtime.cpp @@ -25,9 +25,9 @@ #include "iceoryx_posh/popo/subscriber.hpp" #include "iceoryx_posh/popo/untyped_client.hpp" #include "iceoryx_posh/popo/untyped_server.hpp" +#include "iceoryx_posh/roudi_env/minimal_roudi_config.hpp" #include "iceoryx_posh/runtime/posh_runtime.hpp" #include "iceoryx_posh/testing/mocks/posh_runtime_mock.hpp" -#include "iceoryx_posh/testing/roudi_environment/minimal_roudi_config.hpp" #include "iceoryx_posh/testing/roudi_environment/roudi_environment.hpp" #include "test.hpp" diff --git a/iceoryx_posh/test/moduletests/test_posh_runtime_node.cpp b/iceoryx_posh/test/moduletests/test_posh_runtime_node.cpp index bf3d7db4ac..792e038ab7 100644 --- a/iceoryx_posh/test/moduletests/test_posh_runtime_node.cpp +++ b/iceoryx_posh/test/moduletests/test_posh_runtime_node.cpp @@ -15,9 +15,9 @@ // // SPDX-License-Identifier: Apache-2.0 +#include "iceoryx_posh/roudi_env/minimal_roudi_config.hpp" #include "iceoryx_posh/runtime/node.hpp" #include "iceoryx_posh/runtime/posh_runtime.hpp" -#include "iceoryx_posh/testing/roudi_environment/minimal_roudi_config.hpp" #include "iceoryx_posh/testing/roudi_environment/roudi_environment.hpp" #include "test.hpp" diff --git a/iceoryx_posh/test/moduletests/test_posh_runtime_single_process.cpp b/iceoryx_posh/test/moduletests/test_posh_runtime_single_process.cpp index d33d5a0fee..183bfa3278 100644 --- a/iceoryx_posh/test/moduletests/test_posh_runtime_single_process.cpp +++ b/iceoryx_posh/test/moduletests/test_posh_runtime_single_process.cpp @@ -15,8 +15,8 @@ // // SPDX-License-Identifier: Apache-2.0 +#include "iceoryx_posh/roudi_env/minimal_roudi_config.hpp" #include "iceoryx_posh/runtime/posh_runtime_single_process.hpp" -#include "iceoryx_posh/testing/roudi_environment/minimal_roudi_config.hpp" #include "iceoryx_posh/testing/roudi_environment/roudi_environment.hpp" #include "test.hpp" diff --git a/iceoryx_posh/test/moduletests/test_roudi_iceoyx_roudi_memory_manager.cpp b/iceoryx_posh/test/moduletests/test_roudi_iceoyx_roudi_memory_manager.cpp index 2eb3bd003d..efc0759126 100644 --- a/iceoryx_posh/test/moduletests/test_roudi_iceoyx_roudi_memory_manager.cpp +++ b/iceoryx_posh/test/moduletests/test_roudi_iceoyx_roudi_memory_manager.cpp @@ -18,7 +18,7 @@ #include "test.hpp" #include "iceoryx_posh/roudi/memory/iceoryx_roudi_memory_manager.hpp" -#include "iceoryx_posh/testing/roudi_environment/minimal_roudi_config.hpp" +#include "iceoryx_posh/roudi_env/minimal_roudi_config.hpp" namespace { diff --git a/iceoryx_posh/test/moduletests/test_roudi_portmanager_fixture.hpp b/iceoryx_posh/test/moduletests/test_roudi_portmanager_fixture.hpp index 46c2f29cf5..885f8f9fd7 100644 --- a/iceoryx_posh/test/moduletests/test_roudi_portmanager_fixture.hpp +++ b/iceoryx_posh/test/moduletests/test_roudi_portmanager_fixture.hpp @@ -29,7 +29,7 @@ #include "iceoryx_posh/popo/client_options.hpp" #include "iceoryx_posh/popo/server_options.hpp" #include "iceoryx_posh/roudi/memory/iceoryx_roudi_memory_manager.hpp" -#include "iceoryx_posh/testing/roudi_environment/minimal_roudi_config.hpp" +#include "iceoryx_posh/roudi_env/minimal_roudi_config.hpp" #include "test.hpp" diff --git a/iceoryx_posh/test/moduletests/test_roudi_process_manager.cpp b/iceoryx_posh/test/moduletests/test_roudi_process_manager.cpp index 19af8e3572..b2e272c0d6 100644 --- a/iceoryx_posh/test/moduletests/test_roudi_process_manager.cpp +++ b/iceoryx_posh/test/moduletests/test_roudi_process_manager.cpp @@ -23,7 +23,7 @@ #include "iceoryx_posh/mepoo/mepoo_config.hpp" #include "iceoryx_posh/roudi/memory/iceoryx_roudi_memory_manager.hpp" #include "iceoryx_posh/roudi/memory/roudi_memory_interface.hpp" -#include "iceoryx_posh/testing/roudi_environment/minimal_roudi_config.hpp" +#include "iceoryx_posh/roudi_env/minimal_roudi_config.hpp" #include "iceoryx_posh/version/compatibility_check_level.hpp" #include "iox/string.hpp" #include "test.hpp" diff --git a/iceoryx_posh/testing/CMakeLists.txt b/iceoryx_posh/testing/CMakeLists.txt index 1e55c62304..24f57c52d7 100644 --- a/iceoryx_posh/testing/CMakeLists.txt +++ b/iceoryx_posh/testing/CMakeLists.txt @@ -31,13 +31,11 @@ if(ROUDI_ENVIRONMENT OR BUILD_TEST) EXPORT_INCLUDE_DIRS include/ PUBLIC_LIBS GTest::gtest GTest::gmock + iceoryx_posh::iceoryx_posh_roudi_env PRIVATE_LIBS iceoryx_posh::iceoryx_posh iceoryx_hoofs::iceoryx_hoofs - iceoryx_posh::iceoryx_posh_roudi iceoryx_hoofs_testing::iceoryx_hoofs_testing FILES - roudi_environment/minimal_roudi_config.cpp - roudi_environment/runtime_test_interface.cpp - roudi_environment/roudi_environment.cpp + source/roudi_gtest.cpp ) endif() diff --git a/iceoryx_posh/testing/include/iceoryx_posh/testing/roudi_environment/roudi_environment.hpp b/iceoryx_posh/testing/include/iceoryx_posh/testing/roudi_environment/roudi_environment.hpp index 39f5390122..074b63471b 100644 --- a/iceoryx_posh/testing/include/iceoryx_posh/testing/roudi_environment/roudi_environment.hpp +++ b/iceoryx_posh/testing/include/iceoryx_posh/testing/roudi_environment/roudi_environment.hpp @@ -14,69 +14,10 @@ // limitations under the License. // // SPDX-License-Identifier: Apache-2.0 + #ifndef IOX_POSH_ROUDI_ENVIRONMENT_ROUDI_ENVIRONMENT_HPP #define IOX_POSH_ROUDI_ENVIRONMENT_ROUDI_ENVIRONMENT_HPP -#include "iceoryx_posh/iceoryx_posh_config.hpp" -#include "iceoryx_posh/iceoryx_posh_types.hpp" -#include "iceoryx_posh/internal/roudi/roudi.hpp" -#include "iceoryx_posh/roudi/iceoryx_roudi_components.hpp" -#include "iceoryx_posh/roudi/memory/iceoryx_roudi_memory_manager.hpp" -#include "iceoryx_posh/testing/roudi_environment/runtime_test_interface.hpp" -#include "iox/duration.hpp" - -#include -#include -#include - -namespace iox -{ -namespace roudi -{ -class RouDi; - -class RouDiEnvironment -{ - public: - RouDiEnvironment(const RouDiConfig_t& roudiConfig = RouDiConfig_t().setDefaults(), - roudi::MonitoringMode monitoringMode = roudi::MonitoringMode::OFF, - const uint16_t uniqueRouDiId = 0u); - virtual ~RouDiEnvironment(); - - RouDiEnvironment(RouDiEnvironment&& rhs) = default; - RouDiEnvironment& operator=(RouDiEnvironment&& rhs) = default; - - RouDiEnvironment(const RouDiEnvironment&) = delete; - RouDiEnvironment& operator=(const RouDiEnvironment&) = delete; - - void SetInterOpWaitingTime(const std::chrono::milliseconds& v); - void InterOpWait(); - - void CleanupAppResources(const RuntimeName_t& name); - - protected: - /// @note this is due to ambiguity of the cTor with the default parameter - enum class BaseCTor - { - BASE, - }; - /// @brief for implementations on top of RouDiEnvironment - RouDiEnvironment(BaseCTor, const uint16_t uniqueRouDiId = 0u); - - void CleanupRuntimes(); - - private: - RuntimeTestInterface m_runtimes; -#if defined(__APPLE__) - iox::units::Duration m_interOpWaitingTimeout{iox::units::Duration::fromMilliseconds(1000)}; -#else - iox::units::Duration m_interOpWaitingTimeout{iox::units::Duration::fromMilliseconds(200)}; -#endif - std::unique_ptr m_roudiComponents; - std::unique_ptr m_roudiApp; -}; - -} // namespace roudi -} // namespace iox +#include "iceoryx_posh/roudi_env/roudi_environment.hpp" #endif // IOX_POSH_ROUDI_ENVIRONMENT_ROUDI_ENVIRONMENT_HPP diff --git a/iceoryx_posh/testing/include/iceoryx_posh/testing/roudi_gtest.hpp b/iceoryx_posh/testing/include/iceoryx_posh/testing/roudi_gtest.hpp index 1845946a3e..880922b906 100644 --- a/iceoryx_posh/testing/include/iceoryx_posh/testing/roudi_gtest.hpp +++ b/iceoryx_posh/testing/include/iceoryx_posh/testing/roudi_gtest.hpp @@ -17,7 +17,7 @@ #ifndef IOX_POSH_TESTUTILS_ROUDI_GTEST_HPP #define IOX_POSH_TESTUTILS_ROUDI_GTEST_HPP -#include "iceoryx_posh/testing/roudi_environment/roudi_environment.hpp" +#include "iceoryx_posh/roudi_env/roudi_environment.hpp" #include #include @@ -28,10 +28,7 @@ class RouDi_GTest : public iox::roudi::RouDiEnvironment, public Test { public: RouDi_GTest() = default; - RouDi_GTest(const iox::RouDiConfig_t& roudiConfig) - : iox::roudi::RouDiEnvironment(roudiConfig) - { - } + RouDi_GTest(const iox::RouDiConfig_t& roudiConfig); }; #endif // IOX_POSH_TESTUTILS_ROUDI_GTEST_HPP diff --git a/iceoryx_posh/testing/source/roudi_gtest.cpp b/iceoryx_posh/testing/source/roudi_gtest.cpp new file mode 100644 index 0000000000..6a78660463 --- /dev/null +++ b/iceoryx_posh/testing/source/roudi_gtest.cpp @@ -0,0 +1,23 @@ +// Copyright (c) 2019 by Robert Bosch GmbH. All rights reserved. +// Copyright (c) 2021 by Apex.AI Inc. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// SPDX-License-Identifier: Apache-2.0 + +#include "iceoryx_posh/testing/roudi_gtest.hpp" + +RouDi_GTest::RouDi_GTest(const iox::RouDiConfig_t& roudiConfig) + : iox::roudi::RouDiEnvironment(roudiConfig) +{ +} From f2b84919ed34c0dd3946ad5fa3f11f8d908ee3c3 Mon Sep 17 00:00:00 2001 From: Mathias Kraus Date: Wed, 6 Sep 2023 16:29:07 +0200 Subject: [PATCH 03/12] iox-#1533 Introduce the 'roudi_env' namespace --- iceoryx_binding_c/test/moduletests/test_chunk.cpp | 1 + iceoryx_binding_c/test/moduletests/test_node.cpp | 1 + .../test/moduletests/test_publisher.cpp | 1 + iceoryx_binding_c/test/moduletests/test_runtime.cpp | 1 + .../test/moduletests/test_service_discovery.cpp | 1 + .../test/moduletests/test_subscriber.cpp | 1 + .../internal/runtime/posh_runtime_impl.hpp | 2 +- .../include/iceoryx_posh/runtime/posh_runtime.hpp | 6 +++--- .../iceoryx_posh/roudi_env/minimal_roudi_config.hpp | 4 ++-- .../iceoryx_posh/roudi_env/roudi_environment.hpp | 9 ++++++--- .../roudi_env/runtime_test_interface.hpp | 4 ++-- .../roudi_env/source/minimal_roudi_config.cpp | 4 ++-- iceoryx_posh/roudi_env/source/roudi_environment.cpp | 13 +++++++------ .../roudi_env/source/runtime_test_interface.cpp | 4 ++-- .../test/integrationtests/test_client_server.cpp | 2 +- .../test_interface_port_stack_blowup.cpp | 2 +- .../integrationtests/test_popo_pub_sub_listener.cpp | 2 +- .../test_publisher_subscriber_communication.cpp | 2 +- .../test_roudi_roudi_environment.cpp | 3 +-- .../integrationtests/test_service_discovery.cpp | 3 +-- iceoryx_posh/test/moduletests/test_posh_runtime.cpp | 2 +- .../test/moduletests/test_posh_runtime_node.cpp | 2 +- .../test_posh_runtime_single_process.cpp | 2 +- .../test_roudi_iceoyx_roudi_memory_manager.cpp | 2 +- .../moduletests/test_roudi_portmanager_fixture.hpp | 2 +- .../test/moduletests/test_roudi_process_manager.cpp | 2 +- .../testing/roudi_environment/roudi_environment.hpp | 8 ++++++++ .../include/iceoryx_posh/testing/roudi_gtest.hpp | 2 +- iceoryx_posh/testing/source/roudi_gtest.cpp | 2 +- 29 files changed, 53 insertions(+), 37 deletions(-) diff --git a/iceoryx_binding_c/test/moduletests/test_chunk.cpp b/iceoryx_binding_c/test/moduletests/test_chunk.cpp index 81f3f2922e..7b76c41474 100644 --- a/iceoryx_binding_c/test/moduletests/test_chunk.cpp +++ b/iceoryx_binding_c/test/moduletests/test_chunk.cpp @@ -29,6 +29,7 @@ namespace { using namespace iox; using namespace iox::mepoo; +using namespace iox::roudi_env; using namespace iox::testing; class Chunk_test : public RouDi_GTest diff --git a/iceoryx_binding_c/test/moduletests/test_node.cpp b/iceoryx_binding_c/test/moduletests/test_node.cpp index 6c9e186eff..83c39e3f79 100644 --- a/iceoryx_binding_c/test/moduletests/test_node.cpp +++ b/iceoryx_binding_c/test/moduletests/test_node.cpp @@ -31,6 +31,7 @@ namespace { using namespace iox; using namespace iox::runtime; +using namespace iox::roudi_env; using namespace iox::testing; class iox_node_test : public RouDi_GTest diff --git a/iceoryx_binding_c/test/moduletests/test_publisher.cpp b/iceoryx_binding_c/test/moduletests/test_publisher.cpp index 93d9f594d8..7e9852dce2 100644 --- a/iceoryx_binding_c/test/moduletests/test_publisher.cpp +++ b/iceoryx_binding_c/test/moduletests/test_publisher.cpp @@ -42,6 +42,7 @@ namespace { using namespace ::testing; using namespace iox::testing; +using namespace iox::roudi_env; using namespace iox::capro; using namespace iox::cxx; using namespace iox::mepoo; diff --git a/iceoryx_binding_c/test/moduletests/test_runtime.cpp b/iceoryx_binding_c/test/moduletests/test_runtime.cpp index 5dab0bec03..1533c13786 100644 --- a/iceoryx_binding_c/test/moduletests/test_runtime.cpp +++ b/iceoryx_binding_c/test/moduletests/test_runtime.cpp @@ -28,6 +28,7 @@ namespace { using namespace iox; using namespace iox::runtime; +using namespace iox::roudi_env; using namespace iox::testing; class BindingC_Runtime_test : public RouDi_GTest diff --git a/iceoryx_binding_c/test/moduletests/test_service_discovery.cpp b/iceoryx_binding_c/test/moduletests/test_service_discovery.cpp index d7f51a3772..c2208c32fc 100644 --- a/iceoryx_binding_c/test/moduletests/test_service_discovery.cpp +++ b/iceoryx_binding_c/test/moduletests/test_service_discovery.cpp @@ -22,6 +22,7 @@ using namespace iox; using namespace iox::runtime; +using namespace iox::roudi_env; using namespace iox::testing; extern "C" { diff --git a/iceoryx_binding_c/test/moduletests/test_subscriber.cpp b/iceoryx_binding_c/test/moduletests/test_subscriber.cpp index bb4afa8175..0cfbb80271 100644 --- a/iceoryx_binding_c/test/moduletests/test_subscriber.cpp +++ b/iceoryx_binding_c/test/moduletests/test_subscriber.cpp @@ -32,6 +32,7 @@ using namespace iox; using namespace iox::popo; +using namespace iox::roudi_env; using namespace iox::testing; extern "C" { diff --git a/iceoryx_posh/include/iceoryx_posh/internal/runtime/posh_runtime_impl.hpp b/iceoryx_posh/include/iceoryx_posh/internal/runtime/posh_runtime_impl.hpp index 215b887de5..68f8903a8a 100644 --- a/iceoryx_posh/include/iceoryx_posh/internal/runtime/posh_runtime_impl.hpp +++ b/iceoryx_posh/include/iceoryx_posh/internal/runtime/posh_runtime_impl.hpp @@ -83,7 +83,7 @@ class PoshRuntimeImpl : public PoshRuntime protected: friend class PoshRuntime; - friend class roudi::RuntimeTestInterface; + friend class roudi_env::RuntimeTestInterface; // Protected constructor for IPC setup PoshRuntimeImpl(optional name, diff --git a/iceoryx_posh/include/iceoryx_posh/runtime/posh_runtime.hpp b/iceoryx_posh/include/iceoryx_posh/runtime/posh_runtime.hpp index 58730d0462..59685fe76a 100644 --- a/iceoryx_posh/include/iceoryx_posh/runtime/posh_runtime.hpp +++ b/iceoryx_posh/include/iceoryx_posh/runtime/posh_runtime.hpp @@ -38,10 +38,10 @@ namespace iox { -namespace roudi +namespace roudi_env { class RuntimeTestInterface; -} // namespace roudi +} // namespace roudi_env namespace runtime { @@ -159,7 +159,7 @@ class PoshRuntime virtual bool sendRequestToRouDi(const IpcMessage& msg, IpcMessage& answer) noexcept = 0; protected: - friend class roudi::RuntimeTestInterface; + friend class roudi_env::RuntimeTestInterface; using factory_t = PoshRuntime& (*)(optional); // Protected constructor for derived classes diff --git a/iceoryx_posh/roudi_env/include/iceoryx_posh/roudi_env/minimal_roudi_config.hpp b/iceoryx_posh/roudi_env/include/iceoryx_posh/roudi_env/minimal_roudi_config.hpp index f3407fb526..7035694d32 100644 --- a/iceoryx_posh/roudi_env/include/iceoryx_posh/roudi_env/minimal_roudi_config.hpp +++ b/iceoryx_posh/roudi_env/include/iceoryx_posh/roudi_env/minimal_roudi_config.hpp @@ -22,7 +22,7 @@ namespace iox { -namespace testing +namespace roudi_env { /// @brief Builder for a minimal RouDiConfig_t with only one MemPool. This significantly speeds up tests which create a /// shared memory. @@ -44,7 +44,7 @@ class MinimalRouDiConfigBuilder /// @brief creates the previously configured RouDiConfig_t RouDiConfig_t create() const noexcept; }; -} // namespace testing +} // namespace roudi_env } // namespace iox #endif // IOX_POSH_ROUDI_ENV_MINIMAL_ROUDI_CONFIG_HPP diff --git a/iceoryx_posh/roudi_env/include/iceoryx_posh/roudi_env/roudi_environment.hpp b/iceoryx_posh/roudi_env/include/iceoryx_posh/roudi_env/roudi_environment.hpp index c7e0001778..e0608d2f98 100644 --- a/iceoryx_posh/roudi_env/include/iceoryx_posh/roudi_env/roudi_environment.hpp +++ b/iceoryx_posh/roudi_env/include/iceoryx_posh/roudi_env/roudi_environment.hpp @@ -35,6 +35,9 @@ namespace iox namespace roudi { class RouDi; +} +namespace roudi_env +{ class RouDiEnvironment { @@ -73,11 +76,11 @@ class RouDiEnvironment #else iox::units::Duration m_interOpWaitingTimeout{iox::units::Duration::fromMilliseconds(200)}; #endif - std::unique_ptr m_roudiComponents; - std::unique_ptr m_roudiApp; + std::unique_ptr m_roudiComponents; + std::unique_ptr m_roudiApp; }; -} // namespace roudi +} // namespace roudi_env } // namespace iox #endif // IOX_POSH_ROUDI_ENV_ROUDI_ENVIRONMENT_HPP diff --git a/iceoryx_posh/roudi_env/include/iceoryx_posh/roudi_env/runtime_test_interface.hpp b/iceoryx_posh/roudi_env/include/iceoryx_posh/roudi_env/runtime_test_interface.hpp index 3ea1e960b0..db78e82b01 100644 --- a/iceoryx_posh/roudi_env/include/iceoryx_posh/roudi_env/runtime_test_interface.hpp +++ b/iceoryx_posh/roudi_env/include/iceoryx_posh/roudi_env/runtime_test_interface.hpp @@ -29,7 +29,7 @@ namespace runtime { class PoshRuntime; } -namespace roudi +namespace roudi_env { class RuntimeTestInterface { @@ -83,7 +83,7 @@ class RuntimeTestInterface void eraseRuntime(const RuntimeName_t& name); }; -} // namespace roudi +} // namespace roudi_env } // namespace iox #endif // IOX_POSH_ROUDI_ENVIRONMENT_RUNTIME_TEST_INTERFACE_HPP diff --git a/iceoryx_posh/roudi_env/source/minimal_roudi_config.cpp b/iceoryx_posh/roudi_env/source/minimal_roudi_config.cpp index f8431324db..8b615e6309 100644 --- a/iceoryx_posh/roudi_env/source/minimal_roudi_config.cpp +++ b/iceoryx_posh/roudi_env/source/minimal_roudi_config.cpp @@ -18,7 +18,7 @@ namespace iox { -namespace testing +namespace roudi_env { RouDiConfig_t MinimalRouDiConfigBuilder::create() const noexcept { @@ -33,5 +33,5 @@ RouDiConfig_t MinimalRouDiConfigBuilder::create() const noexcept return roudiConfig; } -} // namespace testing +} // namespace roudi_env } // namespace iox diff --git a/iceoryx_posh/roudi_env/source/roudi_environment.cpp b/iceoryx_posh/roudi_env/source/roudi_environment.cpp index db366a4cea..60c0118173 100644 --- a/iceoryx_posh/roudi_env/source/roudi_environment.cpp +++ b/iceoryx_posh/roudi_env/source/roudi_environment.cpp @@ -24,7 +24,7 @@ namespace iox { -namespace roudi +namespace roudi_env { RouDiEnvironment::RouDiEnvironment(BaseCTor, const uint16_t uniqueRouDiId) { @@ -38,10 +38,11 @@ RouDiEnvironment::RouDiEnvironment(const RouDiConfig_t& roudiConfig, const uint16_t uniqueRouDiId) : RouDiEnvironment(BaseCTor::BASE, uniqueRouDiId) { - m_roudiComponents = std::unique_ptr(new IceOryxRouDiComponents(roudiConfig)); - m_roudiApp = std::unique_ptr(new RouDi(m_roudiComponents->rouDiMemoryManager, - m_roudiComponents->portManager, - RouDi::RoudiStartupParameters{monitoringMode, false})); + m_roudiComponents = std::unique_ptr(new roudi::IceOryxRouDiComponents(roudiConfig)); + m_roudiApp = + std::unique_ptr(new roudi::RouDi(m_roudiComponents->rouDiMemoryManager, + m_roudiComponents->portManager, + roudi::RouDi::RoudiStartupParameters{monitoringMode, false})); } RouDiEnvironment::~RouDiEnvironment() @@ -75,5 +76,5 @@ void RouDiEnvironment::CleanupRuntimes() m_runtimes.cleanupRuntimes(); } -} // namespace roudi +} // namespace roudi_env } // namespace iox diff --git a/iceoryx_posh/roudi_env/source/runtime_test_interface.cpp b/iceoryx_posh/roudi_env/source/runtime_test_interface.cpp index 54ba04b096..114cff2380 100644 --- a/iceoryx_posh/roudi_env/source/runtime_test_interface.cpp +++ b/iceoryx_posh/roudi_env/source/runtime_test_interface.cpp @@ -20,7 +20,7 @@ namespace iox { -namespace roudi +namespace roudi_env { using runtime::PoshRuntime; @@ -124,5 +124,5 @@ PoshRuntime& RuntimeTestInterface::runtimeFactoryGetInstance(optional* subscriber IOX_MAYBE_UNUSED) { diff --git a/iceoryx_posh/test/integrationtests/test_publisher_subscriber_communication.cpp b/iceoryx_posh/test/integrationtests/test_publisher_subscriber_communication.cpp index e82f60fcf6..1aaf74101a 100644 --- a/iceoryx_posh/test/integrationtests/test_publisher_subscriber_communication.cpp +++ b/iceoryx_posh/test/integrationtests/test_publisher_subscriber_communication.cpp @@ -39,7 +39,7 @@ using namespace ::testing; using namespace iox; using namespace iox::popo; using namespace iox::cxx; -using namespace iox::testing; +using namespace iox::roudi_env; template struct ComplexDataType diff --git a/iceoryx_posh/test/integrationtests/test_roudi_roudi_environment.cpp b/iceoryx_posh/test/integrationtests/test_roudi_roudi_environment.cpp index 4900162539..f78293ee64 100644 --- a/iceoryx_posh/test/integrationtests/test_roudi_roudi_environment.cpp +++ b/iceoryx_posh/test/integrationtests/test_roudi_roudi_environment.cpp @@ -23,8 +23,7 @@ namespace { using namespace ::testing; -using namespace iox::roudi; -using namespace iox::testing; +using namespace iox::roudi_env; class RouDiEnvironment_test : public Test { diff --git a/iceoryx_posh/test/integrationtests/test_service_discovery.cpp b/iceoryx_posh/test/integrationtests/test_service_discovery.cpp index e6ddaeb082..335cf7fd27 100644 --- a/iceoryx_posh/test/integrationtests/test_service_discovery.cpp +++ b/iceoryx_posh/test/integrationtests/test_service_discovery.cpp @@ -43,11 +43,10 @@ using namespace iox::runtime; using namespace iox::cxx; using namespace iox::popo; using namespace iox::capro; -using namespace iox::testing; +using namespace iox::roudi_env; using iox::capro::IdString_t; using iox::capro::ServiceDescription; using iox::popo::MessagingPattern; -using iox::roudi::RouDiEnvironment; using ServiceContainer = std::vector; diff --git a/iceoryx_posh/test/moduletests/test_posh_runtime.cpp b/iceoryx_posh/test/moduletests/test_posh_runtime.cpp index 6f6a0826d6..0759ff9718 100644 --- a/iceoryx_posh/test/moduletests/test_posh_runtime.cpp +++ b/iceoryx_posh/test/moduletests/test_posh_runtime.cpp @@ -41,7 +41,7 @@ using namespace iox::capro; using namespace iox::cxx; using namespace iox; using namespace iox::popo; -using namespace iox::testing; +using namespace iox::roudi_env; using iox::roudi::RouDiEnvironment; class PoshRuntime_test : public Test diff --git a/iceoryx_posh/test/moduletests/test_posh_runtime_node.cpp b/iceoryx_posh/test/moduletests/test_posh_runtime_node.cpp index 792e038ab7..6d2f586763 100644 --- a/iceoryx_posh/test/moduletests/test_posh_runtime_node.cpp +++ b/iceoryx_posh/test/moduletests/test_posh_runtime_node.cpp @@ -27,7 +27,7 @@ namespace using namespace ::testing; using namespace iox::runtime; using namespace iox::roudi; -using namespace iox::testing; +using namespace iox::roudi_env; using namespace iox; /// @brief Test goal: This test suit verifies class node diff --git a/iceoryx_posh/test/moduletests/test_posh_runtime_single_process.cpp b/iceoryx_posh/test/moduletests/test_posh_runtime_single_process.cpp index 183bfa3278..312e44efcc 100644 --- a/iceoryx_posh/test/moduletests/test_posh_runtime_single_process.cpp +++ b/iceoryx_posh/test/moduletests/test_posh_runtime_single_process.cpp @@ -26,7 +26,7 @@ namespace using namespace ::testing; using namespace iox::runtime; using namespace iox::roudi; -using namespace iox::testing; +using namespace iox::roudi_env; using namespace iox; /// @brief Test goal: This test suit verifies class posh_runtime_single_process diff --git a/iceoryx_posh/test/moduletests/test_roudi_iceoyx_roudi_memory_manager.cpp b/iceoryx_posh/test/moduletests/test_roudi_iceoyx_roudi_memory_manager.cpp index efc0759126..54943988ba 100644 --- a/iceoryx_posh/test/moduletests/test_roudi_iceoyx_roudi_memory_manager.cpp +++ b/iceoryx_posh/test/moduletests/test_roudi_iceoyx_roudi_memory_manager.cpp @@ -24,7 +24,7 @@ namespace { using namespace ::testing; -using namespace iox::testing; +using namespace iox::roudi_env; using iox::roudi::IceOryxRouDiMemoryManager; /// @brief This test file verifies that the BaseClass IceoryxRouDiMemoryManager is tested diff --git a/iceoryx_posh/test/moduletests/test_roudi_portmanager_fixture.hpp b/iceoryx_posh/test/moduletests/test_roudi_portmanager_fixture.hpp index 885f8f9fd7..f0f63469d6 100644 --- a/iceoryx_posh/test/moduletests/test_roudi_portmanager_fixture.hpp +++ b/iceoryx_posh/test/moduletests/test_roudi_portmanager_fixture.hpp @@ -44,7 +44,7 @@ using namespace iox::capro; using namespace iox::cxx; using namespace iox::popo; using namespace iox::roudi; -using namespace iox::testing; +using namespace iox::roudi_env; using iox::runtime::PortConfigInfo; diff --git a/iceoryx_posh/test/moduletests/test_roudi_process_manager.cpp b/iceoryx_posh/test/moduletests/test_roudi_process_manager.cpp index b2e272c0d6..3eab6aea06 100644 --- a/iceoryx_posh/test/moduletests/test_roudi_process_manager.cpp +++ b/iceoryx_posh/test/moduletests/test_roudi_process_manager.cpp @@ -35,7 +35,7 @@ using namespace iox::roudi; using namespace iox::popo; using namespace iox::runtime; using namespace iox::posix; -using namespace iox::testing; +using namespace iox::roudi_env; using namespace iox::version; class ProcessManager_test : public Test diff --git a/iceoryx_posh/testing/include/iceoryx_posh/testing/roudi_environment/roudi_environment.hpp b/iceoryx_posh/testing/include/iceoryx_posh/testing/roudi_environment/roudi_environment.hpp index 074b63471b..c85802af54 100644 --- a/iceoryx_posh/testing/include/iceoryx_posh/testing/roudi_environment/roudi_environment.hpp +++ b/iceoryx_posh/testing/include/iceoryx_posh/testing/roudi_environment/roudi_environment.hpp @@ -20,4 +20,12 @@ #include "iceoryx_posh/roudi_env/roudi_environment.hpp" +namespace iox +{ +namespace roudi +{ +using roudi_env::RouDiEnvironment; +} +} // namespace iox + #endif // IOX_POSH_ROUDI_ENVIRONMENT_ROUDI_ENVIRONMENT_HPP diff --git a/iceoryx_posh/testing/include/iceoryx_posh/testing/roudi_gtest.hpp b/iceoryx_posh/testing/include/iceoryx_posh/testing/roudi_gtest.hpp index 880922b906..cd5d8286d8 100644 --- a/iceoryx_posh/testing/include/iceoryx_posh/testing/roudi_gtest.hpp +++ b/iceoryx_posh/testing/include/iceoryx_posh/testing/roudi_gtest.hpp @@ -24,7 +24,7 @@ using namespace ::testing; -class RouDi_GTest : public iox::roudi::RouDiEnvironment, public Test +class RouDi_GTest : public iox::roudi_env::RouDiEnvironment, public Test { public: RouDi_GTest() = default; diff --git a/iceoryx_posh/testing/source/roudi_gtest.cpp b/iceoryx_posh/testing/source/roudi_gtest.cpp index 6a78660463..058f4ff04e 100644 --- a/iceoryx_posh/testing/source/roudi_gtest.cpp +++ b/iceoryx_posh/testing/source/roudi_gtest.cpp @@ -18,6 +18,6 @@ #include "iceoryx_posh/testing/roudi_gtest.hpp" RouDi_GTest::RouDi_GTest(const iox::RouDiConfig_t& roudiConfig) - : iox::roudi::RouDiEnvironment(roudiConfig) + : iox::roudi_env::RouDiEnvironment(roudiConfig) { } From 9c1b7bc2d3f201a86f4c2ab65025f7e918d8355c Mon Sep 17 00:00:00 2001 From: Mathias Kraus Date: Wed, 6 Sep 2023 16:49:52 +0200 Subject: [PATCH 04/12] iox-#1533 Rename to 'RouDiEnv' --- iceoryx_posh/roudi_env/CMakeLists.txt | 2 +- .../{roudi_environment.hpp => roudi_env.hpp} | 28 +++++++++---------- .../roudi_env/runtime_test_interface.hpp | 2 +- .../{roudi_environment.cpp => roudi_env.cpp} | 22 +++++++-------- ...udi_environment.cpp => test_roudi_env.cpp} | 13 ++------- .../roudi_environment/roudi_environment.hpp | 4 +-- .../iceoryx_posh/testing/roudi_gtest.hpp | 4 +-- iceoryx_posh/testing/source/roudi_gtest.cpp | 2 +- 8 files changed, 35 insertions(+), 42 deletions(-) rename iceoryx_posh/roudi_env/include/iceoryx_posh/roudi_env/{roudi_environment.hpp => roudi_env.hpp} (71%) rename iceoryx_posh/roudi_env/source/{roudi_environment.cpp => roudi_env.cpp} (78%) rename iceoryx_posh/test/integrationtests/{test_roudi_roudi_environment.cpp => test_roudi_env.cpp} (76%) diff --git a/iceoryx_posh/roudi_env/CMakeLists.txt b/iceoryx_posh/roudi_env/CMakeLists.txt index 2016659aa4..fc782353e5 100644 --- a/iceoryx_posh/roudi_env/CMakeLists.txt +++ b/iceoryx_posh/roudi_env/CMakeLists.txt @@ -38,7 +38,7 @@ if(ROUDI_ENVIRONMENT OR BUILD_TEST) iceoryx_posh::iceoryx_posh_roudi FILES source/minimal_roudi_config.cpp - source/roudi_environment.cpp + source/roudi_env.cpp source/runtime_test_interface.cpp ) endif() diff --git a/iceoryx_posh/roudi_env/include/iceoryx_posh/roudi_env/roudi_environment.hpp b/iceoryx_posh/roudi_env/include/iceoryx_posh/roudi_env/roudi_env.hpp similarity index 71% rename from iceoryx_posh/roudi_env/include/iceoryx_posh/roudi_env/roudi_environment.hpp rename to iceoryx_posh/roudi_env/include/iceoryx_posh/roudi_env/roudi_env.hpp index e0608d2f98..611ac75748 100644 --- a/iceoryx_posh/roudi_env/include/iceoryx_posh/roudi_env/roudi_environment.hpp +++ b/iceoryx_posh/roudi_env/include/iceoryx_posh/roudi_env/roudi_env.hpp @@ -15,8 +15,8 @@ // // SPDX-License-Identifier: Apache-2.0 -#ifndef IOX_POSH_ROUDI_ENV_ROUDI_ENVIRONMENT_HPP -#define IOX_POSH_ROUDI_ENV_ROUDI_ENVIRONMENT_HPP +#ifndef IOX_POSH_ROUDI_ENV_ROUDI_ENV_HPP +#define IOX_POSH_ROUDI_ENV_ROUDI_ENV_HPP #include "iceoryx_posh/iceoryx_posh_config.hpp" #include "iceoryx_posh/iceoryx_posh_types.hpp" @@ -39,19 +39,19 @@ class RouDi; namespace roudi_env { -class RouDiEnvironment +class RouDiEnv { public: - RouDiEnvironment(const RouDiConfig_t& roudiConfig = RouDiConfig_t().setDefaults(), - roudi::MonitoringMode monitoringMode = roudi::MonitoringMode::OFF, - const uint16_t uniqueRouDiId = 0u); - virtual ~RouDiEnvironment(); + RouDiEnv(const RouDiConfig_t& roudiConfig = RouDiConfig_t().setDefaults(), + roudi::MonitoringMode monitoringMode = roudi::MonitoringMode::OFF, + const uint16_t uniqueRouDiId = 0u); + virtual ~RouDiEnv(); - RouDiEnvironment(RouDiEnvironment&& rhs) = default; - RouDiEnvironment& operator=(RouDiEnvironment&& rhs) = default; + RouDiEnv(RouDiEnv&& rhs) = default; + RouDiEnv& operator=(RouDiEnv&& rhs) = default; - RouDiEnvironment(const RouDiEnvironment&) = delete; - RouDiEnvironment& operator=(const RouDiEnvironment&) = delete; + RouDiEnv(const RouDiEnv&) = delete; + RouDiEnv& operator=(const RouDiEnv&) = delete; void SetInterOpWaitingTime(const std::chrono::milliseconds& v); void InterOpWait(); @@ -64,8 +64,8 @@ class RouDiEnvironment { BASE, }; - /// @brief for implementations on top of RouDiEnvironment - RouDiEnvironment(BaseCTor, const uint16_t uniqueRouDiId = 0u); + /// @brief for implementations on top of RouDiEnv + RouDiEnv(BaseCTor, const uint16_t uniqueRouDiId = 0u); void CleanupRuntimes(); @@ -83,4 +83,4 @@ class RouDiEnvironment } // namespace roudi_env } // namespace iox -#endif // IOX_POSH_ROUDI_ENV_ROUDI_ENVIRONMENT_HPP +#endif // IOX_POSH_ROUDI_ENV_ROUDI_ENV_HPP diff --git a/iceoryx_posh/roudi_env/include/iceoryx_posh/roudi_env/runtime_test_interface.hpp b/iceoryx_posh/roudi_env/include/iceoryx_posh/roudi_env/runtime_test_interface.hpp index db78e82b01..bf4d9270f9 100644 --- a/iceoryx_posh/roudi_env/include/iceoryx_posh/roudi_env/runtime_test_interface.hpp +++ b/iceoryx_posh/roudi_env/include/iceoryx_posh/roudi_env/runtime_test_interface.hpp @@ -33,7 +33,7 @@ namespace roudi_env { class RuntimeTestInterface { - friend class RouDiEnvironment; + friend class RouDiEnv; private: bool m_doCleanupOnDestruction{true}; diff --git a/iceoryx_posh/roudi_env/source/roudi_environment.cpp b/iceoryx_posh/roudi_env/source/roudi_env.cpp similarity index 78% rename from iceoryx_posh/roudi_env/source/roudi_environment.cpp rename to iceoryx_posh/roudi_env/source/roudi_env.cpp index 60c0118173..f1491af180 100644 --- a/iceoryx_posh/roudi_env/source/roudi_environment.cpp +++ b/iceoryx_posh/roudi_env/source/roudi_env.cpp @@ -15,7 +15,7 @@ // // SPDX-License-Identifier: Apache-2.0 -#include "iceoryx_posh/roudi_env/roudi_environment.hpp" +#include "iceoryx_posh/roudi_env/roudi_env.hpp" #include "iceoryx_hoofs/internal/posix_wrapper/shared_memory_object/memory_map.hpp" #include "iceoryx_hoofs/testing/mocks/error_handler_mock.hpp" // get rid of this #include "iceoryx_posh/internal/popo/building_blocks/unique_port_id.hpp" @@ -26,17 +26,17 @@ namespace iox { namespace roudi_env { -RouDiEnvironment::RouDiEnvironment(BaseCTor, const uint16_t uniqueRouDiId) +RouDiEnv::RouDiEnv(BaseCTor, const uint16_t uniqueRouDiId) { // setUniqueRouDiId is called multiple times but it is okay for the tests auto errorHandlerGuard = iox::ErrorHandlerMock::setTemporaryErrorHandler([](auto, auto) {}); iox::popo::UniquePortId::setUniqueRouDiId(uniqueRouDiId); } -RouDiEnvironment::RouDiEnvironment(const RouDiConfig_t& roudiConfig, - const roudi::MonitoringMode monitoringMode, - const uint16_t uniqueRouDiId) - : RouDiEnvironment(BaseCTor::BASE, uniqueRouDiId) +RouDiEnv::RouDiEnv(const RouDiConfig_t& roudiConfig, + const roudi::MonitoringMode monitoringMode, + const uint16_t uniqueRouDiId) + : RouDiEnv(BaseCTor::BASE, uniqueRouDiId) { m_roudiComponents = std::unique_ptr(new roudi::IceOryxRouDiComponents(roudiConfig)); m_roudiApp = @@ -45,7 +45,7 @@ RouDiEnvironment::RouDiEnvironment(const RouDiConfig_t& roudiConfig, roudi::RouDi::RoudiStartupParameters{monitoringMode, false})); } -RouDiEnvironment::~RouDiEnvironment() +RouDiEnv::~RouDiEnv() { if (m_runtimes.m_doCleanupOnDestruction) { @@ -56,22 +56,22 @@ RouDiEnvironment::~RouDiEnvironment() CleanupRuntimes(); } -void RouDiEnvironment::SetInterOpWaitingTime(const std::chrono::milliseconds& v) +void RouDiEnv::SetInterOpWaitingTime(const std::chrono::milliseconds& v) { m_interOpWaitingTimeout = units::Duration::fromMilliseconds(v.count()); } -void RouDiEnvironment::InterOpWait() +void RouDiEnv::InterOpWait() { m_roudiApp->triggerDiscoveryLoopAndWaitToFinish(m_interOpWaitingTimeout); } -void RouDiEnvironment::CleanupAppResources(const RuntimeName_t& name) +void RouDiEnv::CleanupAppResources(const RuntimeName_t& name) { m_runtimes.eraseRuntime(name); } -void RouDiEnvironment::CleanupRuntimes() +void RouDiEnv::CleanupRuntimes() { m_runtimes.cleanupRuntimes(); } diff --git a/iceoryx_posh/test/integrationtests/test_roudi_roudi_environment.cpp b/iceoryx_posh/test/integrationtests/test_roudi_env.cpp similarity index 76% rename from iceoryx_posh/test/integrationtests/test_roudi_roudi_environment.cpp rename to iceoryx_posh/test/integrationtests/test_roudi_env.cpp index f78293ee64..78af11e8e3 100644 --- a/iceoryx_posh/test/integrationtests/test_roudi_roudi_environment.cpp +++ b/iceoryx_posh/test/integrationtests/test_roudi_env.cpp @@ -25,20 +25,13 @@ namespace using namespace ::testing; using namespace iox::roudi_env; -class RouDiEnvironment_test : public Test -{ - public: - void SetUp(){}; - void TearDown(){}; -}; - -TEST_F(RouDiEnvironment_test, StartingRouDiTwiceLeadsToError) +TEST(RouDiEnv_test, StartingRouDiTwiceLeadsToError) { ::testing::Test::RecordProperty("TEST_ID", "38075292-7897-4db5-b20e-f06ab324ad31"); - RouDiEnvironment m_sut{MinimalRouDiConfigBuilder().create()}; + RouDiEnv m_sut{MinimalRouDiConfigBuilder().create()}; GTEST_FLAG(death_test_style) = "threadsafe"; - EXPECT_DEATH({ RouDiEnvironment m_sut2{MinimalRouDiConfigBuilder().create()}; }, ".*"); + EXPECT_DEATH({ RouDiEnv m_sut2{MinimalRouDiConfigBuilder().create()}; }, ".*"); } } // namespace diff --git a/iceoryx_posh/testing/include/iceoryx_posh/testing/roudi_environment/roudi_environment.hpp b/iceoryx_posh/testing/include/iceoryx_posh/testing/roudi_environment/roudi_environment.hpp index c85802af54..455374ed87 100644 --- a/iceoryx_posh/testing/include/iceoryx_posh/testing/roudi_environment/roudi_environment.hpp +++ b/iceoryx_posh/testing/include/iceoryx_posh/testing/roudi_environment/roudi_environment.hpp @@ -18,13 +18,13 @@ #ifndef IOX_POSH_ROUDI_ENVIRONMENT_ROUDI_ENVIRONMENT_HPP #define IOX_POSH_ROUDI_ENVIRONMENT_ROUDI_ENVIRONMENT_HPP -#include "iceoryx_posh/roudi_env/roudi_environment.hpp" +#include "iceoryx_posh/roudi_env/roudi_env.hpp" namespace iox { namespace roudi { -using roudi_env::RouDiEnvironment; +using RouDiEnvironment = roudi_env::RouDiEnv; } } // namespace iox diff --git a/iceoryx_posh/testing/include/iceoryx_posh/testing/roudi_gtest.hpp b/iceoryx_posh/testing/include/iceoryx_posh/testing/roudi_gtest.hpp index cd5d8286d8..b3ec44c284 100644 --- a/iceoryx_posh/testing/include/iceoryx_posh/testing/roudi_gtest.hpp +++ b/iceoryx_posh/testing/include/iceoryx_posh/testing/roudi_gtest.hpp @@ -17,14 +17,14 @@ #ifndef IOX_POSH_TESTUTILS_ROUDI_GTEST_HPP #define IOX_POSH_TESTUTILS_ROUDI_GTEST_HPP -#include "iceoryx_posh/roudi_env/roudi_environment.hpp" +#include "iceoryx_posh/roudi_env/roudi_env.hpp" #include #include using namespace ::testing; -class RouDi_GTest : public iox::roudi_env::RouDiEnvironment, public Test +class RouDi_GTest : public iox::roudi_env::RouDiEnv, public Test { public: RouDi_GTest() = default; diff --git a/iceoryx_posh/testing/source/roudi_gtest.cpp b/iceoryx_posh/testing/source/roudi_gtest.cpp index 058f4ff04e..f2c562402c 100644 --- a/iceoryx_posh/testing/source/roudi_gtest.cpp +++ b/iceoryx_posh/testing/source/roudi_gtest.cpp @@ -18,6 +18,6 @@ #include "iceoryx_posh/testing/roudi_gtest.hpp" RouDi_GTest::RouDi_GTest(const iox::RouDiConfig_t& roudiConfig) - : iox::roudi_env::RouDiEnvironment(roudiConfig) + : iox::roudi_env::RouDiEnv(roudiConfig) { } From a9f21df193817f7d10ed8fccb56b0b7147017866 Mon Sep 17 00:00:00 2001 From: Mathias Kraus Date: Wed, 6 Sep 2023 17:03:02 +0200 Subject: [PATCH 05/12] iox-#1533 Better method names for 'RouDiEnv' --- .../iceoryx_posh/roudi_env/roudi_env.hpp | 16 +++++------ iceoryx_posh/roudi_env/source/roudi_env.cpp | 16 ++++++----- .../roudi_environment/roudi_environment.hpp | 27 +++++++++++++++++-- .../iceoryx_posh/testing/roudi_gtest.hpp | 4 +-- iceoryx_posh/testing/source/roudi_gtest.cpp | 2 +- 5 files changed, 43 insertions(+), 22 deletions(-) diff --git a/iceoryx_posh/roudi_env/include/iceoryx_posh/roudi_env/roudi_env.hpp b/iceoryx_posh/roudi_env/include/iceoryx_posh/roudi_env/roudi_env.hpp index 611ac75748..5efb9793fc 100644 --- a/iceoryx_posh/roudi_env/include/iceoryx_posh/roudi_env/roudi_env.hpp +++ b/iceoryx_posh/roudi_env/include/iceoryx_posh/roudi_env/roudi_env.hpp @@ -26,10 +26,6 @@ #include "iceoryx_posh/roudi_env/runtime_test_interface.hpp" #include "iox/duration.hpp" -#include -#include -#include - namespace iox { namespace roudi @@ -53,10 +49,10 @@ class RouDiEnv RouDiEnv(const RouDiEnv&) = delete; RouDiEnv& operator=(const RouDiEnv&) = delete; - void SetInterOpWaitingTime(const std::chrono::milliseconds& v); - void InterOpWait(); + void setDiscoveryLoopWaitToFinishTimeout(const units::Duration timeout); + void triggerDiscoveryLoopAndWaitToFinish(); - void CleanupAppResources(const RuntimeName_t& name); + void cleanupAppResources(const RuntimeName_t& name); protected: /// @note this is due to ambiguity of the cTor with the default parameter @@ -67,14 +63,14 @@ class RouDiEnv /// @brief for implementations on top of RouDiEnv RouDiEnv(BaseCTor, const uint16_t uniqueRouDiId = 0u); - void CleanupRuntimes(); + void cleanupRuntimes(); private: RuntimeTestInterface m_runtimes; #if defined(__APPLE__) - iox::units::Duration m_interOpWaitingTimeout{iox::units::Duration::fromMilliseconds(1000)}; + iox::units::Duration m_discoveryLoopWaitToFinishTimeout{iox::units::Duration::fromMilliseconds(1000)}; #else - iox::units::Duration m_interOpWaitingTimeout{iox::units::Duration::fromMilliseconds(200)}; + iox::units::Duration m_discoveryLoopWaitToFinishTimeout{iox::units::Duration::fromMilliseconds(200)}; #endif std::unique_ptr m_roudiComponents; std::unique_ptr m_roudiApp; diff --git a/iceoryx_posh/roudi_env/source/roudi_env.cpp b/iceoryx_posh/roudi_env/source/roudi_env.cpp index f1491af180..31b7b11e07 100644 --- a/iceoryx_posh/roudi_env/source/roudi_env.cpp +++ b/iceoryx_posh/roudi_env/source/roudi_env.cpp @@ -22,6 +22,8 @@ #include "iceoryx_posh/internal/roudi/roudi.hpp" #include "iceoryx_posh/runtime/posh_runtime.hpp" +#include + namespace iox { namespace roudi_env @@ -53,25 +55,25 @@ RouDiEnv::~RouDiEnv() auto errorHandlerGuard = iox::ErrorHandlerMock::setTemporaryErrorHandler([](auto, auto) {}); popo::UniquePortId::setUniqueRouDiId(roudi::DEFAULT_UNIQUE_ROUDI_ID); } - CleanupRuntimes(); + cleanupRuntimes(); } -void RouDiEnv::SetInterOpWaitingTime(const std::chrono::milliseconds& v) +void RouDiEnv::setDiscoveryLoopWaitToFinishTimeout(const units::Duration timeout) { - m_interOpWaitingTimeout = units::Duration::fromMilliseconds(v.count()); + m_discoveryLoopWaitToFinishTimeout = timeout; } -void RouDiEnv::InterOpWait() +void RouDiEnv::triggerDiscoveryLoopAndWaitToFinish() { - m_roudiApp->triggerDiscoveryLoopAndWaitToFinish(m_interOpWaitingTimeout); + m_roudiApp->triggerDiscoveryLoopAndWaitToFinish(m_discoveryLoopWaitToFinishTimeout); } -void RouDiEnv::CleanupAppResources(const RuntimeName_t& name) +void RouDiEnv::cleanupAppResources(const RuntimeName_t& name) { m_runtimes.eraseRuntime(name); } -void RouDiEnv::CleanupRuntimes() +void RouDiEnv::cleanupRuntimes() { m_runtimes.cleanupRuntimes(); } diff --git a/iceoryx_posh/testing/include/iceoryx_posh/testing/roudi_environment/roudi_environment.hpp b/iceoryx_posh/testing/include/iceoryx_posh/testing/roudi_environment/roudi_environment.hpp index 455374ed87..288de9be93 100644 --- a/iceoryx_posh/testing/include/iceoryx_posh/testing/roudi_environment/roudi_environment.hpp +++ b/iceoryx_posh/testing/include/iceoryx_posh/testing/roudi_environment/roudi_environment.hpp @@ -20,12 +20,35 @@ #include "iceoryx_posh/roudi_env/roudi_env.hpp" +#include + namespace iox { namespace roudi { -using RouDiEnvironment = roudi_env::RouDiEnv; -} +class RouDiEnvironment : public roudi_env::RouDiEnv +{ + public: + using ParentType = roudi_env::RouDiEnv; + using ParentType::ParentType; + using ParentType::operator=; + + void SetInterOpWaitingTime(const std::chrono::milliseconds& v) + { + setDiscoveryLoopWaitToFinishTimeout(units::Duration::fromMilliseconds(v.count())); + } + + void InterOpWait() + { + triggerDiscoveryLoopAndWaitToFinish(); + } + + void CleanupAppResources(const RuntimeName_t& name) + { + cleanupAppResources(name); + } +}; +} // namespace roudi } // namespace iox #endif // IOX_POSH_ROUDI_ENVIRONMENT_ROUDI_ENVIRONMENT_HPP diff --git a/iceoryx_posh/testing/include/iceoryx_posh/testing/roudi_gtest.hpp b/iceoryx_posh/testing/include/iceoryx_posh/testing/roudi_gtest.hpp index b3ec44c284..bce77b7557 100644 --- a/iceoryx_posh/testing/include/iceoryx_posh/testing/roudi_gtest.hpp +++ b/iceoryx_posh/testing/include/iceoryx_posh/testing/roudi_gtest.hpp @@ -17,14 +17,14 @@ #ifndef IOX_POSH_TESTUTILS_ROUDI_GTEST_HPP #define IOX_POSH_TESTUTILS_ROUDI_GTEST_HPP -#include "iceoryx_posh/roudi_env/roudi_env.hpp" +#include "iceoryx_posh/testing/roudi_environment/roudi_environment.hpp" #include #include using namespace ::testing; -class RouDi_GTest : public iox::roudi_env::RouDiEnv, public Test +class RouDi_GTest : public iox::roudi::RouDiEnvironment, public Test { public: RouDi_GTest() = default; diff --git a/iceoryx_posh/testing/source/roudi_gtest.cpp b/iceoryx_posh/testing/source/roudi_gtest.cpp index f2c562402c..6a78660463 100644 --- a/iceoryx_posh/testing/source/roudi_gtest.cpp +++ b/iceoryx_posh/testing/source/roudi_gtest.cpp @@ -18,6 +18,6 @@ #include "iceoryx_posh/testing/roudi_gtest.hpp" RouDi_GTest::RouDi_GTest(const iox::RouDiConfig_t& roudiConfig) - : iox::roudi_env::RouDiEnv(roudiConfig) + : iox::roudi::RouDiEnvironment(roudiConfig) { } From 67e5637dca0fc66eef00f46fc4d642eb018ca34f Mon Sep 17 00:00:00 2001 From: Mathias Kraus Date: Wed, 6 Sep 2023 19:19:16 +0200 Subject: [PATCH 06/12] iox-#1533 Remove the gtest dependency from `RouDiEnv` --- iceoryx_posh/CMakeLists.txt | 7 ++- .../popo/building_blocks/unique_port_id.hpp | 10 ++++ iceoryx_posh/roudi_env/CMakeLists.txt | 43 ++++++++--------- .../iceoryx_posh/roudi_env/roudi_env.hpp | 5 +- iceoryx_posh/roudi_env/source/roudi_env.cpp | 13 ++---- .../popo/building_blocks/unique_port_id.cpp | 5 ++ iceoryx_posh/testing/CMakeLists.txt | 46 +++++++++---------- 7 files changed, 67 insertions(+), 62 deletions(-) diff --git a/iceoryx_posh/CMakeLists.txt b/iceoryx_posh/CMakeLists.txt index ab76579a11..6280e5cfc3 100644 --- a/iceoryx_posh/CMakeLists.txt +++ b/iceoryx_posh/CMakeLists.txt @@ -299,9 +299,12 @@ setup_install_directories_and_export_package( INCLUDE_DIRECTORIES include/ ) -add_subdirectory(roudi_env) -add_subdirectory(testing) + +if(ROUDI_ENVIRONMENT OR BUILD_TEST) + add_subdirectory(roudi_env) +endif() if(BUILD_TEST) + add_subdirectory(testing) add_subdirectory(test) endif() diff --git a/iceoryx_posh/include/iceoryx_posh/internal/popo/building_blocks/unique_port_id.hpp b/iceoryx_posh/include/iceoryx_posh/internal/popo/building_blocks/unique_port_id.hpp index 1b5abc52e8..ab65593a05 100644 --- a/iceoryx_posh/include/iceoryx_posh/internal/popo/building_blocks/unique_port_id.hpp +++ b/iceoryx_posh/include/iceoryx_posh/internal/popo/building_blocks/unique_port_id.hpp @@ -25,6 +25,11 @@ namespace iox { +namespace roudi_env +{ +class RouDiEnv; +} + namespace popo { /// @brief Struct to signal the constructor to create an invalid id @@ -74,6 +79,11 @@ class UniquePortId : public NewType([](auto, auto) {}); - iox::popo::UniquePortId::setUniqueRouDiId(uniqueRouDiId); + popo::UniquePortId::rouDiEnvOverideUniqueRouDiId(uniqueRouDiId); } RouDiEnv::RouDiEnv(const RouDiConfig_t& roudiConfig, const roudi::MonitoringMode monitoringMode, const uint16_t uniqueRouDiId) - : RouDiEnv(BaseCTor::BASE, uniqueRouDiId) + : RouDiEnv(MainCTor{}, uniqueRouDiId) { m_roudiComponents = std::unique_ptr(new roudi::IceOryxRouDiComponents(roudiConfig)); m_roudiApp = @@ -51,9 +48,7 @@ RouDiEnv::~RouDiEnv() { if (m_runtimes.m_doCleanupOnDestruction) { - // setUniqueRouDiId is called multiple times but it is okay for the tests - auto errorHandlerGuard = iox::ErrorHandlerMock::setTemporaryErrorHandler([](auto, auto) {}); - popo::UniquePortId::setUniqueRouDiId(roudi::DEFAULT_UNIQUE_ROUDI_ID); + popo::UniquePortId::rouDiEnvOverideUniqueRouDiId(roudi::DEFAULT_UNIQUE_ROUDI_ID); } cleanupRuntimes(); } diff --git a/iceoryx_posh/source/popo/building_blocks/unique_port_id.cpp b/iceoryx_posh/source/popo/building_blocks/unique_port_id.cpp index a775a4991c..d2393584a9 100644 --- a/iceoryx_posh/source/popo/building_blocks/unique_port_id.cpp +++ b/iceoryx_posh/source/popo/building_blocks/unique_port_id.cpp @@ -63,6 +63,11 @@ void UniquePortId::setUniqueRouDiId(const uint16_t id) noexcept uniqueRouDiId.store(id, std::memory_order_relaxed); } +void UniquePortId::rouDiEnvOverideUniqueRouDiId(const uint16_t id) noexcept +{ + uniqueRouDiId.store(id, std::memory_order_relaxed); +} + bool UniquePortId::finalizeSetUniqueRouDiId() noexcept { static bool finalized{false}; diff --git a/iceoryx_posh/testing/CMakeLists.txt b/iceoryx_posh/testing/CMakeLists.txt index 24f57c52d7..2e50caf9c3 100644 --- a/iceoryx_posh/testing/CMakeLists.txt +++ b/iceoryx_posh/testing/CMakeLists.txt @@ -15,27 +15,25 @@ # # SPDX-License-Identifier: Apache-2.0 -if(ROUDI_ENVIRONMENT OR BUILD_TEST) - # - ######### posh roudi environment ########## - # - find_package(GTest CONFIG REQUIRED) - find_package(iceoryx_hoofs_testing REQUIRED) - iox_add_library( - STATIC - TARGET iceoryx_posh_testing - NAMESPACE iceoryx_posh_testing - PROJECT_PREFIX ${PREFIX} - BUILD_INTERFACE ${CMAKE_CURRENT_SOURCE_DIR}/include - INSTALL_INTERFACE include/${PREFIX} - EXPORT_INCLUDE_DIRS include/ - PUBLIC_LIBS GTest::gtest - GTest::gmock - iceoryx_posh::iceoryx_posh_roudi_env - PRIVATE_LIBS iceoryx_posh::iceoryx_posh - iceoryx_hoofs::iceoryx_hoofs - iceoryx_hoofs_testing::iceoryx_hoofs_testing - FILES - source/roudi_gtest.cpp - ) -endif() +# +######### posh testing ########## +# +find_package(GTest CONFIG REQUIRED) +find_package(iceoryx_hoofs_testing REQUIRED) +iox_add_library( + STATIC + TARGET iceoryx_posh_testing + NAMESPACE iceoryx_posh_testing + PROJECT_PREFIX ${PREFIX} + BUILD_INTERFACE ${CMAKE_CURRENT_SOURCE_DIR}/include + INSTALL_INTERFACE include/${PREFIX} + EXPORT_INCLUDE_DIRS include/ + PUBLIC_LIBS GTest::gtest + GTest::gmock + iceoryx_posh::iceoryx_posh_roudi_env + PRIVATE_LIBS iceoryx_posh::iceoryx_posh + iceoryx_hoofs::iceoryx_hoofs + iceoryx_hoofs_testing::iceoryx_hoofs_testing + FILES + source/roudi_gtest.cpp +) From 1a6d3bff815234b11937e066c9e1d94f865ef5f3 Mon Sep 17 00:00:00 2001 From: Mathias Kraus Date: Wed, 6 Sep 2023 20:51:04 +0200 Subject: [PATCH 07/12] iox-#1533 Deprecate old API --- .../iceoryx_posh/roudi_env/roudi_env.hpp | 18 +++++------ iceoryx_posh/roudi_env/source/roudi_env.cpp | 14 ++++----- .../roudi_environment/roudi_environment.hpp | 16 +++++++--- .../iceoryx_posh/testing/roudi_gtest.hpp | 30 +++++++++++++++---- iceoryx_posh/testing/source/roudi_gtest.cpp | 27 +++++++++++++++-- 5 files changed, 78 insertions(+), 27 deletions(-) diff --git a/iceoryx_posh/roudi_env/include/iceoryx_posh/roudi_env/roudi_env.hpp b/iceoryx_posh/roudi_env/include/iceoryx_posh/roudi_env/roudi_env.hpp index 34974542ee..224d6319d8 100644 --- a/iceoryx_posh/roudi_env/include/iceoryx_posh/roudi_env/roudi_env.hpp +++ b/iceoryx_posh/roudi_env/include/iceoryx_posh/roudi_env/roudi_env.hpp @@ -40,19 +40,19 @@ class RouDiEnv public: RouDiEnv(const RouDiConfig_t& roudiConfig = RouDiConfig_t().setDefaults(), roudi::MonitoringMode monitoringMode = roudi::MonitoringMode::OFF, - const uint16_t uniqueRouDiId = 0u); - virtual ~RouDiEnv(); + const uint16_t uniqueRouDiId = 0u) noexcept; + virtual ~RouDiEnv() noexcept; - RouDiEnv(RouDiEnv&& rhs) = default; - RouDiEnv& operator=(RouDiEnv&& rhs) = default; + RouDiEnv(RouDiEnv&& rhs) noexcept = default; + RouDiEnv& operator=(RouDiEnv&& rhs) noexcept = default; RouDiEnv(const RouDiEnv&) = delete; RouDiEnv& operator=(const RouDiEnv&) = delete; - void setDiscoveryLoopWaitToFinishTimeout(const units::Duration timeout); - void triggerDiscoveryLoopAndWaitToFinish(); + void setDiscoveryLoopWaitToFinishTimeout(const units::Duration timeout) noexcept; + void triggerDiscoveryLoopAndWaitToFinish() noexcept; - void cleanupAppResources(const RuntimeName_t& name); + void cleanupAppResources(const RuntimeName_t& name) noexcept; protected: /// @note this is due to ambiguity of the cTor with the default parameter @@ -60,9 +60,9 @@ class RouDiEnv { }; /// @brief for implementations on top of RouDiEnv - RouDiEnv(MainCTor, const uint16_t uniqueRouDiId = 0u); + RouDiEnv(MainCTor, const uint16_t uniqueRouDiId = 0u) noexcept; - void cleanupRuntimes(); + void cleanupRuntimes() noexcept; private: RuntimeTestInterface m_runtimes; diff --git a/iceoryx_posh/roudi_env/source/roudi_env.cpp b/iceoryx_posh/roudi_env/source/roudi_env.cpp index d61732fc30..0347aa59c0 100644 --- a/iceoryx_posh/roudi_env/source/roudi_env.cpp +++ b/iceoryx_posh/roudi_env/source/roudi_env.cpp @@ -27,14 +27,14 @@ namespace iox { namespace roudi_env { -RouDiEnv::RouDiEnv(MainCTor, const uint16_t uniqueRouDiId) +RouDiEnv::RouDiEnv(MainCTor, const uint16_t uniqueRouDiId) noexcept { popo::UniquePortId::rouDiEnvOverideUniqueRouDiId(uniqueRouDiId); } RouDiEnv::RouDiEnv(const RouDiConfig_t& roudiConfig, const roudi::MonitoringMode monitoringMode, - const uint16_t uniqueRouDiId) + const uint16_t uniqueRouDiId) noexcept : RouDiEnv(MainCTor{}, uniqueRouDiId) { m_roudiComponents = std::unique_ptr(new roudi::IceOryxRouDiComponents(roudiConfig)); @@ -44,7 +44,7 @@ RouDiEnv::RouDiEnv(const RouDiConfig_t& roudiConfig, roudi::RouDi::RoudiStartupParameters{monitoringMode, false})); } -RouDiEnv::~RouDiEnv() +RouDiEnv::~RouDiEnv() noexcept { if (m_runtimes.m_doCleanupOnDestruction) { @@ -53,22 +53,22 @@ RouDiEnv::~RouDiEnv() cleanupRuntimes(); } -void RouDiEnv::setDiscoveryLoopWaitToFinishTimeout(const units::Duration timeout) +void RouDiEnv::setDiscoveryLoopWaitToFinishTimeout(const units::Duration timeout) noexcept { m_discoveryLoopWaitToFinishTimeout = timeout; } -void RouDiEnv::triggerDiscoveryLoopAndWaitToFinish() +void RouDiEnv::triggerDiscoveryLoopAndWaitToFinish() noexcept { m_roudiApp->triggerDiscoveryLoopAndWaitToFinish(m_discoveryLoopWaitToFinishTimeout); } -void RouDiEnv::cleanupAppResources(const RuntimeName_t& name) +void RouDiEnv::cleanupAppResources(const RuntimeName_t& name) noexcept { m_runtimes.eraseRuntime(name); } -void RouDiEnv::cleanupRuntimes() +void RouDiEnv::cleanupRuntimes() noexcept { m_runtimes.cleanupRuntimes(); } diff --git a/iceoryx_posh/testing/include/iceoryx_posh/testing/roudi_environment/roudi_environment.hpp b/iceoryx_posh/testing/include/iceoryx_posh/testing/roudi_environment/roudi_environment.hpp index 288de9be93..142081490c 100644 --- a/iceoryx_posh/testing/include/iceoryx_posh/testing/roudi_environment/roudi_environment.hpp +++ b/iceoryx_posh/testing/include/iceoryx_posh/testing/roudi_environment/roudi_environment.hpp @@ -26,24 +26,32 @@ namespace iox { namespace roudi { -class RouDiEnvironment : public roudi_env::RouDiEnv +/// @deprecated Deprecated in 3.0, removed in 4.0, please port to 'iox::roudi_env::RouDiEnv' +class [[deprecated("Deprecated in 3.0, removed in 4.0, please port to 'iox::roudi_env::RouDiEnv'")]] RouDiEnvironment + : public roudi_env::RouDiEnv { public: using ParentType = roudi_env::RouDiEnv; using ParentType::ParentType; using ParentType::operator=; - void SetInterOpWaitingTime(const std::chrono::milliseconds& v) + /// @deprecated Deprecated in 3.0, removed in 4.0, please port to 'setDiscoveryLoopWaitToFinishTimeout' + [[deprecated("Deprecated in 3.0, removed in 4.0, please port to 'setDiscoveryLoopWaitToFinishTimeout'")]] void + SetInterOpWaitingTime(const std::chrono::milliseconds& v) noexcept { setDiscoveryLoopWaitToFinishTimeout(units::Duration::fromMilliseconds(v.count())); } - void InterOpWait() + /// @deprecated Deprecated in 3.0, removed in 4.0, please port to 'triggerDiscoveryLoopAndWaitToFinish' + [[deprecated("Deprecated in 3.0, removed in 4.0, please port to 'triggerDiscoveryLoopAndWaitToFinish'")]] void + InterOpWait() noexcept { triggerDiscoveryLoopAndWaitToFinish(); } - void CleanupAppResources(const RuntimeName_t& name) + /// @deprecated Deprecated in 3.0, removed in 4.0, please port to 'cleanupAppResources' + [[deprecated("Deprecated in 3.0, removed in 4.0, please port to 'cleanupAppResources'")]] void CleanupAppResources( + const RuntimeName_t& name) noexcept { cleanupAppResources(name); } diff --git a/iceoryx_posh/testing/include/iceoryx_posh/testing/roudi_gtest.hpp b/iceoryx_posh/testing/include/iceoryx_posh/testing/roudi_gtest.hpp index bce77b7557..50a6dea74a 100644 --- a/iceoryx_posh/testing/include/iceoryx_posh/testing/roudi_gtest.hpp +++ b/iceoryx_posh/testing/include/iceoryx_posh/testing/roudi_gtest.hpp @@ -17,18 +17,38 @@ #ifndef IOX_POSH_TESTUTILS_ROUDI_GTEST_HPP #define IOX_POSH_TESTUTILS_ROUDI_GTEST_HPP -#include "iceoryx_posh/testing/roudi_environment/roudi_environment.hpp" +#include "iceoryx_posh/roudi_env/roudi_env.hpp" #include #include -using namespace ::testing; - -class RouDi_GTest : public iox::roudi::RouDiEnvironment, public Test +namespace iox +{ +namespace testing +{ +class RouDi_GTest : public iox::roudi_env::RouDiEnv, public ::testing::Test { public: RouDi_GTest() = default; - RouDi_GTest(const iox::RouDiConfig_t& roudiConfig); + RouDi_GTest(const iox::RouDiConfig_t& roudiConfig) noexcept; + + /// @deprecated Deprecated in 3.0, removed in 4.0, please port to 'setDiscoveryLoopWaitToFinishTimeout' + [[deprecated("Deprecated in 3.0, removed in 4.0, please port to 'setDiscoveryLoopWaitToFinishTimeout'")]] void + SetInterOpWaitingTime(const std::chrono::milliseconds& v) noexcept; + + /// @deprecated Deprecated in 3.0, removed in 4.0, please port to 'triggerDiscoveryLoopAndWaitToFinish' + [[deprecated("Deprecated in 3.0, removed in 4.0, please port to 'triggerDiscoveryLoopAndWaitToFinish'")]] void + InterOpWait() noexcept; + + /// @deprecated Deprecated in 3.0, removed in 4.0, please port to 'cleanupAppResources' + [[deprecated("Deprecated in 3.0, removed in 4.0, please port to 'cleanupAppResources'")]] void + CleanupAppResources(const RuntimeName_t& name) noexcept; }; +} // namespace testing +} // namespace iox + +/// @deprecated Deprecated in 3.0, removed in 4.0, please use 'RouDi_GTest' with the 'iox::testing' namespace +using RouDi_GTest = iox::testing::RouDi_GTest; + #endif // IOX_POSH_TESTUTILS_ROUDI_GTEST_HPP diff --git a/iceoryx_posh/testing/source/roudi_gtest.cpp b/iceoryx_posh/testing/source/roudi_gtest.cpp index 6a78660463..65b4579230 100644 --- a/iceoryx_posh/testing/source/roudi_gtest.cpp +++ b/iceoryx_posh/testing/source/roudi_gtest.cpp @@ -17,7 +17,30 @@ #include "iceoryx_posh/testing/roudi_gtest.hpp" -RouDi_GTest::RouDi_GTest(const iox::RouDiConfig_t& roudiConfig) - : iox::roudi::RouDiEnvironment(roudiConfig) +namespace iox +{ +namespace testing +{ + +RouDi_GTest::RouDi_GTest(const iox::RouDiConfig_t& roudiConfig) noexcept + : iox::roudi_env::RouDiEnv(roudiConfig) { } + +void RouDi_GTest::SetInterOpWaitingTime(const std::chrono::milliseconds& v) noexcept +{ + setDiscoveryLoopWaitToFinishTimeout(units::Duration::fromMilliseconds(v.count())); +} + +void RouDi_GTest::InterOpWait() noexcept +{ + triggerDiscoveryLoopAndWaitToFinish(); +} + +void RouDi_GTest::CleanupAppResources(const RuntimeName_t& name) noexcept +{ + cleanupAppResources(name); +} + +} // namespace testing +} // namespace iox From 25ace843e409c8554ae00647865c05208841645b Mon Sep 17 00:00:00 2001 From: Mathias Kraus Date: Wed, 6 Sep 2023 20:51:24 +0200 Subject: [PATCH 08/12] iox-#1533 Port to non-deprecated API --- .../test/moduletests/test_chunk.cpp | 1 + .../test/moduletests/test_node.cpp | 1 + .../test/moduletests/test_publisher.cpp | 4 +-- .../test/moduletests/test_runtime.cpp | 1 + .../moduletests/test_service_discovery.cpp | 14 ++++---- .../test/moduletests/test_subscriber.cpp | 6 ++-- .../test_interface_port_stack_blowup.cpp | 1 + .../test_popo_pub_sub_listener.cpp | 1 + .../test/integrationtests/test_posh_mepoo.cpp | 10 +++--- ...est_publisher_subscriber_communication.cpp | 1 + .../test/integrationtests/test_roudi_env.cpp | 2 +- .../test_service_discovery.cpp | 34 +++++++++---------- .../test/moduletests/test_posh_runtime.cpp | 5 ++- .../moduletests/test_posh_runtime_node.cpp | 4 +-- .../test_posh_runtime_single_process.cpp | 4 +-- 15 files changed, 47 insertions(+), 42 deletions(-) diff --git a/iceoryx_binding_c/test/moduletests/test_chunk.cpp b/iceoryx_binding_c/test/moduletests/test_chunk.cpp index 7b76c41474..7491ee78b3 100644 --- a/iceoryx_binding_c/test/moduletests/test_chunk.cpp +++ b/iceoryx_binding_c/test/moduletests/test_chunk.cpp @@ -27,6 +27,7 @@ extern "C" { namespace { +using namespace ::testing; using namespace iox; using namespace iox::mepoo; using namespace iox::roudi_env; diff --git a/iceoryx_binding_c/test/moduletests/test_node.cpp b/iceoryx_binding_c/test/moduletests/test_node.cpp index 83c39e3f79..d1f57f287c 100644 --- a/iceoryx_binding_c/test/moduletests/test_node.cpp +++ b/iceoryx_binding_c/test/moduletests/test_node.cpp @@ -29,6 +29,7 @@ extern "C" { namespace { +using namespace ::testing; using namespace iox; using namespace iox::runtime; using namespace iox::roudi_env; diff --git a/iceoryx_binding_c/test/moduletests/test_publisher.cpp b/iceoryx_binding_c/test/moduletests/test_publisher.cpp index 7e9852dce2..25a851cee3 100644 --- a/iceoryx_binding_c/test/moduletests/test_publisher.cpp +++ b/iceoryx_binding_c/test/moduletests/test_publisher.cpp @@ -25,7 +25,7 @@ #include "iceoryx_posh/internal/popo/ports/publisher_port_user.hpp" #include "iceoryx_posh/mepoo/mepoo_config.hpp" #include "iceoryx_posh/roudi_env/minimal_roudi_config.hpp" -#include "iceoryx_posh/testing/roudi_environment/roudi_environment.hpp" +#include "iceoryx_posh/roudi_env/roudi_env.hpp" using namespace iox; using namespace iox::popo; @@ -144,7 +144,7 @@ TEST(iox_pub_test_DeathTest, initPublisherWithNotInitializedPublisherOptionsTerm TEST_F(iox_pub_test, initPublisherWithDefaultOptionsWorks) { ::testing::Test::RecordProperty("TEST_ID", "d2e677cd-2fcc-47a2-80e6-2d08245b7c1a"); - iox::roudi::RouDiEnvironment roudiEnv{MinimalRouDiConfigBuilder().create()}; + iox::roudi_env::RouDiEnv roudiEnv{MinimalRouDiConfigBuilder().create()}; iox_runtime_init("hypnotoad"); diff --git a/iceoryx_binding_c/test/moduletests/test_runtime.cpp b/iceoryx_binding_c/test/moduletests/test_runtime.cpp index 1533c13786..fe54a12bb8 100644 --- a/iceoryx_binding_c/test/moduletests/test_runtime.cpp +++ b/iceoryx_binding_c/test/moduletests/test_runtime.cpp @@ -26,6 +26,7 @@ extern "C" { namespace { +using namespace ::testing; using namespace iox; using namespace iox::runtime; using namespace iox::roudi_env; diff --git a/iceoryx_binding_c/test/moduletests/test_service_discovery.cpp b/iceoryx_binding_c/test/moduletests/test_service_discovery.cpp index c2208c32fc..2df97f6922 100644 --- a/iceoryx_binding_c/test/moduletests/test_service_discovery.cpp +++ b/iceoryx_binding_c/test/moduletests/test_service_discovery.cpp @@ -84,7 +84,7 @@ TEST_F(iox_service_discovery_test, ::testing::Test::RecordProperty("TEST_ID", "09a2cd6c-fba9-4b9d-af96-c5a6cc168d98"); // let the roudi discovery loop run at least once - InterOpWait(); + triggerDiscoveryLoopAndWaitToFinish(); iox_service_discovery_find_service_apply_callable_with_context_data( sut, nullptr, nullptr, nullptr, findHandler, &searchResult, MessagingPattern_PUB_SUB); @@ -104,7 +104,7 @@ TEST_F(iox_service_discovery_test, FindServiceWithCallableAndContextDataReturnsO ASSERT_NE(publisher, nullptr); const iox_service_description_t SERVICE_DESCRIPTION = iox_pub_get_service_description(publisher); - InterOpWait(); + triggerDiscoveryLoopAndWaitToFinish(); iox_service_discovery_find_service_apply_callable_with_context_data(sut, SERVICE_DESCRIPTION.serviceString, @@ -125,7 +125,7 @@ TEST_F(iox_service_discovery_test, FindServiceWithCallableWithNullptrsForService { ::testing::Test::RecordProperty("TEST_ID", "ec565ca3-7494-42d7-9440-2000f1513759"); - InterOpWait(); + triggerDiscoveryLoopAndWaitToFinish(); auto findHandler = [](const iox_service_description_t s) { EXPECT_THAT(s.instanceString, StrEq("RouDi_ID")); }; iox_service_discovery_find_service_apply_callable( @@ -141,7 +141,7 @@ TEST_F(iox_service_discovery_test, FindServiceWithCallableReturnsFindsCorrectSer auto* publisher = iox_pub_init(&storage, "service", "instance", "event", &options); ASSERT_NE(publisher, nullptr); - InterOpWait(); + triggerDiscoveryLoopAndWaitToFinish(); auto findHandler = [](const iox_service_description_t s) { EXPECT_THAT(s.serviceString, StrEq("service")); @@ -158,7 +158,7 @@ TEST_F(iox_service_discovery_test, FindServiceWithNullptrsForServiceInstanceEven { ::testing::Test::RecordProperty("TEST_ID", "75b411d7-b8c7-42d5-8acd-3916fd172081"); - InterOpWait(); + triggerDiscoveryLoopAndWaitToFinish(); const uint64_t SERVICE_CONTAINER_CAPACITY = 10U; iox_service_description_t serviceContainer[SERVICE_CONTAINER_CAPACITY]; @@ -190,7 +190,7 @@ TEST_F(iox_service_discovery_test, FindServiceReturnsOfferedService) ASSERT_NE(publisher, nullptr); const iox_service_description_t SERVICE_DESCRIPTION = iox_pub_get_service_description(publisher); - InterOpWait(); + triggerDiscoveryLoopAndWaitToFinish(); const uint64_t SERVICE_CONTAINER_CAPACITY = 10U; iox_service_description_t serviceContainer[SERVICE_CONTAINER_CAPACITY]; @@ -217,7 +217,7 @@ TEST_F(iox_service_discovery_test, FindServiceReturnsCorrectNumberOfServicesWhen { ::testing::Test::RecordProperty("TEST_ID", "01047b88-f257-447c-8c5e-9bef7c358433"); - InterOpWait(); + triggerDiscoveryLoopAndWaitToFinish(); const uint64_t SERVICE_CONTAINER_CAPACITY = 3U; iox_service_description_t serviceContainer[SERVICE_CONTAINER_CAPACITY]; diff --git a/iceoryx_binding_c/test/moduletests/test_subscriber.cpp b/iceoryx_binding_c/test/moduletests/test_subscriber.cpp index 0cfbb80271..8eaff88ae1 100644 --- a/iceoryx_binding_c/test/moduletests/test_subscriber.cpp +++ b/iceoryx_binding_c/test/moduletests/test_subscriber.cpp @@ -27,7 +27,7 @@ #include "iceoryx_posh/internal/popo/ports/subscriber_port_user.hpp" #include "iceoryx_posh/mepoo/mepoo_config.hpp" #include "iceoryx_posh/roudi_env/minimal_roudi_config.hpp" -#include "iceoryx_posh/testing/roudi_environment/roudi_environment.hpp" +#include "iceoryx_posh/roudi_env/roudi_env.hpp" #include "mocks/wait_set_mock.hpp" using namespace iox; @@ -149,7 +149,7 @@ TEST_F(iox_sub_test, initSubscriberWithNotInitializedSubscriberOptionsTerminates TEST_F(iox_sub_test, initSubscriberWithDefaultOptionsWorks) { ::testing::Test::RecordProperty("TEST_ID", "40eaa006-4781-46cd-bde3-40fa7d572f29"); - iox::roudi::RouDiEnvironment roudiEnv{MinimalRouDiConfigBuilder().create()}; + RouDiEnv roudiEnv{MinimalRouDiConfigBuilder().create()}; iox_runtime_init("hypnotoad"); @@ -406,7 +406,7 @@ TEST_F(iox_sub_test, hasDataTriggersWaitSetWithCorrectCallback) TEST_F(iox_sub_test, deinitSubscriberDetachesTriggerFromWaitSet) { ::testing::Test::RecordProperty("TEST_ID", "93e350fb-5430-43ff-982b-b43c6ae9b890"); - iox::roudi::RouDiEnvironment roudiEnv{MinimalRouDiConfigBuilder().create()}; + RouDiEnv roudiEnv{MinimalRouDiConfigBuilder().create()}; iox_runtime_init("hypnotoad"); iox_sub_storage_t storage; diff --git a/iceoryx_posh/test/integrationtests/test_interface_port_stack_blowup.cpp b/iceoryx_posh/test/integrationtests/test_interface_port_stack_blowup.cpp index 52e73863e0..7bf2a7a19f 100644 --- a/iceoryx_posh/test/integrationtests/test_interface_port_stack_blowup.cpp +++ b/iceoryx_posh/test/integrationtests/test_interface_port_stack_blowup.cpp @@ -29,6 +29,7 @@ using namespace ::testing; using namespace iox::gw; using namespace iox::roudi_env; +using namespace iox::testing; class InterfacePortRequestStackBlowup_test : public RouDi_GTest { diff --git a/iceoryx_posh/test/integrationtests/test_popo_pub_sub_listener.cpp b/iceoryx_posh/test/integrationtests/test_popo_pub_sub_listener.cpp index 5e072751a7..e0e4f6f1da 100644 --- a/iceoryx_posh/test/integrationtests/test_popo_pub_sub_listener.cpp +++ b/iceoryx_posh/test/integrationtests/test_popo_pub_sub_listener.cpp @@ -31,6 +31,7 @@ using namespace iox::popo; using namespace iox::capro; using namespace iox::runtime; using namespace iox::roudi_env; +using namespace iox::testing; void onSampleReceivedCallback(Subscriber* subscriber IOX_MAYBE_UNUSED) { diff --git a/iceoryx_posh/test/integrationtests/test_posh_mepoo.cpp b/iceoryx_posh/test/integrationtests/test_posh_mepoo.cpp index 813f2568f2..7839e2a14f 100644 --- a/iceoryx_posh/test/integrationtests/test_posh_mepoo.cpp +++ b/iceoryx_posh/test/integrationtests/test_posh_mepoo.cpp @@ -23,8 +23,8 @@ #include "iceoryx_posh/popo/wait_set.hpp" #include "iceoryx_posh/roudi/introspection_types.hpp" #include "iceoryx_posh/roudi/roudi_app.hpp" +#include "iceoryx_posh/roudi_env/roudi_env.hpp" #include "iceoryx_posh/runtime/posh_runtime.hpp" -#include "iceoryx_posh/testing/roudi_environment/roudi_environment.hpp" #include "iox/duration.hpp" #include "iox/optional.hpp" @@ -38,8 +38,8 @@ namespace { using namespace ::testing; using namespace iox::units::duration_literals; +using namespace iox::roudi_env; using iox::mepoo::MePooConfig; -using iox::roudi::RouDiEnvironment; class Mepoo_IntegrationTest : public Test { @@ -115,7 +115,7 @@ class Mepoo_IntegrationTest : public Test const configType defaultconf = configType::DEFAULT) { auto config = createRouDiConfig(memPoolTestContainer, testMempoolConfig, defaultconf); - m_roudiEnv = iox::optional(config); + m_roudiEnv.emplace(config); ASSERT_THAT(m_roudiEnv.has_value(), Eq(true)); @@ -133,7 +133,7 @@ class Mepoo_IntegrationTest : public Test const configType defaultconf = configType::DEFAULT) { auto config = createRouDiConfig(memPoolTestContainer, testMempoolConfig, defaultconf); - m_roudiEnv = iox::optional(config); + m_roudiEnv.emplace(config); ASSERT_THAT(m_roudiEnv.has_value(), Eq(true)); } @@ -347,7 +347,7 @@ class Mepoo_IntegrationTest : public Test iox::optional publisherPort; iox::optional subscriberPort; - iox::optional m_roudiEnv; + iox::optional m_roudiEnv; }; constexpr uint32_t Mepoo_IntegrationTest::DEFAULT_NUMBER_OF_CHUNKS; diff --git a/iceoryx_posh/test/integrationtests/test_publisher_subscriber_communication.cpp b/iceoryx_posh/test/integrationtests/test_publisher_subscriber_communication.cpp index 1aaf74101a..2090f6e8a1 100644 --- a/iceoryx_posh/test/integrationtests/test_publisher_subscriber_communication.cpp +++ b/iceoryx_posh/test/integrationtests/test_publisher_subscriber_communication.cpp @@ -40,6 +40,7 @@ using namespace iox; using namespace iox::popo; using namespace iox::cxx; using namespace iox::roudi_env; +using namespace iox::testing; template struct ComplexDataType diff --git a/iceoryx_posh/test/integrationtests/test_roudi_env.cpp b/iceoryx_posh/test/integrationtests/test_roudi_env.cpp index 78af11e8e3..ebc462336c 100644 --- a/iceoryx_posh/test/integrationtests/test_roudi_env.cpp +++ b/iceoryx_posh/test/integrationtests/test_roudi_env.cpp @@ -16,7 +16,7 @@ #include "iceoryx_posh/roudi_env/minimal_roudi_config.hpp" -#include "iceoryx_posh/testing/roudi_environment/roudi_environment.hpp" +#include "iceoryx_posh/roudi_env/roudi_env.hpp" #include "test.hpp" diff --git a/iceoryx_posh/test/integrationtests/test_service_discovery.cpp b/iceoryx_posh/test/integrationtests/test_service_discovery.cpp index 335cf7fd27..8378dfb1e8 100644 --- a/iceoryx_posh/test/integrationtests/test_service_discovery.cpp +++ b/iceoryx_posh/test/integrationtests/test_service_discovery.cpp @@ -196,7 +196,7 @@ TYPED_TEST(ServiceDiscovery_test, ReofferedServiceCanBeFound) const iox::capro::ServiceDescription SERVICE_DESCRIPTION("service", "instance", "event"); typename TestFixture::CommunicationKind::Producer producer(SERVICE_DESCRIPTION); - this->InterOpWait(); + this->triggerDiscoveryLoopAndWaitToFinish(); this->findService(SERVICE_DESCRIPTION); @@ -205,7 +205,7 @@ TYPED_TEST(ServiceDiscovery_test, ReofferedServiceCanBeFound) producer.stopOffer(); - this->InterOpWait(); + this->triggerDiscoveryLoopAndWaitToFinish(); this->findService(SERVICE_DESCRIPTION); @@ -213,7 +213,7 @@ TYPED_TEST(ServiceDiscovery_test, ReofferedServiceCanBeFound) producer.offer(); - this->InterOpWait(); + this->triggerDiscoveryLoopAndWaitToFinish(); this->findService(SERVICE_DESCRIPTION); @@ -228,7 +228,7 @@ TYPED_TEST(ServiceDiscovery_test, ServiceOfferedMultipleTimesCanBeFound) const iox::capro::ServiceDescription SERVICE_DESCRIPTION("service", "instance", "event"); typename TestFixture::CommunicationKind::Producer producer(SERVICE_DESCRIPTION); - this->InterOpWait(); + this->triggerDiscoveryLoopAndWaitToFinish(); this->findService(SERVICE_DESCRIPTION); @@ -237,7 +237,7 @@ TYPED_TEST(ServiceDiscovery_test, ServiceOfferedMultipleTimesCanBeFound) producer.offer(); - this->InterOpWait(); + this->triggerDiscoveryLoopAndWaitToFinish(); this->findService(SERVICE_DESCRIPTION); @@ -805,7 +805,7 @@ TYPED_TEST(ServiceDiscoveryFindService_test, FindWhenNothingOffered) ::testing::Test::RecordProperty("TEST_ID", "7f0bf2c0-5e96-4da6-b282-f84917bb5243"); // ensure the discovery loop ran at least once - this->InterOpWait(); + this->triggerDiscoveryLoopAndWaitToFinish(); // Checks whether the reference implementation result matches the sut result if we call // findService({"a"}, {"b"}, {"c"}). @@ -819,7 +819,7 @@ TYPED_TEST(ServiceDiscoveryFindService_test, FindWhenSingleServiceOffered) ::testing::Test::RecordProperty("TEST_ID", "aab09c10-8b1e-4f25-8f72-bd762b69f2cb"); this->add({"a", "b", "c"}); - this->InterOpWait(); + this->triggerDiscoveryLoopAndWaitToFinish(); this->testFindService({"a"}, {"b"}, {"c"}); } @@ -830,7 +830,7 @@ TYPED_TEST(ServiceDiscoveryFindService_test, FindWhenSingleServiceIsOfferedMulti this->add({"a", "b", "c"}); this->add({"a", "b", "c"}); - this->InterOpWait(); + this->triggerDiscoveryLoopAndWaitToFinish(); this->testFindService({"a"}, {"b"}, {"c"}); } @@ -843,7 +843,7 @@ TYPED_TEST(ServiceDiscoveryFindService_test, FindWhenMultipleServicesAreOffered) this->add({"aa", "a", "c"}); this->add({"a", "ab", "a"}); - this->InterOpWait(); + this->triggerDiscoveryLoopAndWaitToFinish(); this->testFindService({"aa"}, {"a"}, {"c"}); } @@ -854,7 +854,7 @@ TYPED_TEST(ServiceDiscoveryFindService_test, FindWhenMultipleInstancesOfTheSameS this->add({"a", "b", "c"}); this->add({"a", "d", "c"}); - this->InterOpWait(); + this->triggerDiscoveryLoopAndWaitToFinish(); this->testFindService({"a"}, {"d"}, {"c"}); } @@ -867,7 +867,7 @@ TYPED_TEST(ServiceDiscoveryFindService_test, RepeatedSearchYieldsSameResult) this->add({"aa", "a", "c"}); this->add({"a", "ab", "a"}); - this->InterOpWait(); + this->triggerDiscoveryLoopAndWaitToFinish(); this->testFindService({"a"}, {"b"}, {"aa"}); auto previousResult = serviceContainer; @@ -881,7 +881,7 @@ TYPED_TEST(ServiceDiscoveryFindService_test, FindNonExistingService) ::testing::Test::RecordProperty("TEST_ID", "6f953d0d-bae3-45a1-82e7-c78a32b6d365"); this->add({"a", "b", "c"}); - this->InterOpWait(); + this->triggerDiscoveryLoopAndWaitToFinish(); // those are all representatives of equivalence classes of mismatches // that hould not be found @@ -906,7 +906,7 @@ TYPED_TEST(ServiceDiscoveryFindService_test, FindNonExistingServiceAmongMultiple this->add({"x", "b", "x"}); this->add({"x", "x", "x"}); - this->InterOpWait(); + this->triggerDiscoveryLoopAndWaitToFinish(); this->testFindService({"a"}, {"b"}, {"c"}); } @@ -956,7 +956,7 @@ TYPED_TEST(ServiceDiscoveryFindService_test, FindInMaximumServices) EXPECT_EQ(created, MAX); - this->InterOpWait(); + this->triggerDiscoveryLoopAndWaitToFinish(); // search for specific services we inserted at various times (includes wildcard searches etc.): // find first offered service, last offered service and some service offered inbetween @@ -975,7 +975,7 @@ TYPED_TEST(ServiceDiscoveryFindService_test, SameServerAndPublisherCanBeFound) this->add({"Ferdinand", "Schnüffel", "Spitz"}); this->addOther({"Ferdinand", "Schnüffel", "Spitz"}); - this->InterOpWait(); + this->triggerDiscoveryLoopAndWaitToFinish(); this->testFindService({"Ferdinand"}, {"Schnüffel"}, {"Spitz"}); } @@ -986,7 +986,7 @@ TYPED_TEST(ServiceDiscoveryFindService_test, OtherServiceKindWithMatchingNameIsN this->add({"Schnüffel", "Ferdinand", "Spitz"}); this->addOther({"Ferdinand", "Schnüffel", "Spitz"}); - this->InterOpWait(); + this->triggerDiscoveryLoopAndWaitToFinish(); this->testFindService({"Ferdinand"}, {"Schnüffel"}, {"Spitz"}); } @@ -1066,7 +1066,7 @@ TYPED_TEST(ServiceDiscoveryFindService_test, FindInMaximumMixedServices) EXPECT_EQ(created, OTHER_MAX); - this->InterOpWait(); + this->triggerDiscoveryLoopAndWaitToFinish(); // now we have the maximum of services of both kinds with semi-random services diff --git a/iceoryx_posh/test/moduletests/test_posh_runtime.cpp b/iceoryx_posh/test/moduletests/test_posh_runtime.cpp index 0759ff9718..f37c82c078 100644 --- a/iceoryx_posh/test/moduletests/test_posh_runtime.cpp +++ b/iceoryx_posh/test/moduletests/test_posh_runtime.cpp @@ -26,9 +26,9 @@ #include "iceoryx_posh/popo/untyped_client.hpp" #include "iceoryx_posh/popo/untyped_server.hpp" #include "iceoryx_posh/roudi_env/minimal_roudi_config.hpp" +#include "iceoryx_posh/roudi_env/roudi_env.hpp" #include "iceoryx_posh/runtime/posh_runtime.hpp" #include "iceoryx_posh/testing/mocks/posh_runtime_mock.hpp" -#include "iceoryx_posh/testing/roudi_environment/roudi_environment.hpp" #include "test.hpp" #include @@ -42,7 +42,6 @@ using namespace iox::cxx; using namespace iox; using namespace iox::popo; using namespace iox::roudi_env; -using iox::roudi::RouDiEnvironment; class PoshRuntime_test : public Test { @@ -106,7 +105,7 @@ class PoshRuntime_test : public Test } const iox::RuntimeName_t m_runtimeName{"publisher"}; - RouDiEnvironment m_roudiEnv{MinimalRouDiConfigBuilder().create()}; + RouDiEnv m_roudiEnv{MinimalRouDiConfigBuilder().create()}; PoshRuntime* m_runtime{&iox::runtime::PoshRuntime::initRuntime(m_runtimeName)}; IpcMessage m_sendBuffer; IpcMessage m_receiveBuffer; diff --git a/iceoryx_posh/test/moduletests/test_posh_runtime_node.cpp b/iceoryx_posh/test/moduletests/test_posh_runtime_node.cpp index 6d2f586763..11eb3c888b 100644 --- a/iceoryx_posh/test/moduletests/test_posh_runtime_node.cpp +++ b/iceoryx_posh/test/moduletests/test_posh_runtime_node.cpp @@ -16,9 +16,9 @@ // SPDX-License-Identifier: Apache-2.0 #include "iceoryx_posh/roudi_env/minimal_roudi_config.hpp" +#include "iceoryx_posh/roudi_env/roudi_env.hpp" #include "iceoryx_posh/runtime/node.hpp" #include "iceoryx_posh/runtime/posh_runtime.hpp" -#include "iceoryx_posh/testing/roudi_environment/roudi_environment.hpp" #include "test.hpp" @@ -48,7 +48,7 @@ class PoshRuntimeNode_test : public Test virtual void TearDown(){}; const RuntimeName_t m_runtimeName{"App"}; - RouDiEnvironment m_roudiEnv{MinimalRouDiConfigBuilder().create()}; + RouDiEnv m_roudiEnv{MinimalRouDiConfigBuilder().create()}; PoshRuntime* m_runtime{&iox::runtime::PoshRuntime::initRuntime(m_runtimeName)}; }; diff --git a/iceoryx_posh/test/moduletests/test_posh_runtime_single_process.cpp b/iceoryx_posh/test/moduletests/test_posh_runtime_single_process.cpp index 312e44efcc..c3727919a6 100644 --- a/iceoryx_posh/test/moduletests/test_posh_runtime_single_process.cpp +++ b/iceoryx_posh/test/moduletests/test_posh_runtime_single_process.cpp @@ -16,8 +16,8 @@ // SPDX-License-Identifier: Apache-2.0 #include "iceoryx_posh/roudi_env/minimal_roudi_config.hpp" +#include "iceoryx_posh/roudi_env/roudi_env.hpp" #include "iceoryx_posh/runtime/posh_runtime_single_process.hpp" -#include "iceoryx_posh/testing/roudi_environment/roudi_environment.hpp" #include "test.hpp" @@ -66,7 +66,7 @@ TEST_F(PoshRuntimeSingleProcess_test, ConstructorPoshRuntimeSingleProcessIsSucce TEST_F(PoshRuntimeSingleProcess_test, ConstructorPoshRuntimeSingleProcessMultipleProcessIsFound) { ::testing::Test::RecordProperty("TEST_ID", "1cc7ad5d-5878-454a-94ba-5cf412c22682"); - RouDiEnvironment roudiEnv{MinimalRouDiConfigBuilder().create()}; + RouDiEnv roudiEnv{MinimalRouDiConfigBuilder().create()}; const RuntimeName_t runtimeName{"App"}; From f878e07f81880bd14f9ec1bbb541b5713251430f Mon Sep 17 00:00:00 2001 From: Mathias Kraus Date: Wed, 6 Sep 2023 21:05:06 +0200 Subject: [PATCH 09/12] iox-#1533 Update release notes and docs --- .../iceoryx_components_diagram_v3_0_0.puml | 1 - .../iceoryx_components_diagram_v3_0_0.svg | 3 +- .../release-notes/iceoryx-unreleased.md | 31 +++++++++++++++++++ 3 files changed, 32 insertions(+), 3 deletions(-) diff --git a/doc/design/diagrams/iceoryx_components_diagram_v3_0_0.puml b/doc/design/diagrams/iceoryx_components_diagram_v3_0_0.puml index 8e63edf34d..71062cc8b1 100644 --- a/doc/design/diagrams/iceoryx_components_diagram_v3_0_0.puml +++ b/doc/design/diagrams/iceoryx_components_diagram_v3_0_0.puml @@ -24,7 +24,6 @@ skinparam frame { ' @todo #539 ' RouDi split, separate files and namespaces for static/dynamic discovery ' Implement exported libraries (add_library in iceoryx_posh/CMakeLists.txt) -' RouDiEnvironment shall not be in roudi namespace, but in testing header Eclipse iceoryx component overview diff --git a/doc/website/images/iceoryx_components_diagram_v3_0_0.svg b/doc/website/images/iceoryx_components_diagram_v3_0_0.svg index d6d7c10d38..d133986b01 100644 --- a/doc/website/images/iceoryx_components_diagram_v3_0_0.svg +++ b/doc/website/images/iceoryx_components_diagram_v3_0_0.svg @@ -86,7 +86,6 @@ skinparam frame { ' @todo #539 ' RouDi split, separate files and namespaces for static/dynamic discovery ' Implement exported libraries (add_library in iceoryx_posh/CMakeLists.txt) -' RouDiEnvironment shall not be in roudi namespace, but in testing header Eclipse iceoryx component overview @@ -329,4 +328,4 @@ JVM: Java HotSpot(TM) 64-Bit Server VM Default Encoding: UTF-8 Language: en Country: US ---> \ No newline at end of file +--> diff --git a/doc/website/release-notes/iceoryx-unreleased.md b/doc/website/release-notes/iceoryx-unreleased.md index c10166e02b..cfa6032ae4 100644 --- a/doc/website/release-notes/iceoryx-unreleased.md +++ b/doc/website/release-notes/iceoryx-unreleased.md @@ -160,6 +160,7 @@ - Better align `iox::expected` with `std::expected` [\#1969](https://github.com/eclipse-iceoryx/iceoryx/issues/1969) - Use logger for "RouDi is ready for clients" message [\#1994](https://github.com/eclipse-iceoryx/iceoryx/issues/1994) - Speed up posh tests [#1030](https://github.com/eclipse-iceoryx/iceoryx/issues/1030) +- Roudi Environment independent from Googletest [#1533](https://github.com/eclipse-iceoryx/iceoryx/issues/1533) **Workflow:** @@ -1181,3 +1182,33 @@ }; ``` + +53. `iox::roudi::RouDiEnvironment` is moved to `iox::roudi_env::RouDiEnv` and in a separate library + + There is still an alias on the old location with a deprecation warning. The API also changed a bit. + ```cpp + // before + #include "iceoryx_posh/testing/roudi_environment/roudi_environment.hpp" + iox::roudi::RouDiEnvironment roudiEnv{/*config*/}; + + // after + #include "iceoryx_posh/roudi_env/roudi_environment.hpp" + iox::roudi_enf::RouDiEnv roudiEnv{/*config*/}; + + + // before + roudiEnv.InterOpWait(); + + // after + roudiEnv.triggerDiscoveryLoopAndWaitToFinish(); + + + // before + SetInterOpWaitingTime(/*chrono*/); + + // after + setDiscoveryLoopWaitToFinishTimeout(/*units::Duration*/); + + ``` + + It is now also possible to directly link to `iceoryx_posh::iceoryx_posh_roudi_env` which has no dependency to gTest. From ddbabb161af15ae18070d93f802d9fa80049f512 Mon Sep 17 00:00:00 2001 From: Mathias Kraus Date: Wed, 6 Sep 2023 21:42:19 +0200 Subject: [PATCH 10/12] iox-#1533 Fix Bazel build --- iceoryx_binding_c/test/BUILD.bazel | 1 + iceoryx_posh/BUILD.bazel | 17 +++++++++++++++++ iceoryx_posh/test/BUILD.bazel | 2 ++ 3 files changed, 20 insertions(+) diff --git a/iceoryx_binding_c/test/BUILD.bazel b/iceoryx_binding_c/test/BUILD.bazel index 2ca0ca472a..30d61cb296 100644 --- a/iceoryx_binding_c/test/BUILD.bazel +++ b/iceoryx_binding_c/test/BUILD.bazel @@ -43,6 +43,7 @@ cc_test( "//iceoryx_binding_c", "//iceoryx_hoofs:iceoryx_hoofs_testing", "//iceoryx_posh", + "//iceoryx_posh:iceoryx_posh_roudi_env", "//iceoryx_posh:iceoryx_posh_testing", ], ) diff --git a/iceoryx_posh/BUILD.bazel b/iceoryx_posh/BUILD.bazel index 153a46b4ab..a131e22ba1 100644 --- a/iceoryx_posh/BUILD.bazel +++ b/iceoryx_posh/BUILD.bazel @@ -190,6 +190,22 @@ cc_binary( ], ) +# +########## build iceoryx posh roudi env lib ########## +# +cc_library( + name = "iceoryx_posh_roudi_env", + srcs = glob(["roudi_env/**/*.cpp"]), + hdrs = glob(["roudi_env/include/**"]), + strip_include_prefix = "roudi_env/include", + visibility = ["//visibility:public"], + deps = [ + ":iceoryx_posh", + ":iceoryx_posh_roudi", + "//iceoryx_hoofs", + ], +) + # ########## build iceoryx posh testing lib ########## # @@ -202,6 +218,7 @@ cc_library( deps = [ ":iceoryx_posh", ":iceoryx_posh_roudi", + ":iceoryx_posh_roudi_env", "//iceoryx_hoofs:iceoryx_hoofs_testing", "@googletest//:gtest", ], diff --git a/iceoryx_posh/test/BUILD.bazel b/iceoryx_posh/test/BUILD.bazel index d11ab33c75..1cf21cba51 100644 --- a/iceoryx_posh/test/BUILD.bazel +++ b/iceoryx_posh/test/BUILD.bazel @@ -46,6 +46,7 @@ cc_test( "//iceoryx_hoofs:iceoryx_hoofs_testing", "//iceoryx_posh", "//iceoryx_posh:iceoryx_posh_config", + "//iceoryx_posh:iceoryx_posh_roudi_env", "//iceoryx_posh:iceoryx_posh_testing", "@cpptoml", ], @@ -77,6 +78,7 @@ cc_test( "//iceoryx_hoofs:iceoryx_hoofs_testing", "//iceoryx_posh", "//iceoryx_posh:iceoryx_posh_gateway", + "//iceoryx_posh:iceoryx_posh_roudi_env", "//iceoryx_posh:iceoryx_posh_testing", ], ) From ac7eb74764c251055c6ea6a928ae139630ba5513 Mon Sep 17 00:00:00 2001 From: Mathias Kraus Date: Wed, 20 Sep 2023 15:11:30 +0200 Subject: [PATCH 11/12] iox-#2011 Update github actions --- .github/workflows/lint_pull_request.yml | 2 +- .github/workflows/release_build_publish.yml | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/lint_pull_request.yml b/.github/workflows/lint_pull_request.yml index 5b00140ea9..15b92f8926 100644 --- a/.github/workflows/lint_pull_request.yml +++ b/.github/workflows/lint_pull_request.yml @@ -53,7 +53,7 @@ jobs: retention-days: 7 - name: Link Checker - uses: lycheeverse/lychee-action@v1.5.4 + uses: lycheeverse/lychee-action@v1.8.0 with: fail: true args: --cache --insecure --max-cache-age 7d --verbose --no-progress './**/*.md' --github-token ${{secrets.GITHUB_TOKEN}} --max-concurrency 1 diff --git a/.github/workflows/release_build_publish.yml b/.github/workflows/release_build_publish.yml index b641cd682e..4510206812 100644 --- a/.github/workflows/release_build_publish.yml +++ b/.github/workflows/release_build_publish.yml @@ -47,7 +47,7 @@ jobs: $GITHUB_WORKSPACE/tools/iceoryx_build_test.sh clean package - name: Upload release artifacts - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v3 with: name: release_artifacts path: ./build_package/iceoryx*.deb @@ -59,7 +59,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Download release artifacts - uses: actions/download-artifact@v2 + uses: actions/download-artifact@v3 with: name: release_artifacts From dd72966c3e05634449e108fd8a73b5bfd9463bd0 Mon Sep 17 00:00:00 2001 From: Mathias Kraus Date: Thu, 21 Sep 2023 13:17:47 +0200 Subject: [PATCH 12/12] iox-#1533 Fix typos and clarify documentation --- doc/website/release-notes/iceoryx-unreleased.md | 6 +++--- .../internal/popo/building_blocks/unique_port_id.hpp | 2 +- iceoryx_posh/roudi_env/source/roudi_env.cpp | 4 ++-- iceoryx_posh/source/popo/building_blocks/unique_port_id.cpp | 2 +- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/doc/website/release-notes/iceoryx-unreleased.md b/doc/website/release-notes/iceoryx-unreleased.md index cfa6032ae4..24e225637e 100644 --- a/doc/website/release-notes/iceoryx-unreleased.md +++ b/doc/website/release-notes/iceoryx-unreleased.md @@ -1193,7 +1193,7 @@ // after #include "iceoryx_posh/roudi_env/roudi_environment.hpp" - iox::roudi_enf::RouDiEnv roudiEnv{/*config*/}; + iox::roudi_env::RouDiEnv roudiEnv{/*config*/}; // before @@ -1204,10 +1204,10 @@ // before - SetInterOpWaitingTime(/*chrono*/); + roudiEnv.SetInterOpWaitingTime(/*chrono*/); // after - setDiscoveryLoopWaitToFinishTimeout(/*units::Duration*/); + roudiEnv.setDiscoveryLoopWaitToFinishTimeout(/*units::Duration*/); ``` diff --git a/iceoryx_posh/include/iceoryx_posh/internal/popo/building_blocks/unique_port_id.hpp b/iceoryx_posh/include/iceoryx_posh/internal/popo/building_blocks/unique_port_id.hpp index ab65593a05..a6d038aa08 100644 --- a/iceoryx_posh/include/iceoryx_posh/internal/popo/building_blocks/unique_port_id.hpp +++ b/iceoryx_posh/include/iceoryx_posh/internal/popo/building_blocks/unique_port_id.hpp @@ -82,7 +82,7 @@ class UniquePortId : public NewType