1 //===- AllDrivers.cpp -------------------------------------------*- C++ -*-===//
3 // This file is licensed under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 //===----------------------------------------------------------------------===//
8 // This test shows a typical case where all LLD drivers are linked into the
9 // application binary. This is very similar to how lld.exe binary is linked,
10 // except that here we cleanup the internal LLD memory context after each call.
11 //===----------------------------------------------------------------------===//
13 #include "lld/Common/Driver.h"
14 #include "gmock/gmock.h"
22 static bool lldInvoke(std::vector
<const char *> args
) {
23 args
.push_back("--version");
25 lld::lldMain(args
, llvm::outs(), llvm::errs(), LLD_ALL_DRIVERS
);
26 return !r
.retCode
&& r
.canRunAgain
;
29 TEST(AsLib
, AllDrivers
) {
30 EXPECT_TRUE(lldInvoke({"ld.lld"}));
31 EXPECT_TRUE(lldInvoke({"ld64.lld"}));
32 EXPECT_TRUE(lldInvoke({"ld", "-m", "i386pe"})); // MinGW
33 EXPECT_TRUE(lldInvoke({"lld-link"}));
34 EXPECT_TRUE(lldInvoke({"wasm-ld"}));