-
Notifications
You must be signed in to change notification settings - Fork 32
Initial mw::com-based implementation of ilmcontrol interface #478
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
NicolasFussberger
wants to merge
38
commits into
eclipse-score:main
Choose a base branch
from
etas-contrib:feature/new_mw_com_based_api
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
Show all changes
38 commits
Select commit
Hold shift + click to select a range
611a4c3
Saving current status
SimonKozik 22d6798
Removing unneeded call to GetNewSamples
SimonKozik 964357b
Saving fixed versions for polling and SetReceiveHandler
SimonKozik bfe62c7
Fix MODULE.bazel dependency
NicolasFussberger 5a94417
Fix test case
NicolasFussberger 6ba5340
Refactor control client test
NicolasFussberger 842e16a
Use StartFindService API
NicolasFussberger 4a8decb
Use mw::log macros
NicolasFussberger 59c9f3e
Extend integration test
NicolasFussberger 9868b59
LmControlImpl rework and UT
NicolasFussberger ded0df1
Drop component tests
NicolasFussberger 636ba66
Drop integration tests
NicolasFussberger 4cb0906
Remove connected flag
NicolasFussberger 9cdc689
Service discovery
NicolasFussberger 7414686
Do not stop service discovery
NicolasFussberger d5c0e35
init refactoring
NicolasFussberger 55d6cec
event read refactoring
NicolasFussberger 0539aa1
Refactor callback invocation
NicolasFussberger 52ce0ba
Remove LmControlServer
NicolasFussberger faa5d86
Cleanup
NicolasFussberger 45bfd31
Fix compiler warning and tsan failure
NicolasFussberger 6a83681
Format fix
NicolasFussberger fa8d9e9
Fix compiler error
NicolasFussberger c812173
Fix bazel dependencies
NicolasFussberger adfbdfd
Fix qnx tests
NicolasFussberger f335a05
Cleanup
NicolasFussberger 98e9a28
Fix test description
NicolasFussberger 2db5298
Merge remote-tracking branch 'upstream/main' into feature/new_mw_com_…
NicolasFussberger 78352dc
Downgrade to baselibs 0.2.10
NicolasFussberger 630a977
drop workaroud, use latest score_qnx_unit_tests
NicolasFussberger f1c668f
Extend documentation
NicolasFussberger 8f27602
introduce stream operator
NicolasFussberger 1c5ea94
Change namespace to internal
NicolasFussberger d0dd184
Remove auto usage
NicolasFussberger fb998f3
Fixup interface comments
NicolasFussberger 67dce36
Handle callback exceptions
NicolasFussberger 8084005
Fix StartFindService race condition
NicolasFussberger c54ebd2
Drop force detault param
NicolasFussberger 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
Some comments aren't visible on the classic Files Changed page.
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
Large diffs are not rendered by default.
Oops, something went wrong.
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
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,70 @@ | ||
| # ******************************************************************************* | ||
| # 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_library") | ||
| load("//tests/utils/bazel:unit_test.bzl", "lm_cc_test") | ||
|
|
||
| cc_library( | ||
| name = "lm_control", | ||
| srcs = [ | ||
| "src/details/ilm_control.cpp", | ||
| ], | ||
| hdrs = [ | ||
| "src/details/lm_control_impl.hpp", | ||
| "src/details/lm_control_service.h", | ||
| "src/fixed_string.hpp", | ||
| "src/ilm_control.hpp", | ||
| "src/run_target_activation_source.hpp", | ||
| ], | ||
| include_prefix = "score/mw/lifecycle", | ||
| strip_include_prefix = "/score/launch_manager/src/lm_control/src", | ||
| visibility = [ | ||
| "//score:__subpackages__", | ||
| "//tests:__subpackages__", | ||
| ], | ||
| deps = [ | ||
| "//score/launch_manager:error", | ||
| "//score/launch_manager/src/daemon/src/common:log", | ||
| "@score_baselibs//score/language/futurecpp", | ||
| "@score_baselibs//score/language/safecpp/scoped_function:copyable_scoped_function", | ||
| "@score_baselibs//score/language/safecpp/scoped_function:scope", | ||
| "@score_baselibs//score/result", | ||
| "@score_communication//score/mw/com", | ||
| ], | ||
| ) | ||
|
|
||
| lm_cc_test( | ||
| name = "lm_control_impl_UT", | ||
| srcs = ["src/details/lm_control_impl_UT.cpp"], | ||
| deps = [ | ||
| ":lm_control", | ||
| "//score/launch_manager:error", | ||
| "@googletest//:gtest_main", | ||
| "@score_baselibs//score/result", | ||
| "@score_communication//score/mw/com", | ||
| ], | ||
| ) | ||
|
|
||
| lm_cc_test( | ||
| name = "ilm_control_UT", | ||
| srcs = ["src/details/ilm_control_UT.cpp"], | ||
| args = [ | ||
| "--service_instance_manifest", | ||
| "$(rootpath src/details/test_lm_mw_com_config.json)", | ||
| ], | ||
| data = ["src/details/test_lm_mw_com_config.json"], | ||
| deps = [ | ||
| ":lm_control", | ||
| "@googletest//:gtest", | ||
| "@score_communication//score/mw/com", | ||
| ], | ||
| ) |
31 changes: 31 additions & 0 deletions
31
score/launch_manager/src/lm_control/src/details/ilm_control.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,31 @@ | ||
| /******************************************************************************** | ||
| * 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/lifecycle/ilm_control.hpp" | ||
| #include "score/mw/lifecycle/details/lm_control_impl.hpp" | ||
|
|
||
| namespace score::mw::lifecycle | ||
| { | ||
|
|
||
| score::Result<std::unique_ptr<ILmControl>> ILmControl::Create(std::string_view instance_specifier) | ||
| { | ||
| auto instance = std::make_unique<internal::LmControlImpl>(); | ||
| const auto init_result = instance->init(instance_specifier); | ||
| if (!init_result.has_value()) | ||
| { | ||
| return score::MakeUnexpected<std::unique_ptr<ILmControl>>(init_result.error()); | ||
| } | ||
| return instance; | ||
| } | ||
|
|
||
| } // namespace score::mw::lifecycle |
73 changes: 73 additions & 0 deletions
73
score/launch_manager/src/lm_control/src/details/ilm_control_UT.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,73 @@ | ||
| /******************************************************************************** | ||
| * 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 <gtest/gtest.h> | ||
|
|
||
| #include <string> | ||
| #include <string_view> | ||
|
|
||
| #include "score/mw/com/runtime.h" | ||
|
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. Unused include
Contributor
Author
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. is removed |
||
| #include "score/mw/lifecycle/ilm_control.hpp" | ||
|
|
||
| namespace score::mw::lifecycle | ||
| { | ||
| namespace | ||
| { | ||
|
|
||
| constexpr std::string_view kValidSpecifier = "StateManager/LaunchManager/Instance"; | ||
|
|
||
| class ILmControlUT : public ::testing::Test | ||
| { | ||
| protected: | ||
| void SetUp() override | ||
| { | ||
| RecordProperty("TestType", "interface-test"); | ||
| RecordProperty("DerivationTechnique", "equivalence-classes"); | ||
|
|
||
| // The following two equivalence classes are tested here: | ||
| // * Return a valid instance | ||
| // * Return an error | ||
| // The different error cases are tested in the underlying impl class LmControlImpl unit tests | ||
| } | ||
| }; | ||
|
|
||
| TEST_F(ILmControlUT, ReturnsValidInstance) | ||
| { | ||
| RecordProperty("Description", "ILmControl::Create returns a valid instance for a valid instance specifier."); | ||
|
|
||
| auto result = ILmControl::Create(std::string{kValidSpecifier}); | ||
|
|
||
| ASSERT_TRUE(result.has_value()); | ||
| EXPECT_NE(result.value(), nullptr); | ||
| } | ||
|
|
||
| TEST_F(ILmControlUT, ReturnsInitErrorForInvalidSpecifier) | ||
| { | ||
| RecordProperty( | ||
| "Description", "ILmControl::Create returns kInvalidArguments error for an invalid instance specifier."); | ||
|
|
||
| auto result = ILmControl::Create(""); | ||
|
|
||
| ASSERT_FALSE(result.has_value()); | ||
| EXPECT_EQ(result.error(), ExecErrc::kInvalidArguments); | ||
| } | ||
|
|
||
| } // namespace | ||
| } // namespace score::mw::lifecycle | ||
|
|
||
| int main(int argc, char** argv) | ||
| { | ||
| ::testing::InitGoogleTest(&argc, argv); | ||
| score::mw::com::runtime::InitializeRuntime(argc, const_cast<const char**>(argv)); | ||
| return RUN_ALL_TESTS(); | ||
| } | ||
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.
Do you think it would be good to make some sort of component test that includes actual com implementation? I think this could be good when trying to debug interactions between us and COM.
Uh oh!
There was an error while loading. Please reload this page.
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.
Yes I agree, I started something here ded0df1
but then reverted because I thought the PR scope was getting too big when introducing this at the same time.
I would propose to introduce this in a separate PR