#ifdef UNSAFE_BUFFERS_BUILD
#pragma allow_unsafe_buffers
#endif
#include "base/debug/proc_maps_linux.h"
#include <stddef.h>
#include <stdint.h>
#include "base/files/file_path.h"
#include "base/path_service.h"
#include "base/strings/stringprintf.h"
#include "base/threading/platform_thread.h"
#include "build/build_config.h"
#include "testing/gtest/include/gtest/gtest.h"
namespace base {
namespace debug {
TEST(ProcMapsTest, Empty) { … }
TEST(ProcMapsTest, NoSpaces) { … }
TEST(ProcMapsTest, Spaces) { … }
TEST(ProcMapsTest, NoNewline) { … }
TEST(ProcMapsTest, NoPath) { … }
TEST(ProcMapsTest, Heap) { … }
#if defined(ARCH_CPU_32_BITS)
TEST(ProcMapsTest, Stack32) {
static const char kStack[] =
"beb04000-beb25000 rw-p 00000000 00:00 0 [stack]\n";
std::vector<MappedMemoryRegion> regions;
ASSERT_TRUE(ParseProcMaps(kStack, ®ions));
ASSERT_EQ(1u, regions.size());
EXPECT_EQ(0xbeb04000u, regions[0].start);
EXPECT_EQ(0xbeb25000u, regions[0].end);
EXPECT_EQ(0x00000000u, regions[0].offset);
EXPECT_EQ("[stack]", regions[0].path);
}
#elif defined(ARCH_CPU_64_BITS)
TEST(ProcMapsTest, Stack64) { … }
#endif
TEST(ProcMapsTest, Multiple) { … }
TEST(ProcMapsTest, Permissions) { … }
__attribute__((no_sanitize("address", "hwaddress"))) void CheckProcMapsRegions(
const std::vector<MappedMemoryRegion>& regions) { … }
TEST(ProcMapsTest, ReadProcMaps) { … }
TEST(ProcMapsTest, ReadProcMapsNonEmptyString) { … }
TEST(ProcMapsTest, MissingFields) { … }
TEST(ProcMapsTest, InvalidInput) { … }
TEST(ProcMapsTest, ParseProcMapsEmptyString) { … }
TEST(ProcMapsTest, ParseProcMapsWeirdCorrectInput) { … }
}
}