15#if defined(DART_TARGET_OS_MACOS)
17static const unsigned char kMachO32BitLittleEndianHeader[] = {
18 0xce, 0xfa, 0xed, 0xfe, 0x07, 0x00, 0x00, 0x01, 0x03, 0x00, 0x00,
19 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
20 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
23static const unsigned char kMachO32BitBigEndianHeader[] = {
24 0xfe, 0xed, 0xfa, 0xce, 0x01, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
25 0x03, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
26 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
29static const unsigned char kMachO64BitLittleEndianHeader[] = {
30 0xcf, 0xfa, 0xed, 0xfe, 0x07, 0x00, 0x00, 0x01, 0x03, 0x00, 0x00,
31 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
32 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
35static const unsigned char kMachO64BitBigEndianHeader[] = {
36 0xfe, 0xed, 0xfa, 0xcf, 0x01, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
37 0x03, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
38 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
43 const unsigned char* contents;
46 {
"macho_32bit_little_endian", kMachO32BitLittleEndianHeader,
48 {
"macho_32bit_big_endian", kMachO32BitBigEndianHeader,
50 {
"macho_64bit_little_endian", kMachO64BitLittleEndianHeader,
52 {
"macho_64bit_big_endian", kMachO64BitBigEndianHeader,
58 const auto& testcase = kTestcases[
i];
64 EXPECT(bin::Snapshot::IsMachOFormattedBinary(testcase.filename));
69 const char* kFilename =
71 EXPECT(!bin::Snapshot::IsMachOFormattedBinary(kFilename));
static void CloseFile(void *stream)
static void * OpenFile(const char *name, bool write)
static void WriteFile(const void *buffer, intptr_t num_bytes, void *stream)
static bool Delete(Namespace *namespc, const char *path)
const char * GetFileName(const char *name)
TEST_CASE(DirectoryCurrent)
#define ARRAY_SIZE(array)