linux: Fill a test file with zeroes instead of garbage in MemoryMapTest

Bug: crashapd:30
Test: MemoryMap.MapChild
Change-Id: I40cd1c3a1f37e7a9d0c344c50b79b15ae3842182
Reviewed-on: https://chromium-review.googlesource.com/486602
Reviewed-by: Joshua Peraza <jperaza@chromium.org>
This commit is contained in:
Mark Mentovai 2017-04-25 14:21:58 -04:00
parent 44e32fe123
commit ed8e637817

View File

@ -167,8 +167,8 @@ class MapChildTest : public Multiprocess {
ScopedFileHandle handle(LoggingOpenFileForReadAndWrite(
path, FileWriteMode::kReuseOrCreate, FilePermissions::kOwnerOnly));
ASSERT_TRUE(handle.is_valid());
std::unique_ptr<char[]> file_contents(new char[page_size_ * 2]);
CheckedWriteFile(handle.get(), file_contents.get(), page_size_ * 2);
std::string file_contents(page_size_ * 2, std::string::value_type());
CheckedWriteFile(handle.get(), file_contents.c_str(), file_contents.size());
ScopedMmap file_mapping;
ASSERT_TRUE(file_mapping.ResetMmap(nullptr,
@ -277,8 +277,7 @@ class MapRunningChildTest : public Multiprocess {
ASSERT_TRUE(map.Initialize(ChildPID()));
// We should at least find the original mappings. The extra mappings may
// or
// not be found depending on scheduling.
// or not be found depending on scheduling.
ExpectMappings(map, region_addr, kNumMappings, page_size_);
}
}