Move RTC_CHECK_OP error message construction out of header file.

This simplifies the logic, prevents emitting code for every pair of
argument types to RTC_CHECK_OP and partially unblocks removing streams from
the check code altogether.

Bug: webrtc:8982
Change-Id: Ib6652ac9a342e4471c12574a79872833cc943407
Reviewed-on: https://webrtc-review.googlesource.com/86544
Commit-Queue: Jonas Olsson <jonasolsson@webrtc.org>
Reviewed-by: Karl Wiberg <kwiberg@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#23821}
This commit is contained in:
Jonas Olsson
2018-07-03 12:07:53 +02:00
committed by Commit Bot
parent 588527b295
commit d000b0a32e
3 changed files with 122 additions and 149 deletions

View File

@ -194,38 +194,34 @@ TEST(LogTest, SingleStream) {
EXPECT_EQ(sev, LogMessage::GetLogToStream(nullptr));
}
/*
#if GTEST_HAS_DEATH_TEST && !defined(WEBRTC_ANDROID)
TEST(LogTest, Checks) {
EXPECT_DEATH(FATAL() << "message",
"\n\n#\n"
"# Fatal error in: \\S+, line \\d+\n"
"# last system error: \\d+\n"
"# Fatal error in: \\S+, line \\w+\n"
"# last system error: \\w+\n"
"# Check failed: FATAL\\(\\)\n"
"# message"
);
"# message");
int a = 1, b = 2;
EXPECT_DEATH(RTC_CHECK_EQ(a, b) << 1 << 2u,
"\n\n#\n"
"# Fatal error in: \\S+, line \\d+\n"
"# last system error: \\d+\n"
"# Fatal error in: \\S+, line \\w+\n"
"# last system error: \\w+\n"
"# Check failed: a == b \\(1 vs. 2\\)\n"
"# 12"
);
"# 12");
RTC_CHECK_EQ(5, 5);
RTC_CHECK(true) << "Shouldn't crash" << 1;
EXPECT_DEATH(RTC_CHECK(false) << "Hi there!",
"\n\n#\n"
"# Fatal error in: \\S+, line \\d+\n"
"# last system error: \\d+\n"
"# Fatal error in: \\S+, line \\w+\n"
"# last system error: \\w+\n"
"# Check failed: false\n"
"# Hi there!"
);
"# Hi there!");
}
#endif
*/
// Test using multiple log streams. The INFO stream should get the INFO message,
// the VERBOSE stream should get the INFO and the VERBOSE.
// We should restore the correct global state at the end.