Use EXPECT_EXIT instead of EXPECT_DEATH
This commit is contained in:
parent
44d8b82ed0
commit
25db4064b7
@ -65,16 +65,16 @@ TEST_F(LoggingTest, ErrorLog) {
|
|||||||
|
|
||||||
void logAndExit(const string &message) {
|
void logAndExit(const string &message) {
|
||||||
LOG(INFO) << message;
|
LOG(INFO) << message;
|
||||||
abort();
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
// fork() only forks the main thread. This test ensures that logging doesn't depend on threads that suddenly aren't
|
// fork() only forks the main thread. This test ensures that logging doesn't depend on threads that suddenly aren't
|
||||||
// there anymore after a fork().
|
// there anymore after a fork().
|
||||||
TEST_F(LoggingTest, LoggingAlsoWorksAfterFork) {
|
TEST_F(LoggingTest, LoggingAlsoWorksAfterFork) {
|
||||||
setLogger(spdlog::stderr_logger_mt("StderrLogger"));
|
setLogger(spdlog::stderr_logger_mt("StderrLogger"));
|
||||||
//TODO Use EXPECT_EXIT instead once the gtest version is new enough to support it
|
EXPECT_EXIT(
|
||||||
EXPECT_DEATH(
|
|
||||||
logAndExit("My log message"),
|
logAndExit("My log message"),
|
||||||
|
::testing::ExitedWithCode(1),
|
||||||
"My log message"
|
"My log message"
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user