diff options
Diffstat (limited to 'unittests/MachOTests/MachONormalizedFileBinaryReaderTests.cpp')
-rw-r--r-- | unittests/MachOTests/MachONormalizedFileBinaryReaderTests.cpp | 25 |
1 files changed, 13 insertions, 12 deletions
diff --git a/unittests/MachOTests/MachONormalizedFileBinaryReaderTests.cpp b/unittests/MachOTests/MachONormalizedFileBinaryReaderTests.cpp index 6827a732fbd8..a3c445a93619 100644 --- a/unittests/MachOTests/MachONormalizedFileBinaryReaderTests.cpp +++ b/unittests/MachOTests/MachONormalizedFileBinaryReaderTests.cpp @@ -9,13 +9,17 @@ #include "gtest/gtest.h" #include "../../lib/ReaderWriter/MachO/MachONormalizedFile.h" +#include "lld/ReaderWriter/MachOLinkingContext.h" +#include "llvm/ADT/StringRef.h" +#include "llvm/Support/Error.h" #include "llvm/Support/MachO.h" -#include <assert.h> -#include <vector> +#include "llvm/Support/MemoryBuffer.h" +#include "llvm/Support/YAMLTraits.h" +#include <cstdint> +#include <memory> using llvm::StringRef; using llvm::MemoryBuffer; -using llvm::ErrorOr; using namespace lld::mach_o::normalized; using namespace llvm::MachO; @@ -24,7 +28,7 @@ static std::unique_ptr<NormalizedFile> fromBinary(const uint8_t bytes[], unsigned length, StringRef archStr) { StringRef sr((const char*)bytes, length); std::unique_ptr<MemoryBuffer> mb(MemoryBuffer::getMemBuffer(sr, "", false)); - ErrorOr<std::unique_ptr<NormalizedFile>> r = + llvm::Expected<std::unique_ptr<NormalizedFile>> r = lld::mach_o::normalized::readBinary( mb, lld::MachOLinkingContext::archFromName(archStr)); EXPECT_FALSE(!r); @@ -75,7 +79,6 @@ TEST(BinaryReaderTest, empty_obj_x86_64) { EXPECT_TRUE(f->undefinedSymbols.empty()); } - TEST(BinaryReaderTest, empty_obj_x86) { FILEBYTES = { 0xce, 0xfa, 0xed, 0xfe, 0x07, 0x00, 0x00, 0x00, @@ -107,7 +110,6 @@ TEST(BinaryReaderTest, empty_obj_x86) { EXPECT_TRUE(f->undefinedSymbols.empty()); } - TEST(BinaryReaderTest, empty_obj_ppc) { FILEBYTES = { 0xfe, 0xed, 0xfa, 0xce, 0x00, 0x00, 0x00, 0x12, @@ -139,7 +141,6 @@ TEST(BinaryReaderTest, empty_obj_ppc) { EXPECT_TRUE(f->undefinedSymbols.empty()); } - TEST(BinaryReaderTest, empty_obj_armv7) { FILEBYTES = { 0xce, 0xfa, 0xed, 0xfe, 0x0c, 0x00, 0x00, 0x00, @@ -326,7 +327,6 @@ TEST(BinaryReaderTest, hello_obj_x86_64) { EXPECT_EQ(printfLabel.scope, SymbolScope(N_EXT)); } - TEST(BinaryReaderTest, hello_obj_x86) { FILEBYTES = { 0xCE, 0xFA, 0xED, 0xFE, 0x07, 0x00, 0x00, 0x00, @@ -458,7 +458,6 @@ TEST(BinaryReaderTest, hello_obj_x86) { EXPECT_EQ(printfLabel.scope, SymbolScope(N_EXT)); } - TEST(BinaryReaderTest, hello_obj_armv7) { FILEBYTES = { 0xCE, 0xFA, 0xED, 0xFE, 0x0C, 0x00, 0x00, 0x00, @@ -600,7 +599,6 @@ TEST(BinaryReaderTest, hello_obj_armv7) { EXPECT_EQ(printfLabel.scope, SymbolScope(N_EXT)); } - TEST(BinaryReaderTest, hello_obj_ppc) { FILEBYTES = { 0xFE, 0xED, 0xFA, 0xCE, 0x00, 0x00, 0x00, 0x12, @@ -743,6 +741,9 @@ TEST(BinaryReaderTest, hello_obj_ppc) { EXPECT_EQ(printfLabel.type, N_UNDF); EXPECT_EQ(printfLabel.scope, SymbolScope(N_EXT)); - writeBinary(*f, "/tmp/foo.o"); - + auto ec = writeBinary(*f, "/tmp/foo.o"); + // FIXME: We want to do EXPECT_FALSE(ec) but that fails on some Windows bots, + // probably due to /tmp not being available. + // For now just consume the error without checking it. + consumeError(std::move(ec)); } |