-
Notifications
You must be signed in to change notification settings - Fork 0
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
Improved {EXPECT,ASSERT}_KASSERT_FAILS #344
Comments
I think an issue with that would be that if one rank throws, and the others don't, they will be stuck in their collective MPI operation and the test would never finish. |
I was thinking about something along those lines: #define EXPECT_KASSERT_FAILS_MPI(code, failure_message) \
bool kassert_failed = false;
bool exception_message_matched = true;
try {
code;
} except (::kamping::testing::KassertTestingException& e) {
kassert_failes = true;
if (e.msg != failure_message) {
exception_message_matched = false;
}
}
// Allreduce over kassert_failed with operation OR and exception_message_matched with operation AND
// Output error messages and fail test if !kassert_failed
// else if !exception_message_matched output error message and fail |
I'm assuming here that we turn all failed assertions into exceptions and can thus catch them. |
Maybe I'm missing something. But try {
code;
} Will never finish on the ranks that don't throw so this will deadlock. |
Oh ... right, there might be an additional communication inside We're already overwriting KASSERT during tests, we could add code like above directly to KASSERT? We would then need to replace if (comm.is_root()) {
KASSERT(...)
} with KASSERT((!comm.is_root() || ...)); |
I propose to introduce a {EXPECT,ASSERT}_KASSERT_FAILS which does not relegate the check to {EXPECT,ASSERT}_THROWS() but rather uses it's own
try
/catch
block to check if the KASSERT exception is thrown. We can then check the error message of this exception and allreduce the information if the local KASSERT fired or not over all ranks.The text was updated successfully, but these errors were encountered: