summaryrefslogtreecommitdiffstats
path: root/lld/unittests/DriverTests/UniversalDriverTest.cpp
blob: 8e90ca4d5867359795b68b0d599d9b8d6912d5d3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
//===- lld/unittest/UniversalDriverTest.cpp -------------------------------===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
///
/// \file
/// \brief Universal driver tests that depend on the value of argv[0].
///
//===----------------------------------------------------------------------===//

#include "gtest/gtest.h"
#include "lld/Driver/Driver.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/Support/raw_ostream.h"

using namespace llvm;
using namespace lld;

TEST(UniversalDriver, flavor) {
  const char *args[] = { "gnu-ld" };

  std::string diags;
  raw_string_ostream os(diags);
  UniversalDriver::link(array_lengthof(args), args, os);
  EXPECT_EQ(os.str().find("failed to determine driver flavor"),
            std::string::npos);
  EXPECT_NE(os.str().find("No input files"),
            std::string::npos);
}
OpenPOWER on IntegriCloud