Chromium Code Reviews| Index: base/debug/proc_maps_linux_unittest.cc |
| diff --git a/base/debug/proc_maps_linux_unittest.cc b/base/debug/proc_maps_linux_unittest.cc |
| index c9f2267e166e15cdcf8241cee9f8b20d51f3ca86..5ac75569aa6e9c17782457fe044fa2818bbc9701 100644 |
| --- a/base/debug/proc_maps_linux_unittest.cc |
| +++ b/base/debug/proc_maps_linux_unittest.cc |
| @@ -181,20 +181,19 @@ TEST(ProcMapsTest, Permissions) { |
| } |
| } |
| -TEST(ProcMapsTest, ReadProcMaps) { |
| - std::string proc_maps; |
| - ASSERT_TRUE(ReadProcMaps(&proc_maps)); |
| - |
| - std::vector<MappedMemoryRegion> regions; |
| - ASSERT_TRUE(ParseProcMaps(proc_maps, ®ions)); |
| - ASSERT_FALSE(regions.empty()); |
| - |
| +#if defined(ADDRESS_SANITIZER) |
| +// AddressSanitizer may move local variables to a dedicated "fake stack" which |
| +// is outside the stack region listed in /proc/self/maps. We disable ASan |
| +// instrumentation for this function to force the variable to be local. |
| +__attribute__((no_sanitize_address)) |
| +#endif |
| +void CheckProcMapsRegions(const std::vector<MappedMemoryRegion> ®ions) { |
| // We should be able to find both the current executable as well as the stack |
| // mapped into memory. Use the address of |proc_maps| as a way of finding the |
|
earthdok
2014/12/02 17:45:26
s/proc_maps/exe_path/
Alexander Potapenko
2014/12/02 17:52:05
Good catch!
Fixed.
|
| // stack. |
| FilePath exe_path; |
| EXPECT_TRUE(PathService::Get(FILE_EXE, &exe_path)); |
| - uintptr_t address = reinterpret_cast<uintptr_t>(&proc_maps); |
| + uintptr_t address = reinterpret_cast<uintptr_t>(&exe_path); |
| bool found_exe = false; |
| bool found_stack = false; |
| bool found_address = false; |
| @@ -246,6 +245,17 @@ TEST(ProcMapsTest, ReadProcMaps) { |
| } |
| } |
| +TEST(ProcMapsTest, ReadProcMaps) { |
| + std::string proc_maps; |
| + ASSERT_TRUE(ReadProcMaps(&proc_maps)); |
| + |
| + std::vector<MappedMemoryRegion> regions; |
| + ASSERT_TRUE(ParseProcMaps(proc_maps, ®ions)); |
| + ASSERT_FALSE(regions.empty()); |
| + |
| + CheckProcMapsRegions(regions); |
| +} |
| + |
| TEST(ProcMapsTest, ReadProcMapsNonEmptyString) { |
| std::string old_string("I forgot to clear the string"); |
| std::string proc_maps(old_string); |