-
Notifications
You must be signed in to change notification settings - Fork 32
Add tests which are verifying comp_req__launch_man__launcher_exit_shutdown #450
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
TimoSteuerwaldETAS
wants to merge
3
commits into
eclipse-score:main
Choose a base branch
from
etas-contrib:feature/shutdown_tests
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
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
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
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
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,56 @@ | ||
| # ******************************************************************************* | ||
| # 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:cc_binary.bzl", "cc_binary") | ||
| load("@rules_cc//cc:cc_library.bzl", "cc_library") | ||
| load("//tests/utils/bazel:integration.bzl", "integration_test") | ||
|
|
||
| cc_library( | ||
| name = "lm_shutdown_common", | ||
| hdrs = ["common.hpp"], | ||
| ) | ||
|
|
||
| cc_binary( | ||
| name = "control_client_test_driver", | ||
| srcs = ["control_client_test_driver.cpp"], | ||
| deps = [ | ||
| ":lm_shutdown_common", | ||
| "//score/launch_manager:control_cc", | ||
| "//score/launch_manager:lifecycle_cc", | ||
| "//tests/utils/test_helper", | ||
| "@googletest//:gtest_main", | ||
| ], | ||
| ) | ||
|
|
||
| cc_binary( | ||
| name = "component_c", | ||
| srcs = ["component_c.cpp"], | ||
| deps = [ | ||
| ":lm_shutdown_common", | ||
| "//score/launch_manager:lifecycle_cc", | ||
| "//tests/utils/test_helper", | ||
| "@googletest//:gtest_main", | ||
| ], | ||
| ) | ||
|
|
||
| integration_test( | ||
| name = "lm_shutdown_during_rt_switch", | ||
| timeout = "short", | ||
| srcs = ["lm_shutdown_during_rt_switch.py"], | ||
| binaries = [ | ||
| "//tests/utils/test_helper:process_hanging_on_sigterm", | ||
| ":component_c", | ||
| ":control_client_test_driver", | ||
| "//score/launch_manager", | ||
| ], | ||
| config = ":lm_shutdown_during_rt_switch.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,34 @@ | ||
| /******************************************************************************** | ||
| * 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_TESTS_INTEGRATION_LM_SHUTDOWN_COMMON_HPP | ||
| #define SCORE_TESTS_INTEGRATION_LM_SHUTDOWN_COMMON_HPP | ||
|
|
||
| #include <string_view> | ||
|
|
||
| /// @brief Written by component_a when it has reported running (run_target_a is | ||
| /// active). | ||
| constexpr std::string_view a_started = "component_a_started"; | ||
|
|
||
| /// @brief Written by component_a when it starts being terminated (i.e. the | ||
| /// switch away from run_target_a has begun). component_a then stalls, which | ||
| /// keeps the run-target switch in progress and gives the test a deterministic | ||
| /// window in which to send SIGTERM to the launch manager. | ||
| constexpr std::string_view a_terminating = "component_a_terminating"; | ||
|
|
||
| /// @brief Written by component_c when it starts. component_c belongs only to | ||
| /// run_target_c, so this file must NEVER appear: a SIGTERM to the launch manager | ||
| /// during the switch must cancel the pending activation of run_target_c. | ||
| constexpr std::string_view c_started = "component_c_started"; | ||
|
|
||
| #endif // SCORE_TESTS_INTEGRATION_LM_SHUTDOWN_COMMON_HPP |
46 changes: 46 additions & 0 deletions
46
tests/integration/lm_shutdown_during_rt_switch/component_c.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,46 @@ | ||
| /******************************************************************************** | ||
| * 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 <unistd.h> | ||
|
|
||
| #include "common.hpp" | ||
| #include "tests/utils/test_helper/test_helper.hpp" | ||
| #include <score/mw/lifecycle/report_running.h> | ||
|
|
||
| // component_c belongs only to run_target_c. Because the switch to run_target_c | ||
| // must be cancelled by the SIGTERM sent to the launch manager, this process must | ||
| // never be launched. Should it ever start, it records `c_started`, which makes | ||
| // both the control client and the Python-side assertions fail. | ||
| TEST(LmShutdownDuringRtSwitch, ComponentC) | ||
| { | ||
| TEST_STEP("Report running") | ||
| { | ||
| // This code should be never executed. In Python code there is also an assertion | ||
| // that component_c must not be started (i.e. c_started should not exist). | ||
| // This is a second line of defense in case the Python code is not executed or fails to detect the problem. | ||
| ADD_FAILURE() << "component_c must never be started"; | ||
|
|
||
| EXPECT_TRUE(touch_file(c_started)); | ||
| score::mw::lifecycle::report_running(); | ||
| } | ||
|
|
||
| while (!TestRunner::exitRequested) | ||
| { | ||
| pause(); | ||
| } | ||
| } | ||
|
|
||
| int main() | ||
| { | ||
| return TestRunner(__FILE__).RunTests(); | ||
| } |
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.
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.
I'm not sure if it shows up my suggested change but I think the @details section should be removed
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.
Fixed.