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
Break the debugger when a test failed #2830
Conversation
573c8e7
to
ddb53b0
Compare
I like this idea. However, I'd suggest to use the already existing facilities in HPX. See here for an example usage. This code looks up whether there was a command line option
So your code would look like:
That would however require to extract the corresponding declaration into a separate header file: https://github.com/STEllAR-GROUP/hpx/blob/master/hpx/util/command_line_handling.hpp#L93. |
@hkaiser This sounds great. I thought it would be comfortable if this would work automaitically without requiring any argument, since many unit tests don't even parse their arguments. Do you think that there is a solution which solves both ideas? |
@Naios Hmmm, I'd prefer if this was not Internally HPX relies on extracting the information about any possible
here: https://github.com/STEllAR-GROUP/hpx/blob/master/src/util/runtime_configuration.cpp#L197. Now setting Similarly we could add a compile-time configuration option enabling this by default:
|
@hkaiser Perfect, thanks for your quick reply. That was the implementation I thought about 👍 |
29dee3f
to
980b405
Compare
@hkaiser I applied the requested changes:
|
{ HPX_ASSERT(false); return; } | ||
} | ||
} | ||
void increment(counter_type c); |
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.
Shouldn't this be HPX_EXPORT
ed?
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 thought that too, however lightweight_test.cpp
is built into the hpx_init
static library and thus we don't need to export the symbol.
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.
Right, thanks!
{ HPX_ASSERT(false); return 0; } | ||
} | ||
} | ||
std::size_t get(counter_type c) const; |
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.
Same here: HPX_EXPORT
?
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.
Same as above
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.
LGTM, thanks a lot!
30652a9
to
d861187
Compare
@Naios: one more thing - may I ask you to add support for |
@hkaiser Yes, good idea. I'll add it. |
* Set the cmake variable -DHPX_WITH_ATTACH_DEBUGGER_ON_TEST_FAILURE to enable this without to set it inside the config. * Move some methods from the test fixture to its compilation unit.
@hkaiser I applied the requested change |
src/util/command_line_handling.cpp
Outdated
std::cerr << | ||
"hpx::init: command line warning: --hpx:attach-debugger: " | ||
"invalid option: " << option << ". Allowed values are " | ||
"'startup' or 'exception'" << std::endl; | ||
"'off, startup', 'exception' or 'test-failure'" << std::endl; |
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.
Nitpick: this misses apostrophes
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
* Useful when HPX_WITH_ATTACH_DEBUGGER_ON_TEST_FAILURE is set in CMake, and we want to disable this option at runtime.
The main idea is that we instantly see which test failed if we execute a test inside a debugger.
I would like to hear your opinion about this: