diff options
Diffstat (limited to 'lld/unittests/DriverTests/GnuLdDriverTest.cpp')
| -rw-r--r-- | lld/unittests/DriverTests/GnuLdDriverTest.cpp | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/lld/unittests/DriverTests/GnuLdDriverTest.cpp b/lld/unittests/DriverTests/GnuLdDriverTest.cpp new file mode 100644 index 00000000000..2483559cd58 --- /dev/null +++ b/lld/unittests/DriverTests/GnuLdDriverTest.cpp @@ -0,0 +1,51 @@ +//===- lld/unittest/WinLinkDriverTest.cpp ---------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// +/// +/// \file +/// \brief Windows link.exe driver tests. +/// +//===----------------------------------------------------------------------===// + +#include "DriverTest.h" + +#include "lld/ReaderWriter/ELFTargetInfo.h" + +using namespace llvm; +using namespace lld; + +namespace { + +class GnuLdParserTest : public ParserTest<GnuLdDriver, ELFTargetInfo> { +protected: + virtual ELFTargetInfo* doParse(int argc, const char **argv, + raw_ostream &diag) { + std::unique_ptr<ELFTargetInfo> info(GnuLdDriver::parse(argc, argv, diag)); + return info.release(); + } +}; + +TEST_F(GnuLdParserTest, Basic) { + parse("ld", "infile.o", nullptr); + ASSERT_TRUE(!!info); + EXPECT_EQ("a.out", info->outputPath()); + EXPECT_EQ(1, (int)inputFiles.size()); + EXPECT_EQ("infile.o", inputFiles[0]); + EXPECT_FALSE(info->outputYAML()); +} + +TEST_F(GnuLdParserTest, ManyOptions) { + parse("ld", "-entry", "_start", "-o", "outfile", + "-emit-yaml", "infile.o", nullptr); + ASSERT_TRUE(!!info); + EXPECT_EQ("outfile", info->outputPath()); + EXPECT_EQ("_start", info->entrySymbolName()); + EXPECT_TRUE(info->outputYAML()); +} + +} // end anonymous namespace |

