Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
159 changes: 159 additions & 0 deletions score/mw/com/test/methods/multiple_proxies/BUILD
Original file line number Diff line number Diff line change
@@ -0,0 +1,159 @@
# *******************************************************************************
# Copyright (c) 2026 Contributors to the Eclipse Foundation
#
# See the NOTICE file(s) distributed with this work for additional
# information regarding copyright ownership.
#
# This program and the accompanying materials are made available under the
# terms of the Apache License Version 2.0 which is available at
# https://www.apache.org/licenses/LICENSE-2.0
#
# SPDX-License-Identifier: Apache-2.0
# *******************************************************************************

load("@score_baselibs//score/language/safecpp:toolchain_features.bzl", "COMPILER_WARNING_FEATURES")
load("//score/mw/com/test:pkg_application.bzl", "pkg_application")

cc_library(
name = "common_resources",
srcs = ["common_resources.cpp"],
hdrs = ["common_resources.h"],
features = COMPILER_WARNING_FEATURES,
visibility = ["//score/mw/com/test/methods:__subpackages__"],
deps = [
"//score/mw/com",
"//score/mw/com/test/common_test_resources:fail_test",
],
)

# gtodo: fix deps
cc_library(
name = "consumer",
srcs = ["consumer.cpp"],
hdrs = ["consumer.h"],
features = COMPILER_WARNING_FEATURES,
implementation_deps = [
":common_resources",
":duplicate_signatures_datatype",
"//score/mw/com",
"//score/mw/com/test/common_test_resources:fail_test",
"//score/mw/com/test/common_test_resources:proxy_container",
"//score/mw/com/test/methods/methods_test_resources:process_synchronizer",
],
)

cc_library(
name = "provider",
srcs = ["provider.cpp"],
hdrs = ["provider.h"],
features = COMPILER_WARNING_FEATURES,
deps = [
":common_resources",
":duplicate_signatures_datatype",
"//score/mw/com",
"//score/mw/com/test/common_test_resources:fail_test",
"//score/mw/com/test/common_test_resources:skeleton_container",
"//score/mw/com/test/methods/methods_test_resources:process_synchronizer",
],
)

cc_binary(
name = "main_provider",
srcs = ["main_provider.cpp"],
features = COMPILER_WARNING_FEATURES + [
"aborts_upon_exception",
],
deps = [
":common_resources",
":provider",
"//score/mw/com",
"//score/mw/com/test/common_test_resources:command_line_parser",
"//score/mw/com/test/common_test_resources:fail_test",
"//score/mw/com/test/common_test_resources:stop_token_sig_term_handler",
],
)

cc_binary(
name = "main_consumer",
srcs = ["main_consumer.cpp"],
features = COMPILER_WARNING_FEATURES + [
"aborts_upon_exception",
],
deps = [
":common_resources",
":consumer",
"//score/mw/com",
"//score/mw/com/test/common_test_resources:command_line_parser",
"//score/mw/com/test/common_test_resources:fail_test",
],
)

cc_binary(
name = "main_combined_consumer_provider",
srcs = ["main_combined_consumer_provider.cpp"],
features = COMPILER_WARNING_FEATURES + [
"aborts_upon_exception",
],
deps = [
":common_resources",
":consumer",
":provider",
"//score/mw/com",
"//score/mw/com/test/common_test_resources:command_line_parser",
"//score/mw/com/test/common_test_resources:fail_test",
"//score/mw/com/test/common_test_resources:stop_token_sig_term_handler",
],
)

cc_library(
name = "duplicate_signatures_datatype",
srcs = ["duplicate_signatures_datatype.cpp"],
hdrs = ["duplicate_signatures_datatype.h"],
features = COMPILER_WARNING_FEATURES,
visibility = ["//score/mw/com/test/methods:__subpackages__"],
deps = [
"//score/mw/com",
],
)

pkg_application(
name = "provider-pkg",
app_name = "MainProviderApp",
bin = [":main_provider"],
etc = [
"config/provider_mw_com_config.json",
"config/logging.json",
],
visibility = [
"//score/mw/com/test/methods/multiple_proxies/integration_test:__pkg__",
],
)

