-
Notifications
You must be signed in to change notification settings - Fork 33
Add rt_running_when_process_exits integration test #466
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
16
commits into
eclipse-score:main
Choose a base branch
from
etas-contrib:feature/rt_running_when_process_exits
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
16 commits
Select commit
Hold shift + click to select a range
ecb6491
Add test rt_running_when_process_exits
TimoSteuerwaldETAS c4ba5d6
Extended test which fails without previous commit
TimoSteuerwaldETAS 467726d
Skip test with old config
TimoSteuerwaldETAS 8fdc5d5
Format fix and reverted outdated workaround
TimoSteuerwaldETAS 7ddfc72
Align to naming schema on main branch
TimoSteuerwaldETAS 9fd7110
Strip down config
TimoSteuerwaldETAS c1b58df
Define timeout setting to avoid warning
TimoSteuerwaldETAS 684391c
Introduce ready_on_termination_ flag into PgManagerConfig
TimoSteuerwaldETAS 94a7f92
Get rid of nodeHasTerminatedDeps(..)
TimoSteuerwaldETAS c64d6cc
Tiny adaption to ProcessInfoNode & UT
TimoSteuerwaldETAS 8ac6809
Get rid of outdated USE_NEW_CONFIGURATION define
TimoSteuerwaldETAS e940906
Fix build
TimoSteuerwaldETAS 2da224e
Fix format
TimoSteuerwaldETAS ba34160
Rename control client mock to test driver
TimoSteuerwaldETAS 9f9f6c6
Update references to control_client_test_driver
TimoSteuerwaldETAS 7270c79
Fix requirement reference
TimoSteuerwaldETAS 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,49 @@ | ||
| # ******************************************************************************* | ||
| # 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("//tests/utils/bazel:integration.bzl", "integration_test") | ||
|
|
||
| cc_binary( | ||
| name = "filesystem_reader", | ||
| srcs = ["filesystem_reader.cpp"], | ||
| deps = [ | ||
| "//score/launch_manager:lifecycle_cc", | ||
| "//tests/utils/test_helper", | ||
| "@googletest//:gtest_main", | ||
| ], | ||
| ) | ||
|
|
||
| cc_binary( | ||
| name = "control_client_test_driver", | ||
| srcs = ["control_client_test_driver.cpp"], | ||
| deps = [ | ||
| "//score/launch_manager:control_cc", | ||
| "//score/launch_manager:lifecycle_cc", | ||
| "//tests/utils/test_helper", | ||
| "@googletest//:gtest_main", | ||
| ], | ||
| ) | ||
|
|
||
| integration_test( | ||
| name = "rt_running_when_process_exits", | ||
| timeout = "short", | ||
| srcs = ["rt_running_when_process_exits.py"], | ||
| binaries = [ | ||
| ":control_client_test_driver", | ||
| ":filesystem_reader", | ||
| ":setup_filesystem.sh", | ||
| ":slow_setup.sh", | ||
| "//score/launch_manager", | ||
| ], | ||
| config = ":rt_running_when_process_exits.json", | ||
| ) |
89 changes: 89 additions & 0 deletions
89
tests/integration/rt_running_when_process_exits/control_client_test_driver.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,89 @@ | ||
| /******************************************************************************** | ||
| * 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 <filesystem> | ||
| #include <string_view> | ||
|
|
||
| #include "tests/utils/test_helper/test_helper.hpp" | ||
| #include <score/mw/lifecycle/control_client.h> | ||
| #include <score/mw/lifecycle/report_running.h> | ||
|
|
||
| namespace | ||
| { | ||
| /// @brief Marker file written by slow_setup.sh once it has finished (and is about to exit). | ||
| constexpr std::string_view kSlowSetupOutput = "slow_setup_output.txt"; | ||
| } // namespace | ||
|
|
||
| // Given a configuration with two run targets, each pulling in a self-terminating component whose | ||
| // ready condition is "Terminated" but which differ in whether that component has a dependent: | ||
| // | ||
| // - run_target_reader: filesystem_reader (ready "Running") depends on setup_filesystem_sh | ||
| // (self-terminating, ready "Terminated"). The terminated-ready | ||
| // component HAS a dependent. | ||
| // - run_target_slow_setup: depends directly on slow_setup_sh (self-terminating, ready | ||
| // "Terminated") which has NO dependent component. | ||
| // | ||
| // In both cases the run target must only report success once the terminated-ready component's | ||
| // process has actually exited. Without the fix, graph accounting for such a node happens as soon as | ||
| // the process is *started*, so ActivateRunTarget(...).Get() returns while the script is still | ||
| // running and its marker file has not been written yet. | ||
| TEST(RtRunningWhenProcessExits, ControlClientTestDriver) | ||
| { | ||
| score::mw::lifecycle::ControlClient client; | ||
| score::cpp::stop_token stop_token; | ||
|
|
||
| ASSERT_TRUE(check_clean({test_end_location})); | ||
| // The marker file may be left over from a previous run when executing manually on the host. | ||
| // Remove it so that its presence is a reliable signal that slow_setup.sh terminated during | ||
| // *this* run. | ||
| ASSERT_TRUE(check_clean({kSlowSetupOutput}, /*strict=*/false)); | ||
|
|
||
| TEST_STEP("Report running") | ||
| { | ||
| score::mw::lifecycle::report_running(); | ||
| } | ||
|
|
||
| // The with-dependents case: filesystem_reader asserts on the prepared file and on the setup | ||
| // script process being gone, so the ordering is checked there. | ||
| TEST_STEP("Activate run target with a terminated-ready component that HAS a dependent") | ||
| { | ||
| auto result = client.ActivateRunTarget("run_target_reader").Get(stop_token); | ||
| EXPECT_TRUE(result.has_value()) << "Activating run_target_reader failed: " << result.error().Message(); | ||
| } | ||
|
|
||
| // The no-dependents case: activation must only complete once slow_setup.sh has terminated. | ||
| TEST_STEP("Activate run target with a terminated-ready component that has NO dependent") | ||
| { | ||
| auto result = client.ActivateRunTarget("run_target_slow_setup").Get(stop_token); | ||
| EXPECT_TRUE(result.has_value()) << "Activating run_target_slow_setup failed: " << result.error().Message(); | ||
| } | ||
|
|
||
| TEST_STEP("Verify slow_setup.sh had terminated before activation completed") | ||
| { | ||
| EXPECT_TRUE(std::filesystem::exists(kSlowSetupOutput)) | ||
| << "run_target_slow_setup reported success while slow_setup.sh was still running: its " | ||
| "output file has not been written yet. A run target depending on a terminated-ready " | ||
| "component must only become ready once that component's process has actually exited."; | ||
| } | ||
|
|
||
| TEST_STEP("Activate run target Off") | ||
| { | ||
| client.ActivateRunTarget("Off"); | ||
| } | ||
| } | ||
|
|
||
| int main() | ||
| { | ||
| return TestRunner(__FILE__, TerminationBehavior::kWait, TerminationNotification::kTestEnd).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.
I think for the CI
strictshould always be kept as true?