Skip to content

Commit

Permalink
Merge pull request #2021 from elBoberido/iox-1533-standalone-roudi-en…
Browse files Browse the repository at this point in the history
…vironment

iox-#1533 Standalone roudi environment
  • Loading branch information
elBoberido authored Sep 22, 2023
2 parents b1f39df + dd72966 commit 4fb0b5f
Show file tree
Hide file tree
Showing 50 changed files with 528 additions and 273 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/lint_pull_request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
4 changes: 2 additions & 2 deletions .github/workflows/release_build_publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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

Expand Down
1 change: 0 additions & 1 deletion doc/design/diagrams/iceoryx_components_diagram_v3_0_0.puml
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
3 changes: 1 addition & 2 deletions doc/website/images/iceoryx_components_diagram_v3_0_0.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
31 changes: 31 additions & 0 deletions doc/website/release-notes/iceoryx-unreleased.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:**

Expand Down Expand Up @@ -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_env::RouDiEnv roudiEnv{/*config*/};


// before
roudiEnv.InterOpWait();

// after
roudiEnv.triggerDiscoveryLoopAndWaitToFinish();


// before
roudiEnv.SetInterOpWaitingTime(/*chrono*/);

// after
roudiEnv.setDiscoveryLoopWaitToFinishTimeout(/*units::Duration*/);

```

It is now also possible to directly link to `iceoryx_posh::iceoryx_posh_roudi_env` which has no dependency to gTest.
1 change: 1 addition & 0 deletions iceoryx_binding_c/test/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -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",
],
)
4 changes: 3 additions & 1 deletion iceoryx_binding_c/test/moduletests/test_chunk.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,15 @@ 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
{
using namespace ::testing;
using namespace iox;
using namespace iox::mepoo;
using namespace iox::roudi_env;
using namespace iox::testing;

class Chunk_test : public RouDi_GTest
Expand Down
4 changes: 3 additions & 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 All @@ -29,8 +29,10 @@ extern "C" {

namespace
{
using namespace ::testing;
using namespace iox;
using namespace iox::runtime;
using namespace iox::roudi_env;
using namespace iox::testing;

class iox_node_test : public RouDi_GTest
Expand Down
7 changes: 4 additions & 3 deletions iceoryx_binding_c/test/moduletests/test_publisher.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@
#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/testing/roudi_environment/roudi_environment.hpp"
#include "iceoryx_posh/roudi_env/minimal_roudi_config.hpp"
#include "iceoryx_posh/roudi_env/roudi_env.hpp"

using namespace iox;
using namespace iox::popo;
Expand All @@ -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;
Expand Down Expand Up @@ -143,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");

Expand Down
4 changes: 3 additions & 1 deletion iceoryx_binding_c/test/moduletests/test_runtime.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,15 @@ 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
{
using namespace ::testing;
using namespace iox;
using namespace iox::runtime;
using namespace iox::roudi_env;
using namespace iox::testing;

class BindingC_Runtime_test : public RouDi_GTest
Expand Down
17 changes: 9 additions & 8 deletions iceoryx_binding_c/test/moduletests/test_service_discovery.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,13 @@

#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;
using namespace iox::runtime;
using namespace iox::roudi_env;
using namespace iox::testing;

extern "C" {
Expand Down Expand Up @@ -83,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);
Expand All @@ -103,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,
Expand All @@ -124,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(
Expand All @@ -140,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"));
Expand All @@ -157,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];
Expand Down Expand Up @@ -189,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];
Expand All @@ -216,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];
Expand Down
9 changes: 5 additions & 4 deletions iceoryx_binding_c/test/moduletests/test_subscriber.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,13 @@
#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/testing/roudi_environment/roudi_environment.hpp"
#include "iceoryx_posh/roudi_env/minimal_roudi_config.hpp"
#include "iceoryx_posh/roudi_env/roudi_env.hpp"
#include "mocks/wait_set_mock.hpp"

using namespace iox;
using namespace iox::popo;
using namespace iox::roudi_env;
using namespace iox::testing;

extern "C" {
Expand Down Expand Up @@ -148,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");

Expand Down Expand Up @@ -405,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;
Expand Down
4 changes: 2 additions & 2 deletions iceoryx_hoofs/test/moduletests/test_unix_domain_sockets.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
17 changes: 17 additions & 0 deletions iceoryx_posh/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -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 ##########
#
Expand All @@ -202,6 +218,7 @@ cc_library(
deps = [
":iceoryx_posh",
":iceoryx_posh_roudi",
":iceoryx_posh_roudi_env",
"//iceoryx_hoofs:iceoryx_hoofs_testing",
"@googletest//:gtest",
],
Expand Down
6 changes: 5 additions & 1 deletion iceoryx_posh/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -299,8 +299,12 @@ setup_install_directories_and_export_package(
INCLUDE_DIRECTORIES include/
)

add_subdirectory(testing)

if(ROUDI_ENVIRONMENT OR BUILD_TEST)
add_subdirectory(roudi_env)
endif()

if(BUILD_TEST)
add_subdirectory(testing)
add_subdirectory(test)
endif()
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})

Loading

0 comments on commit 4fb0b5f

Please sign in to comment.