summaryrefslogtreecommitdiffstats
path: root/lld/unittests/DriverTests/DarwinLdDriverTest.cpp
diff options
context:
space:
mode:
authorRui Ueyama <ruiu@google.com>2013-09-24 23:26:34 +0000
committerRui Ueyama <ruiu@google.com>2013-09-24 23:26:34 +0000
commit8db1eddc072cb606f24689f8e0a438a44ee6aa4d (patch)
treea1875b513666422131a6b38ee80aab71d13bd27c /lld/unittests/DriverTests/DarwinLdDriverTest.cpp
parent3ce27103d9f95ade2a426d90d7639c4bf6fd96c3 (diff)
downloadbcm5719-llvm-8db1eddc072cb606f24689f8e0a438a44ee6aa4d.tar.gz
bcm5719-llvm-8db1eddc072cb606f24689f8e0a438a44ee6aa4d.zip
Make Driver::link and LinkingContext::validate return true on success.
This patch inverts the return value of these functions, so that they return "true" on success and "false" on failure. The meaning of boolean return value was mixed in LLD; for example, InputGraph::validate() returns true on success. With this patch they'll become consistent. CC: llvm-commits Differential Revision: http://llvm-reviews.chandlerc.com/D1748 llvm-svn: 191341
Diffstat (limited to 'lld/unittests/DriverTests/DarwinLdDriverTest.cpp')
-rw-r--r--lld/unittests/DriverTests/DarwinLdDriverTest.cpp70
1 files changed, 35 insertions, 35 deletions
diff --git a/lld/unittests/DriverTests/DarwinLdDriverTest.cpp b/lld/unittests/DriverTests/DarwinLdDriverTest.cpp
index 494c877b4a5..1af1a34fad5 100644
--- a/lld/unittests/DriverTests/DarwinLdDriverTest.cpp
+++ b/lld/unittests/DriverTests/DarwinLdDriverTest.cpp
@@ -29,7 +29,7 @@ protected:
};
TEST_F(DarwinLdParserTest, Basic) {
- EXPECT_FALSE(parse("ld", "foo.o", "bar.o", nullptr));
+ EXPECT_TRUE(parse("ld", "foo.o", "bar.o", nullptr));
EXPECT_FALSE(_context.allowRemainingUndefines());
EXPECT_FALSE(_context.deadStrip());
EXPECT_EQ(2, inputFileCount());
@@ -38,187 +38,187 @@ TEST_F(DarwinLdParserTest, Basic) {
}
TEST_F(DarwinLdParserTest, Output) {
- EXPECT_FALSE(parse("ld", "-o", "my.out", "foo.o", nullptr));
+ EXPECT_TRUE(parse("ld", "-o", "my.out", "foo.o", nullptr));
EXPECT_EQ("my.out", _context.outputPath());
}
TEST_F(DarwinLdParserTest, Dylib) {
- EXPECT_FALSE(parse("ld", "-dylib", "foo.o", nullptr));
+ EXPECT_TRUE(parse("ld", "-dylib", "foo.o", nullptr));
EXPECT_EQ(mach_o::MH_DYLIB, _context.outputFileType());
}
TEST_F(DarwinLdParserTest, Relocatable) {
- EXPECT_FALSE(parse("ld", "-r", "foo.o", nullptr));
+ EXPECT_TRUE(parse("ld", "-r", "foo.o", nullptr));
EXPECT_EQ(mach_o::MH_OBJECT, _context.outputFileType());
}
TEST_F(DarwinLdParserTest, Bundle) {
- EXPECT_FALSE(parse("ld", "-bundle", "foo.o", nullptr));
+ EXPECT_TRUE(parse("ld", "-bundle", "foo.o", nullptr));
EXPECT_EQ(mach_o::MH_BUNDLE, _context.outputFileType());
}
TEST_F(DarwinLdParserTest, Preload) {
- EXPECT_FALSE(parse("ld", "-preload", "foo.o", nullptr));
+ EXPECT_TRUE(parse("ld", "-preload", "foo.o", nullptr));
EXPECT_EQ(mach_o::MH_PRELOAD, _context.outputFileType());
}
TEST_F(DarwinLdParserTest, Static) {
- EXPECT_FALSE(parse("ld", "-static", "foo.o", nullptr));
+ EXPECT_TRUE(parse("ld", "-static", "foo.o", nullptr));
EXPECT_EQ(mach_o::MH_EXECUTE, _context.outputFileType());
}
TEST_F(DarwinLdParserTest, Entry) {
- EXPECT_FALSE(parse("ld", "-e", "entryFunc", "foo.o", nullptr));
+ EXPECT_TRUE(parse("ld", "-e", "entryFunc", "foo.o", nullptr));
EXPECT_EQ("entryFunc", _context.entrySymbolName());
}
TEST_F(DarwinLdParserTest, OutputPath) {
- EXPECT_FALSE(parse("ld", "-o", "foo", "foo.o", nullptr));
+ EXPECT_TRUE(parse("ld", "-o", "foo", "foo.o", nullptr));
EXPECT_EQ("foo", _context.outputPath());
}
TEST_F(DarwinLdParserTest, DeadStrip) {
- EXPECT_FALSE(parse("ld", "-dead_strip", "foo.o", nullptr));
+ EXPECT_TRUE(parse("ld", "-dead_strip", "foo.o", nullptr));
EXPECT_TRUE(_context.deadStrip());
}
TEST_F(DarwinLdParserTest, DeadStripRootsExe) {
- EXPECT_FALSE(parse("ld", "-dead_strip", "foo.o", nullptr));
+ EXPECT_TRUE(parse("ld", "-dead_strip", "foo.o", nullptr));
EXPECT_FALSE(_context.globalsAreDeadStripRoots());
}
TEST_F(DarwinLdParserTest, DeadStripRootsDylib) {
- EXPECT_FALSE(parse("ld", "-dylib", "-dead_strip", "foo.o", nullptr));
+ EXPECT_TRUE(parse("ld", "-dylib", "-dead_strip", "foo.o", nullptr));
EXPECT_TRUE(_context.globalsAreDeadStripRoots());
}
TEST_F(DarwinLdParserTest, Arch) {
- EXPECT_FALSE(parse("ld", "-arch", "x86_64", "foo.o", nullptr));
+ EXPECT_TRUE(parse("ld", "-arch", "x86_64", "foo.o", nullptr));
EXPECT_EQ(MachOLinkingContext::arch_x86_64, _context.arch());
EXPECT_EQ(mach_o::CPU_TYPE_X86_64, _context.getCPUType());
EXPECT_EQ(mach_o::CPU_SUBTYPE_X86_64_ALL, _context.getCPUSubType());
}
TEST_F(DarwinLdParserTest, Arch_x86) {
- EXPECT_FALSE(parse("ld", "-arch", "i386", "foo.o", nullptr));
+ EXPECT_TRUE(parse("ld", "-arch", "i386", "foo.o", nullptr));
EXPECT_EQ(MachOLinkingContext::arch_x86, _context.arch());
EXPECT_EQ(mach_o::CPU_TYPE_I386, _context.getCPUType());
EXPECT_EQ(mach_o::CPU_SUBTYPE_X86_ALL, _context.getCPUSubType());
}
TEST_F(DarwinLdParserTest, Arch_armv6) {
- EXPECT_FALSE(parse("ld", "-arch", "armv6", "foo.o", nullptr));
+ EXPECT_TRUE(parse("ld", "-arch", "armv6", "foo.o", nullptr));
EXPECT_EQ(MachOLinkingContext::arch_armv6, _context.arch());
EXPECT_EQ(mach_o::CPU_TYPE_ARM, _context.getCPUType());
EXPECT_EQ(mach_o::CPU_SUBTYPE_ARM_V6, _context.getCPUSubType());
}
TEST_F(DarwinLdParserTest, Arch_armv7) {
- EXPECT_FALSE(parse("ld", "-arch", "armv7", "foo.o", nullptr));
+ EXPECT_TRUE(parse("ld", "-arch", "armv7", "foo.o", nullptr));
EXPECT_EQ(MachOLinkingContext::arch_armv7, _context.arch());
EXPECT_EQ(mach_o::CPU_TYPE_ARM, _context.getCPUType());
EXPECT_EQ(mach_o::CPU_SUBTYPE_ARM_V7, _context.getCPUSubType());
}
TEST_F(DarwinLdParserTest, Arch_armv7s) {
- EXPECT_FALSE(parse("ld", "-arch", "armv7s", "foo.o", nullptr));
+ EXPECT_TRUE(parse("ld", "-arch", "armv7s", "foo.o", nullptr));
EXPECT_EQ(MachOLinkingContext::arch_armv7s, _context.arch());
EXPECT_EQ(mach_o::CPU_TYPE_ARM, _context.getCPUType());
EXPECT_EQ(mach_o::CPU_SUBTYPE_ARM_V7S, _context.getCPUSubType());
}
TEST_F(DarwinLdParserTest, MinMacOSX10_7) {
- EXPECT_FALSE(parse("ld", "-macosx_version_min", "10.7", "foo.o", nullptr));
+ EXPECT_TRUE(parse("ld", "-macosx_version_min", "10.7", "foo.o", nullptr));
EXPECT_EQ(MachOLinkingContext::OS::macOSX, _context.os());
EXPECT_TRUE(_context.minOS("10.7", ""));
EXPECT_FALSE(_context.minOS("10.8", ""));
}
TEST_F(DarwinLdParserTest, MinMacOSX10_8) {
- EXPECT_FALSE(parse("ld", "-macosx_version_min", "10.8.3", "foo.o", nullptr));
+ EXPECT_TRUE(parse("ld", "-macosx_version_min", "10.8.3", "foo.o", nullptr));
EXPECT_EQ(MachOLinkingContext::OS::macOSX, _context.os());
EXPECT_TRUE(_context.minOS("10.7", ""));
EXPECT_TRUE(_context.minOS("10.8", ""));
}
TEST_F(DarwinLdParserTest, iOS5) {
- EXPECT_FALSE(parse("ld", "-ios_version_min", "5.0", "foo.o", nullptr));
+ EXPECT_TRUE(parse("ld", "-ios_version_min", "5.0", "foo.o", nullptr));
EXPECT_EQ(MachOLinkingContext::OS::iOS, _context.os());
EXPECT_TRUE(_context.minOS("", "5.0"));
EXPECT_FALSE(_context.minOS("", "6.0"));
}
TEST_F(DarwinLdParserTest, iOS6) {
- EXPECT_FALSE(parse("ld", "-ios_version_min", "6.0", "foo.o", nullptr));
+ EXPECT_TRUE(parse("ld", "-ios_version_min", "6.0", "foo.o", nullptr));
EXPECT_EQ(MachOLinkingContext::OS::iOS, _context.os());
EXPECT_TRUE(_context.minOS("", "5.0"));
EXPECT_TRUE(_context.minOS("", "6.0"));
}
TEST_F(DarwinLdParserTest, iOS_Simulator5) {
- EXPECT_FALSE(parse("ld", "-ios_simulator_version_min", "5.0", "a.o", nullptr));
+ EXPECT_TRUE(parse("ld", "-ios_simulator_version_min", "5.0", "a.o", nullptr));
EXPECT_EQ(MachOLinkingContext::OS::iOS_simulator, _context.os());
EXPECT_TRUE(_context.minOS("", "5.0"));
EXPECT_FALSE(_context.minOS("", "6.0"));
}
TEST_F(DarwinLdParserTest, iOS_Simulator6) {
- EXPECT_FALSE(parse("ld", "-ios_simulator_version_min", "6.0", "a.o", nullptr));
+ EXPECT_TRUE(parse("ld", "-ios_simulator_version_min", "6.0", "a.o", nullptr));
EXPECT_EQ(MachOLinkingContext::OS::iOS_simulator, _context.os());
EXPECT_TRUE(_context.minOS("", "5.0"));
EXPECT_TRUE(_context.minOS("", "6.0"));
}
TEST_F(DarwinLdParserTest, compatibilityVersion) {
- EXPECT_FALSE(
+ EXPECT_TRUE(
parse("ld", "-dylib", "-compatibility_version", "1.2.3", "a.o", nullptr));
EXPECT_EQ(_context.compatibilityVersion(), 0x10203U);
}
TEST_F(DarwinLdParserTest, compatibilityVersionInvalidType) {
- EXPECT_TRUE(parse("ld", "-bundle", "-compatibility_version", "1.2.3", "a.o",
- nullptr));
+ EXPECT_FALSE(parse("ld", "-bundle", "-compatibility_version", "1.2.3", "a.o",
+ nullptr));
}
TEST_F(DarwinLdParserTest, compatibilityVersionInvalidValue) {
- EXPECT_TRUE(parse("ld", "-bundle", "-compatibility_version", "1,2,3", "a.o",
- nullptr));
+ EXPECT_FALSE(parse("ld", "-bundle", "-compatibility_version", "1,2,3", "a.o",
+ nullptr));
}
TEST_F(DarwinLdParserTest, currentVersion) {
- EXPECT_FALSE(
+ EXPECT_TRUE(
parse("ld", "-dylib", "-current_version", "1.2.3", "a.o", nullptr));
EXPECT_EQ(_context.currentVersion(), 0x10203U);
}
TEST_F(DarwinLdParserTest, currentVersionInvalidType) {
- EXPECT_TRUE(
+ EXPECT_FALSE(
parse("ld", "-bundle", "-current_version", "1.2.3", "a.o", nullptr));
}
TEST_F(DarwinLdParserTest, currentVersionInvalidValue) {
- EXPECT_TRUE(
+ EXPECT_FALSE(
parse("ld", "-bundle", "-current_version", "1,2,3", "a.o", nullptr));
}
TEST_F(DarwinLdParserTest, bundleLoader) {
- EXPECT_FALSE(
+ EXPECT_TRUE(
parse("ld", "-bundle", "-bundle_loader", "/bin/ls", "a.o", nullptr));
EXPECT_EQ(_context.bundleLoader(), "/bin/ls");
}
TEST_F(DarwinLdParserTest, bundleLoaderInvalidType) {
- EXPECT_TRUE(parse("ld", "-bundle_loader", "/bin/ls", "a.o", nullptr));
+ EXPECT_FALSE(parse("ld", "-bundle_loader", "/bin/ls", "a.o", nullptr));
}
TEST_F(DarwinLdParserTest, deadStrippableDylib) {
- EXPECT_FALSE(
+ EXPECT_TRUE(
parse("ld", "-dylib", "-mark_dead_strippable_dylib", "a.o", nullptr));
EXPECT_EQ(true, _context.deadStrippableDylib());
}
TEST_F(DarwinLdParserTest, deadStrippableDylibInvalidType) {
- EXPECT_TRUE(parse("ld", "-mark_dead_strippable_dylib", "a.o", nullptr));
+ EXPECT_FALSE(parse("ld", "-mark_dead_strippable_dylib", "a.o", nullptr));
}
} // end anonymous namespace
OpenPOWER on IntegriCloud