OSDN Git Service

Fix pagemap_test#maps.
authorElliott Hughes <enh@google.com>
Tue, 1 Mar 2016 16:02:37 +0000 (08:02 -0800)
committerElliott Hughes <enh@google.com>
Tue, 1 Mar 2016 20:11:10 +0000 (12:11 -0800)
We don't necessarily have a brk-based heap.

Bug: http://b/27425642

(cherry picked from commit b2084a55a9e499b8c26b751956078282e12b0609)

Change-Id: Ia5c96fb26a8011c62037f3a3c4cbf44e3b936507

libpagemap/pagemap_test.cpp

index ccbc211..592072c 100644 (file)
  * limitations under the License.
  */
 
-#include <gtest/gtest.h>
-
 #include <pagemap/pagemap.h>
 
+#include <string>
+
+#include <gtest/gtest.h>
+
 TEST(pagemap, maps) {
   pm_kernel_t* kernel;
   ASSERT_EQ(0, pm_kernel_create(&kernel));
@@ -32,8 +34,9 @@ TEST(pagemap, maps) {
   bool found_heap = false;
   bool found_stack = false;
   for (size_t i = 0; i < num_maps; i++) {
-    if (strcmp(maps[i]->name, "[heap]") == 0) found_heap = true;
-    if (strcmp(maps[i]->name, "[stack]") == 0) found_stack = true;
+    std::string name(maps[i]->name);
+    if (name == "[heap]" || name == "[anon:libc_malloc]") found_heap = true;
+    if (name == "[stack]") found_stack = true;
   }
 
   ASSERT_TRUE(found_heap);