#ifdef UNSAFE_BUFFERS_BUILD
#pragma allow_unsafe_buffers
#endif
#include "base/debug/elf_reader.h"
#include <dlfcn.h>
#include <cstdint>
#include <optional>
#include <string_view>
#include "base/debug/test_elf_image_builder.h"
#include "base/files/memory_mapped_file.h"
#include "base/native_library.h"
#include "base/strings/string_util.h"
#include "build/build_config.h"
#include "testing/gtest/include/gtest/gtest.h"
extern char __executable_start;
namespace base {
namespace debug {
namespace {
constexpr uint8_t kBuildIdBytes[] = …;
constexpr const char kBuildIdHexString[] = …;
constexpr const char kBuildIdHexStringLower[] = …;
std::string ParamInfoToString(
const ::testing::TestParamInfo<base::TestElfImageBuilder::MappingType>&
param_info) { … }
}
ElfReaderTest;
TEST_P(ElfReaderTest, ReadElfBuildIdUppercase) { … }
TEST_P(ElfReaderTest, ReadElfBuildIdLowercase) { … }
TEST_P(ElfReaderTest, ReadElfBuildIdMultipleNotes) { … }
TEST_P(ElfReaderTest, ReadElfBuildIdWrongName) { … }
TEST_P(ElfReaderTest, ReadElfBuildIdWrongType) { … }
TEST_P(ElfReaderTest, ReadElfBuildIdNoBuildId) { … }
TEST_P(ElfReaderTest, ReadElfLibraryName) { … }
TEST_P(ElfReaderTest, ReadElfLibraryNameNoSoName) { … }
TEST_P(ElfReaderTest, GetRelocationOffset) { … }
INSTANTIATE_TEST_SUITE_P(…);
TEST(ElfReaderTestWithCurrentElfImage, ReadElfBuildId) { … }
TEST(ElfReaderTestWithCurrentImage, ReadElfBuildId) { … }
}
}