Skip to content
Open
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
152 changes: 152 additions & 0 deletions score/mw/com/test/loading_add_on_configuration/BUILD
Original file line number Diff line number Diff line change
@@ -0,0 +1,152 @@
# *******************************************************************************
# 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("@rules_cc//cc:defs.bzl", "cc_binary")
load("@score_baselibs//score/language/safecpp:toolchain_features.bzl", "COMPILER_WARNING_FEATURES")
load("//score/mw/com/test:pkg_application.bzl", "pkg_application")

exports_files(
["config/logging.json"],
visibility = ["//score/mw/com/test:__subpackages__"],
)

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

cc_library(
name = "test_constants",
srcs = ["test_constants.cpp"],
hdrs = ["test_constants.h"],
features = COMPILER_WARNING_FEATURES,
deps = [
"//score/mw/com",
],
)

cc_library(
name = "consumer_impl",
srcs = ["consumer.cpp"],
hdrs = ["consumer.h"],
features = COMPILER_WARNING_FEATURES,
deps = [
":common_resources",
":test_constants",
"//score/mw/com",
"//score/mw/com/impl:instance_specifier",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please don't depend on impl in integration tests. This adds technical debt.

"//score/mw/com/test/common_test_resources:fail_test",
"//score/mw/com/test/common_test_resources:process_synchronizer",
"//score/mw/com/test/common_test_resources:proxy_container",
"//score/mw/com/test/common_test_resources:proxy_event_receiver",
"//score/mw/com/test/common_test_resources:proxy_event_state_change_notifier",
"//score/mw/com/test/loading_add_on_configuration/types:example_interface",
],
)

cc_library(
name = "provider_impl",
srcs = ["provider.cpp"],
hdrs = ["provider.h"],
features = COMPILER_WARNING_FEATURES,
deps = [
":common_resources",
":test_constants",
"//score/mw/com",
"//score/mw/com/impl:instance_specifier",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same

"//score/mw/com/test/common_test_resources:fail_test",
"//score/mw/com/test/common_test_resources:process_synchronizer",
"//score/mw/com/test/common_test_resources:skeleton_container",
"//score/mw/com/test/loading_add_on_configuration/types:example_interface",
],
)

cc_binary(
name = "consumer",
srcs = ["main_consumer.cpp"],
data = [
"config/mw_com_add_on_config.json",
"config/mw_com_config.json",
],
features = COMPILER_WARNING_FEATURES + [
"aborts_upon_exception",
],
visibility = ["//score/mw/com/test/loading_add_on_configuration:__pkg__"],
deps = [
":common_resources",
":consumer_impl",
"//score/mw/com",
"//score/mw/com/test/common_test_resources:fail_test",
"//score/mw/com/test/common_test_resources:process_synchronizer",
"//score/mw/com/test/common_test_resources:stop_token_sig_term_handler",
"@score_baselibs//score/mw/log",
],
)

cc_binary(
name = "provider",
srcs = ["main_provider.cpp"],
data = [
"config/mw_com_add_on_config.json",
"config/mw_com_config.json",
],
features = COMPILER_WARNING_FEATURES + [
"aborts_upon_exception",
],
visibility = ["//score/mw/com/test/loading_add_on_configuration:__pkg__"],
deps = [
":common_resources",
":provider_impl",
"//score/mw/com",
"//score/mw/com/test/common_test_resources:fail_test",
"//score/mw/com/test/common_test_resources:process_synchronizer",
"//score/mw/com/test/common_test_resources:stop_token_sig_term_handler",
"@score_baselibs//score/mw/log",
],
)

pkg_application(
name = "consumer-pkg",
app_name = "consumer",
bin = [":consumer"],
etc = [
"config/logging.json",
"config/mw_com_config.json",
"config/mw_com_add_on_config.json",
],
visibility = [
"//platform/aas/test/mw/com:__pkg__",
"//score/mw/com/test/loading_add_on_configuration:__subpackages__",
],
)

