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 3b7351abed81095b966ecb43c453a4d38f7391b2..3cd8fcec86efd8fa5933fc767523766e9262ac5a 100644 |
--- a/base/debug/proc_maps_linux_unittest.cc |
+++ b/base/debug/proc_maps_linux_unittest.cc |
@@ -6,6 +6,7 @@ |
#include "base/files/file_path.h" |
#include "base/path_service.h" |
#include "base/strings/stringprintf.h" |
+#include "base/third_party/dynamic_annotations/dynamic_annotations.h" |
#include "testing/gtest/include/gtest/gtest.h" |
namespace base { |
@@ -197,11 +198,19 @@ TEST(ProcMapsTest, ReadProcMaps) { |
bool found_stack = false; |
for (size_t i = 0; i < regions.size(); ++i) { |
if (regions[i].path == exe_path.value()) { |
+ // It's OK to find the executable mapped multiple times as there'll be |
+ // multiple sections (e.g., text, data). |
found_exe = true; |
} |
- if (address >= regions[i].start && address < regions[i].end) { |
- EXPECT_EQ("[stack]", regions[i].path); |
+ if (regions[i].path == "[stack]") { |
Mark Mentovai
2013/07/04 01:28:13
So now you’re looking for duplicate stacks based o
scherkus (not reviewing)
2013/07/04 01:44:39
Ooooo I like both. Done.
|
+ // Only check if |address| lies within the real stack when not running |
+ // Valgrind, otherwise |address| will be on a stack that Valgrind creates. |
+ if (!RunningOnValgrind()) { |
+ EXPECT_GE(address, regions[i].start); |
+ EXPECT_LT(address, regions[i].end); |
+ } |
+ |
EXPECT_TRUE(regions[i].permissions & MappedMemoryRegion::READ); |
EXPECT_TRUE(regions[i].permissions & MappedMemoryRegion::WRITE); |
EXPECT_FALSE(regions[i].permissions & MappedMemoryRegion::EXECUTE); |