[lld] r186630 - Check the return value from parse()
Nick Kledzik
kledzik at apple.com
Thu Jul 18 16:47:23 PDT 2013
Author: kledzik
Date: Thu Jul 18 18:47:22 2013
New Revision: 186630
URL: http://llvm.org/viewvc/llvm-project?rev=186630&view=rev
Log:
Check the return value from parse()
Modified:
lld/trunk/unittests/DriverTests/DarwinLdDriverTest.cpp
Modified: lld/trunk/unittests/DriverTests/DarwinLdDriverTest.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/unittests/DriverTests/DarwinLdDriverTest.cpp?rev=186630&r1=186629&r2=186630&view=diff
==============================================================================
--- lld/trunk/unittests/DriverTests/DarwinLdDriverTest.cpp (original)
+++ lld/trunk/unittests/DriverTests/DarwinLdDriverTest.cpp Thu Jul 18 18:47:22 2013
@@ -39,7 +39,7 @@ TEST_F(DarwinLdParserTest, Basic) {
}
TEST_F(DarwinLdParserTest, Output) {
- parse("ld", "-o", "my.out", "foo.o", nullptr);
+ EXPECT_FALSE(parse("ld", "-o", "my.out", "foo.o", nullptr));
EXPECT_EQ("my.out", _info.outputPath());
}
@@ -84,22 +84,22 @@ TEST_F(DarwinLdParserTest, DeadStrip) {
}
TEST_F(DarwinLdParserTest, DeadStripRootsExe) {
- parse("ld", "-dead_strip", "foo.o", nullptr);
+ EXPECT_FALSE(parse("ld", "-dead_strip", "foo.o", nullptr));
EXPECT_FALSE(_info.globalsAreDeadStripRoots());
}
TEST_F(DarwinLdParserTest, DeadStripRootsDylib) {
- parse("ld", "-dylib", "-dead_strip", "foo.o", nullptr);
+ EXPECT_FALSE(parse("ld", "-dylib", "-dead_strip", "foo.o", nullptr));
EXPECT_TRUE(_info.globalsAreDeadStripRoots());
}
TEST_F(DarwinLdParserTest, ForceLoadArchive) {
- parse("ld","-all_load", "foo.o", nullptr);
+ EXPECT_FALSE(parse("ld","-all_load", "foo.o", nullptr));
EXPECT_TRUE(_info.forceLoadAllArchives());
}
TEST_F(DarwinLdParserTest, NoForceLoadArchive) {
- parse("ld", "foo.o", nullptr);
+ EXPECT_FALSE(parse("ld", "foo.o", nullptr));
EXPECT_FALSE(_info.forceLoadAllArchives());
}
@@ -111,70 +111,70 @@ TEST_F(DarwinLdParserTest, Arch) {
}
TEST_F(DarwinLdParserTest, Arch_x86) {
- parse("ld", "-arch", "i386", "foo.o", nullptr);
+ EXPECT_FALSE(parse("ld", "-arch", "i386", "foo.o", nullptr));
EXPECT_EQ(MachOTargetInfo::arch_x86, _info.arch());
EXPECT_EQ(mach_o::CPU_TYPE_I386, _info.getCPUType());
EXPECT_EQ(mach_o::CPU_SUBTYPE_X86_ALL, _info.getCPUSubType());
}
TEST_F(DarwinLdParserTest, Arch_armv6) {
- parse("ld", "-arch", "armv6", "foo.o", nullptr);
+ EXPECT_FALSE(parse("ld", "-arch", "armv6", "foo.o", nullptr));
EXPECT_EQ(MachOTargetInfo::arch_armv6, _info.arch());
EXPECT_EQ(mach_o::CPU_TYPE_ARM, _info.getCPUType());
EXPECT_EQ(mach_o::CPU_SUBTYPE_ARM_V6, _info.getCPUSubType());
}
TEST_F(DarwinLdParserTest, Arch_armv7) {
- parse("ld", "-arch", "armv7", "foo.o", nullptr);
+ EXPECT_FALSE(parse("ld", "-arch", "armv7", "foo.o", nullptr));
EXPECT_EQ(MachOTargetInfo::arch_armv7, _info.arch());
EXPECT_EQ(mach_o::CPU_TYPE_ARM, _info.getCPUType());
EXPECT_EQ(mach_o::CPU_SUBTYPE_ARM_V7, _info.getCPUSubType());
}
TEST_F(DarwinLdParserTest, Arch_armv7s) {
- parse("ld", "-arch", "armv7s", "foo.o", nullptr);
+ EXPECT_FALSE(parse("ld", "-arch", "armv7s", "foo.o", nullptr));
EXPECT_EQ(MachOTargetInfo::arch_armv7s, _info.arch());
EXPECT_EQ(mach_o::CPU_TYPE_ARM, _info.getCPUType());
EXPECT_EQ(mach_o::CPU_SUBTYPE_ARM_V7S, _info.getCPUSubType());
}
TEST_F(DarwinLdParserTest, MinMacOSX10_7) {
- parse("ld", "-macosx_version_min", "10.7", "foo.o", nullptr);
+ EXPECT_FALSE(parse("ld", "-macosx_version_min", "10.7", "foo.o", nullptr));
EXPECT_EQ(MachOTargetInfo::OS::macOSX, _info.os());
EXPECT_TRUE(_info.minOS("10.7", ""));
EXPECT_FALSE(_info.minOS("10.8", ""));
}
TEST_F(DarwinLdParserTest, MinMacOSX10_8) {
- parse("ld", "-macosx_version_min", "10.8.3", "foo.o", nullptr);
+ EXPECT_FALSE(parse("ld", "-macosx_version_min", "10.8.3", "foo.o", nullptr));
EXPECT_EQ(MachOTargetInfo::OS::macOSX, _info.os());
EXPECT_TRUE(_info.minOS("10.7", ""));
EXPECT_TRUE(_info.minOS("10.8", ""));
}
TEST_F(DarwinLdParserTest, iOS5) {
- parse("ld", "-ios_version_min", "5.0", "foo.o", nullptr);
+ EXPECT_FALSE(parse("ld", "-ios_version_min", "5.0", "foo.o", nullptr));
EXPECT_EQ(MachOTargetInfo::OS::iOS, _info.os());
EXPECT_TRUE(_info.minOS("", "5.0"));
EXPECT_FALSE(_info.minOS("", "6.0"));
}
TEST_F(DarwinLdParserTest, iOS6) {
- parse("ld", "-ios_version_min", "6.0", "foo.o", nullptr);
+ EXPECT_FALSE(parse("ld", "-ios_version_min", "6.0", "foo.o", nullptr));
EXPECT_EQ(MachOTargetInfo::OS::iOS, _info.os());
EXPECT_TRUE(_info.minOS("", "5.0"));
EXPECT_TRUE(_info.minOS("", "6.0"));
}
TEST_F(DarwinLdParserTest, iOS_Simulator5) {
- parse("ld", "-ios_simulator_version_min", "5.0", "foo.o", nullptr);
+ EXPECT_FALSE(parse("ld", "-ios_simulator_version_min", "5.0", "a.o", nullptr));
EXPECT_EQ(MachOTargetInfo::OS::iOS_simulator, _info.os());
EXPECT_TRUE(_info.minOS("", "5.0"));
EXPECT_FALSE(_info.minOS("", "6.0"));
}
TEST_F(DarwinLdParserTest, iOS_Simulator6) {
- parse("ld", "-ios_simulator_version_min", "6.0", "foo.o", nullptr);
+ EXPECT_FALSE(parse("ld", "-ios_simulator_version_min", "6.0", "a.o", nullptr));
EXPECT_EQ(MachOTargetInfo::OS::iOS_simulator, _info.os());
EXPECT_TRUE(_info.minOS("", "5.0"));
EXPECT_TRUE(_info.minOS("", "6.0"));
More information about the llvm-commits
mailing list