pkg_application(
name = "provider-pkg",
app_name = "provider",
bin = [":provider"],
etc = [
"config/logging.json",
"config/mw_com_config.json",
"config/mw_com_add_on_config.json",
],
visibility = [
"//platform/aas/test/mw/com:__pkg__",
"//score/mw/com/test/loading_add_on_configuration:__subpackages__",
],
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
/********************************************************************************
* 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/loading_add_on_configuration/common_resources.h"

#include "score/mw/com/test/common_test_resources/command_line_parser.h"

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

TestConfig ParseConfig(int argc, const char** argv)
{
constexpr auto kServiceInstanceManifestArg = "service-instance-manifest";

const std::vector<std::pair<std::string, std::string>> parameter_description_pairs{
{kServiceInstanceManifestArg, "Path to the service instance manifest"},
};

const auto args = ParseCommandLineArguments(argc, argv, parameter_description_pairs);

const auto manifest_result = GetValueIfProvided<std::string>(args, kServiceInstanceManifestArg);
if (!manifest_result.has_value())
{
FailTest("Missing or invalid --", kServiceInstanceManifestArg, " argument");
}

return TestConfig{manifest_result.value()};
}

} // namespace score::mw::com::test
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
/********************************************************************************
* 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_LOADING_ADD_ON_CONFIGURATION_COMMON_RESOURCES_H
#define SCORE_MW_COM_TEST_LOADING_ADD_ON_CONFIGURATION_COMMON_RESOURCES_H

#include <string>

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

struct TestConfig
{
std::string config_file_path;
};

/// \brief Parses the command line arguments for the test and returns a TestConfig object.
///
/// Terminates if the argument is not provided. We use this function instead of providing argc / argv directly to
/// InitializeRuntime so that we detect if the config file was not provided instead of silently falling back to the
/// default config. It also makes it easier to extend the command line arguments in the future if needed.
TestConfig ParseConfig(int argc, const char** argv);

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

#endif // SCORE_MW_COM_TEST_LOADING_ADD_ON_CONFIGURATION_COMMON_RESOURCES_H
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"appId": "ADDONL",
"appDesc": "addonloader",
"logLevel": "kDebug",
"logLevelThresholdConsole": "kDebug",
"logMode": "kRemote|kConsole",
"dynamicDatarouterIdentifiers" : true
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
{
"serviceTypes": [
{
"serviceTypeName": "/score/example/SimpleDataService",
"version": {
"major": 1,
"minor": 0
},
"bindings": [
{
"binding": "SHM",
"serviceId": 6432,
"events": [
{
"eventName": "example_event",
"eventId": 1
}
]
}
]
}
],
"serviceInstances": [
{
"instanceSpecifier": "score/data/SimpleDataService",
"serviceTypeName": "/score/example/SimpleDataService",
"version": {
"major": 1,
"minor": 0
},
"instances": [
{
"instanceId": 1,
"allowedConsumer": {
"QM": [
4002,
0
]
},
"allowedProvider": {
"QM": [
4001,
0
]
},
"asil-level": "QM",
"binding": "SHM",
"events": [
{
"eventName": "example_event",
"numberOfSampleSlots": 10,
"maxSubscribers": 3
}
]
}
]
}
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
{
"serviceTypes": [
{
"serviceTypeName": "/score/example/DataService",
"version": {
"major": 1,
"minor": 0
},
"bindings": [
{
"binding": "SHM",
"serviceId": 6432,
"events": [
{
"eventName": "example_event",
"eventId": 1
}
]
}
]
}
],
"serviceInstances": [
{
"instanceSpecifier": "score/data/DataService",
"serviceTypeName": "/score/example/DataService",
"version": {
"major": 1,
"minor": 0
},
"instances": [
{
"instanceId": 1,
"allowedConsumer": {
"QM": [
4002,
0
]
},
"allowedProvider": {
"QM": [
4001,
0
]
},
"asil-level": "QM",
"binding": "SHM",
"events": [
{
"eventName": "example_event",
"numberOfSampleSlots": 10,
"maxSubscribers": 3
}
]
}
]
}
]
}
Loading
Loading