-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Try using a different death test for _WIN32
- Loading branch information
Showing
3 changed files
with
46 additions
and
7 deletions.
There are no files selected for viewing
This file contains 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 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,31 @@ | ||
// When compiled into an executable, this file causes abort() to print | ||
// a special message to stderr and exit with EXIT_FAILURE instead of | ||
// having its usual behavior, allowing our tests to detect that | ||
// abort() was called by checking for the message. | ||
#include <csignal> | ||
#include <cstdio> | ||
#include <cstdlib> | ||
|
||
// A signal handler that prints "##ABORTED##" to stderr and exits with | ||
// EXIT_FAILURE. | ||
// | ||
// The printed string is chosen to be unlikely to appear by accident | ||
// in other output. | ||
extern "C" void error_test_handle_abort(int /* unused signum */) | ||
{ | ||
// NOLINTNEXTLINE(cppcoreguidelines-pro-type-vararg,hicpp-vararg) | ||
(void)std::fprintf(stderr, "##ABORTED##"); | ||
// std::_Exit(EXIT_FAILURE); | ||
} | ||
|
||
// Abort handler installer. | ||
struct test_override_abort | ||
{ | ||
|
||
// As a side-effect, installs error_test_handle_abort as a SIGABRT | ||
// handler. | ||
test_override_abort() noexcept { (void)std::signal(SIGABRT, error_test_handle_abort); } | ||
}; | ||
|
||
// The installation of error_test_handle_abort as an abort handler. | ||
const test_override_abort handler{}; |
This file contains 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