Skip to content

Commit

Permalink
iox-eclipse-iceoryx#1533 Move 'RouDiEnvironment' to new location
Browse files Browse the repository at this point in the history
  • Loading branch information
elBoberido committed Sep 6, 2023
1 parent e5ee364 commit fdb9430
Show file tree
Hide file tree
Showing 31 changed files with 210 additions and 95 deletions.
2 changes: 1 addition & 1 deletion iceoryx_binding_c/test/moduletests/test_chunk.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion iceoryx_binding_c/test/moduletests/test_node.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 <gtest/gtest.h>

Expand Down
2 changes: 1 addition & 1 deletion iceoryx_binding_c/test/moduletests/test_publisher.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion iceoryx_binding_c/test/moduletests/test_runtime.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion iceoryx_binding_c/test/moduletests/test_subscriber.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down
1 change: 1 addition & 0 deletions iceoryx_posh/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -299,6 +299,7 @@ setup_install_directories_and_export_package(
INCLUDE_DIRECTORIES include/
)

add_subdirectory(roudi_env)
add_subdirectory(testing)

if(BUILD_TEST)
Expand Down
27 changes: 27 additions & 0 deletions iceoryx_posh/cmake/iceoryx_posh_roudi_env.cmake
Original file line number Diff line number Diff line change
@@ -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})

45 changes: 45 additions & 0 deletions iceoryx_posh/roudi_env/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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()

Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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
Original file line number Diff line number Diff line change
@@ -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 <atomic>
#include <map>
#include <mutex>

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<IceOryxRouDiComponents> m_roudiComponents;
std::unique_ptr<RouDi> m_roudiApp;
};

} // namespace roudi
} // namespace iox

#endif // IOX_POSH_ROUDI_ENV_ROUDI_ENVIRONMENT_HPP
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion iceoryx_posh/test/integrationtests/test_client_server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down
2 changes: 1 addition & 1 deletion iceoryx_posh/test/moduletests/test_posh_runtime.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down
2 changes: 1 addition & 1 deletion iceoryx_posh/test/moduletests/test_posh_runtime_node.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
Loading

0 comments on commit fdb9430

Please sign in to comment.