Reintroduce WritingToInactiveFileForbidden and DisallowUnreasonableFileSizeLimits
Both tests failed the linux_memchecks trybot, and so were removed. This attempts to reintroduce them. Bug: webrtc:8111 Change-Id: I32c49cb1b2af16d80e6f32258501ab79535700c0 Reviewed-on: https://webrtc-review.googlesource.com/6285 Commit-Queue: Elad Alon <eladalon@webrtc.org> Reviewed-by: Björn Terelius <terelius@webrtc.org> Cr-Commit-Position: refs/heads/master@{#20169}
This commit is contained in:
parent
dbb15a7ce2
commit
8233bfea27
@ -164,6 +164,9 @@ if (rtc_enable_protobuf) {
|
||||
testonly = true
|
||||
assert(rtc_enable_protobuf)
|
||||
defines = [ "ENABLE_RTC_EVENT_LOG" ]
|
||||
if (rtc_use_memcheck) {
|
||||
defines += [ "WEBRTC_USE_MEMCHECK" ]
|
||||
}
|
||||
sources = [
|
||||
"rtc_event_log/encoder/rtc_event_log_encoder_unittest.cc",
|
||||
"rtc_event_log/output/rtc_event_log_output_file_unittest.cc",
|
||||
|
||||
@ -138,4 +138,28 @@ TEST_F(RtcEventLogOutputFileTest, AllowReasonableFileSizeLimits) {
|
||||
EXPECT_TRUE(output_file->IsActive());
|
||||
}
|
||||
|
||||
#if RTC_DCHECK_IS_ON && GTEST_HAS_DEATH_TEST && !defined(WEBRTC_ANDROID)
|
||||
#if !defined(WEBRTC_USE_MEMCHECK) // Crashing expected to leak memory.
|
||||
TEST_F(RtcEventLogOutputFileTest, WritingToInactiveFileForbidden) {
|
||||
RtcEventLogOutputFile output_file(output_file_name_, 2);
|
||||
ASSERT_FALSE(output_file.Write("abc"));
|
||||
ASSERT_FALSE(output_file.IsActive());
|
||||
EXPECT_DEATH(output_file.Write("abc"), "");
|
||||
}
|
||||
|
||||
TEST_F(RtcEventLogOutputFileTest, DisallowUnreasonableFileSizeLimits) {
|
||||
// Keeping in a temporary unique_ptr to make it clearer that the death is
|
||||
// triggered by construction, not destruction.
|
||||
std::unique_ptr<RtcEventLogOutputFile> output_file;
|
||||
auto create_output_file = [&] {
|
||||
const size_t unreasonable_size =
|
||||
RtcEventLogOutputFile::kMaxReasonableFileSize + 1;
|
||||
output_file = rtc::MakeUnique<RtcEventLogOutputFile>(output_file_name_,
|
||||
unreasonable_size);
|
||||
};
|
||||
EXPECT_DEATH(create_output_file(), "");
|
||||
}
|
||||
#endif // !WEBRTC_USE_MEMCHECK
|
||||
#endif
|
||||
|
||||
} // namespace webrtc
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user