summaryrefslogtreecommitdiff
path: root/unittests
diff options
context:
space:
mode:
authorDimitry Andric <dim@FreeBSD.org>2018-07-28 11:08:33 +0000
committerDimitry Andric <dim@FreeBSD.org>2018-07-28 11:08:33 +0000
commit20d35e67e67f106f617c939725101223211659f0 (patch)
tree64eb963cbf5ba58765e0a6b64a440965d66a7a4d /unittests
parentae1a339de31cf4065777531959a11e55a2e5fa00 (diff)
Notes
Diffstat (limited to 'unittests')
-rw-r--r--unittests/DriverTests/DarwinLdDriverTest.cpp9
-rw-r--r--unittests/MachOTests/MachONormalizedFileBinaryReaderTests.cpp15
2 files changed, 13 insertions, 11 deletions
diff --git a/unittests/DriverTests/DarwinLdDriverTest.cpp b/unittests/DriverTests/DarwinLdDriverTest.cpp
index 696be69bc269..e2e634a4cb2d 100644
--- a/unittests/DriverTests/DarwinLdDriverTest.cpp
+++ b/unittests/DriverTests/DarwinLdDriverTest.cpp
@@ -8,7 +8,7 @@
//===----------------------------------------------------------------------===//
///
/// \file
-/// \brief Darwin's ld driver tests.
+/// Darwin's ld driver tests.
///
//===----------------------------------------------------------------------===//
@@ -23,8 +23,7 @@ using namespace lld;
namespace lld {
namespace mach_o {
-bool parse(llvm::ArrayRef<const char *> args, MachOLinkingContext &ctx,
- raw_ostream &diagnostics);
+bool parse(llvm::ArrayRef<const char *> args, MachOLinkingContext &ctx);
}
}
@@ -42,9 +41,7 @@ protected:
bool parse(std::vector<const char *> args) {
args.insert(args.begin(), "ld");
- std::string errorMessage;
- raw_string_ostream os(errorMessage);
- return mach_o::parse(args, _ctx, os);
+ return mach_o::parse(args, _ctx);
}
MachOLinkingContext _ctx;
diff --git a/unittests/MachOTests/MachONormalizedFileBinaryReaderTests.cpp b/unittests/MachOTests/MachONormalizedFileBinaryReaderTests.cpp
index 3e8793a0ef48..336bbdba6269 100644
--- a/unittests/MachOTests/MachONormalizedFileBinaryReaderTests.cpp
+++ b/unittests/MachOTests/MachONormalizedFileBinaryReaderTests.cpp
@@ -12,14 +12,17 @@
#include "llvm/ADT/StringRef.h"
#include "llvm/BinaryFormat/MachO.h"
#include "llvm/Support/Error.h"
+#include "llvm/Support/FileSystem.h"
#include "llvm/Support/MemoryBuffer.h"
#include "llvm/Support/YAMLTraits.h"
#include "gtest/gtest.h"
#include <cstdint>
#include <memory>
+using llvm::SmallString;
using llvm::StringRef;
using llvm::MemoryBuffer;
+using llvm::Twine;
using namespace lld::mach_o::normalized;
using namespace llvm::MachO;
@@ -741,9 +744,11 @@ TEST(BinaryReaderTest, hello_obj_ppc) {
EXPECT_EQ(printfLabel.type, N_UNDF);
EXPECT_EQ(printfLabel.scope, SymbolScope(N_EXT));
- 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));
+ SmallString<128> tmpFl;
+ std::error_code ec =
+ llvm::sys::fs::createTemporaryFile(Twine("xx"), "o", tmpFl);
+ EXPECT_FALSE(ec);
+ llvm::Error ec2 = writeBinary(*f, tmpFl);
+ EXPECT_FALSE(ec2);
+ llvm::sys::fs::remove(tmpFl);
}