pkg_application(
name = "consumer-pkg",
app_name = "MainConsumerApp",
bin = [":main_consumer"],
etc = [
"config/consumer0_mw_com_config.json",
"config/consumer1_mw_com_config.json",
"config/consumer2_mw_com_config.json",
"config/consumer3_mw_com_config.json",
"config/logging.json",
],
visibility = [
"//score/mw/com/test/methods/multiple_proxies/integration_test:__pkg__",
],
)

pkg_application(
name = "combined-provider-consumer-pkg",
app_name = "MainCombinedConsumerProviderApp",
bin = [":main_combined_consumer_provider"],
etc = [
"config/combined_mw_com_config.json",
"config/logging.json",
],
visibility = [
"//score/mw/com/test/methods/multiple_proxies/integration_test:__pkg__",
],
)
28 changes: 28 additions & 0 deletions score/mw/com/test/methods/multiple_proxies/common_resources.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
/********************************************************************************
* Copyright (c) 2026 Contributors to the Eclipse Foundation
*
* See the NOTICE file(s) distributed with this work for additional
* information regarding copyright ownership.
*
* This program and the accompanying materials are made available under the
* terms of the Apache License Version 2.0 which is available at
* https://www.apache.org/licenses/LICENSE-2.0
*
* SPDX-License-Identifier: Apache-2.0
********************************************************************************/
#include "score/mw/com/test/methods/multiple_proxies/common_resources.h"

#include <string>

namespace score::mw::com::test
{

std::string CreateInterprocessNotificationShmPath(size_t path_id)
{
std::string path{"test_methods_interprocess_shm_notification_path"};
path.append(std::to_string(path_id));
path.append("_notification");
return path;
}

} // namespace score::mw::com::test
53 changes: 53 additions & 0 deletions score/mw/com/test/methods/multiple_proxies/common_resources.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
/********************************************************************************
* Copyright (c) 2026 Contributors to the Eclipse Foundation
*
* See the NOTICE file(s) distributed with this work for additional
* information regarding copyright ownership.
*
* This program and the accompanying materials are made available under the
* terms of the Apache License Version 2.0 which is available at
* https://www.apache.org/licenses/LICENSE-2.0
*
* SPDX-License-Identifier: Apache-2.0
********************************************************************************/
#ifndef SCORE_MW_COM_TEST_METHODS_MULTIPLE_PROXIES_COMMON_RESOURCES_H
#define SCORE_MW_COM_TEST_METHODS_MULTIPLE_PROXIES_COMMON_RESOURCES_H

#include <array>
#include <cstdint>
#include <iostream>
#include <sstream>
#include <string>
#include <vector>

namespace score::mw::com::test
{

// Number of methods which exist within DuplicateSignatureInterface.
inline constexpr std::size_t kNumRegisteredMethods{5U};

inline constexpr std::int32_t kMethodResultMultiplierBase{13};

// The method index for each consumer which is enabled. E.g. the first vector contains the method indices enabled for
// consumer 0 etc. The size of this array must match num_consumers defined in the python test runner.
using EnabledMethodIdsPerConsumer = std::array<std::vector<std::size_t>, 4U>;
const EnabledMethodIdsPerConsumer kEnabledMethodsPerProxy{std::vector<std::size_t>{0U, 1U},
std::vector<std::size_t>{1U, 2U},
std::vector<std::size_t>{3U, 4U},
std::vector<std::size_t>{0U, 2U, 3U}};

std::string CreateInterprocessNotificationShmPath(size_t path_id);

/// \brief Utility function to print a line to the console in a thread safe manner (i.e. the entire string is printed at
/// once, without interleaving with other print statements from other threads).
template <typename... Args>
void PrintLine(Args&&... args)
{
std::ostringstream oss;
(oss << ... << std::forward<Args>(args));
std::cout << oss.str();
}

} // namespace score::mw::com::test

#endif // SCORE_MW_COM_TEST_METHODS_MULTIPLE_PROXIES_COMMON_RESOURCES_H
Loading
Loading