-
Notifications
You must be signed in to change notification settings - Fork 96
Add integration test for mw::com add-on configurations #1030
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
SebSparrowHawk
wants to merge
1
commit into
eclipse-score:main
Choose a base branch
from
SebSparrowHawk:ssp_add_on_configs_int_test
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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", | ||
| "//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", | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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__", | ||
| ], | ||
| ) | ||
39 changes: 39 additions & 0 deletions
39
score/mw/com/test/loading_add_on_configuration/common_resources.cpp
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 |
35 changes: 35 additions & 0 deletions
35
score/mw/com/test/loading_add_on_configuration/common_resources.h
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 |
8 changes: 8 additions & 0 deletions
8
score/mw/com/test/loading_add_on_configuration/config/logging.json
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 | ||
| } |
59 changes: 59 additions & 0 deletions
59
score/mw/com/test/loading_add_on_configuration/config/mw_com_add_on_config.json
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 | ||
| } | ||
| ] | ||
| } | ||
| ] | ||
| } | ||
| ] | ||
| } |
59 changes: 59 additions & 0 deletions
59
score/mw/com/test/loading_add_on_configuration/config/mw_com_config.json
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 | ||
| } | ||
| ] | ||
| } | ||
| ] | ||
| } | ||
| ] | ||
| } |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
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.