Repository navigation
Make tests from the 2.0.1 review more robust, and fix error code trimming and supervision docs #8219
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
Merged
Merged
Make tests from the 2.0.1 review more robust, and fix error code trimming and supervision docs #8219
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
d22223c
Require a second suspension in the stale-wakeup tests of wait_for_7915
hkaiser 61f80b9
Test the blocked predicate of a condition variable wait for #7915
hkaiser 73a5314
Build single-worker masks from the bound PUs in scheduler_mode_7811
hkaiser d03501c
Read a handler's error in put_parcels only after the handler completed
hkaiser 6d9da87
Wait for the timed suspension in condition_variable_late_wakeup
hkaiser 7b8a352
Add a regression test for output through hpx::cout after shutdown
hkaiser 0324e09
Remove the error code text from an exception message only at its end
hkaiser a96da3b
Qualify that eviction keeps a peer fenced in the supervision docs
hkaiser 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
56 changes: 56 additions & 0 deletions
56
components/iostreams/tests/regressions/output_after_shutdown_8068.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,56 @@ | ||
| // Copyright (c) 2026 Hartmut Kaiser | ||
| // | ||
| // SPDX-License-Identifier: BSL-1.0 | ||
| // Distributed under the Boost Software License, Version 1.0. (See accompanying | ||
| // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) | ||
|
|
||
| // Output through hpx::cout after the runtime has stopped goes to the local | ||
| // stream (std::cout) instead of the console, which needs the runtime (#8068). | ||
|
|
||
| #include <hpx/config.hpp> | ||
| #if !defined(HPX_COMPUTE_DEVICE_CODE) | ||
| #include <hpx/hpx_init.hpp> | ||
| #include <hpx/iostream.hpp> | ||
| #include <hpx/modules/testing.hpp> | ||
|
|
||
| #include <iostream> | ||
| #include <sstream> | ||
| #include <streambuf> | ||
| #include <string> | ||
|
|
||
| int hpx_main() | ||
| { | ||
| hpx::cout << "while running" << hpx::endl; | ||
| return hpx::finalize(); | ||
| } | ||
|
|
||
| int main(int argc, char* argv[]) | ||
| { | ||
| HPX_TEST_EQ_MSG( | ||
| hpx::init(argc, argv), 0, "HPX main exited with non-zero status"); | ||
|
|
||
| // the runtime is stopped: what hpx::cout writes from now on goes to | ||
| // std::cout, captured here (std::flush flushes through the stream's sink, | ||
| // flush_type and endl_type through the synchronous operator) | ||
| std::stringstream captured; | ||
| std::streambuf* const original = std::cout.rdbuf(captured.rdbuf()); | ||
|
|
||
| hpx::cout << "flushed by std::flush;" << std::flush; | ||
| hpx::cout << "flushed by flush_type;" << hpx::iostreams::flush_type(); | ||
| hpx::cout << "flushed repeatedly;" << std::flush | ||
| << hpx::iostreams::flush_type() << std::flush; | ||
| hpx::cout << "ended by endl_type" << hpx::iostreams::endl_type(); | ||
|
|
||
| std::cout.rdbuf(original); | ||
|
|
||
| HPX_TEST_EQ(captured.str(), | ||
| std::string("flushed by std::flush;flushed by flush_type;" | ||
| "flushed repeatedly;ended by endl_type\n")); | ||
|
|
||
| // left in the buffer: written to std::cout when the global streams are | ||
| // destroyed, which must not touch the stopped runtime either | ||
| hpx::cout << "buffered at exit\n"; | ||
|
|
||
| return hpx::util::report_errors(); | ||
| } | ||
| #endif |
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
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.
Record the baseline before the waiter can attempt to lock
m.observing_agent::sleep_forreports the wait throughnotify_waiting()before it enters the delegate sleep. The predicate's lock attempt runs during that wait. Nothing orders main's load ofattemptsat line 449 before that attempt. If the attempt happens first, the baseline already includes it. While main holdsm, the waiter cannot make another attempt. The polling loop then reaches its limit, andHPX_TEST_NEQat line 454 fails even though the runtime is correct. The notification also arrives only after the polling limit, so the timed wait or the five-second check at line 437 can fail too.Hold the waiter after
notify_waiting()until main ownsmand has stored the baseline. Release the waiter before the delegate sleep. The notifier'snotify_one()under the lock still exercises the blocked predicate, so the regression scenario remains intact. Limit the gate to this test block.