Commit 55865eec authored by Bill Wendling's avatar Bill Wendling
Browse files

Merge r182726:

Improve support for compiler-rt tests in CMake build.

Now compiler-rt tests run correctly if compiler-rt is checked out into
arbitrary directory (not necessarily projects/compiler-rt).
Patch by Greg Fitzgerald!

llvm-svn: 183180
parent 593c75f5
Loading
Loading
Loading
Loading
+2 −3
Original line number Diff line number Diff line
@@ -11,9 +11,8 @@ def get_required_attr(config, attr_name):
  return attr_value

# Setup attributes common for all compiler-rt projects.
llvm_src_root = get_required_attr(config, 'llvm_src_root')
compiler_rt_lit_unit_cfg = os.path.join(llvm_src_root, "projects",
                                        "compiler-rt", "lib",
compiler_rt_src_root = get_required_attr(config, 'compiler_rt_src_root')
compiler_rt_lit_unit_cfg = os.path.join(compiler_rt_src_root, "lib",
                                        "lit.common.unit.cfg")
lit.load_config(config, compiler_rt_lit_unit_cfg)

+1 −0
Original line number Diff line number Diff line
@@ -3,6 +3,7 @@

config.target_triple = "@TARGET_TRIPLE@"
config.llvm_src_root = "@LLVM_SOURCE_DIR@"
config.compiler_rt_src_root = "@COMPILER_RT_SOURCE_DIR@"
config.llvm_build_mode = "@LLVM_BUILD_MODE@"
config.asan_binary_dir = "@ASAN_BINARY_DIR@"

+11 −10
Original line number Diff line number Diff line
@@ -2,6 +2,14 @@

import os

def get_required_attr(config, attr_name):
  attr_value = getattr(config, attr_name, None)
  if not attr_value:
    lit.fatal("No attribute %r in test configuration! You may need to run "
              "tests from your build directory or add this attribute "
              "to lit.site.cfg " % attr_name)
  return attr_value

# Setup config name.
config.name = 'AddressSanitizer'

@@ -30,14 +38,6 @@ if llvm_src_root is None:
  if not llvm_config:
    DisplayNoConfigMessage()

  # Validate that llvm-config points to the same source tree.
  llvm_src_root = lit.util.capture(["llvm-config", "--src-root"]).strip()
  asan_test_src_root = os.path.join(llvm_src_root, "projects", "compiler-rt",
                                    "lib", "asan", "lit_tests")
  if (os.path.realpath(asan_test_src_root) !=
      os.path.realpath(config.test_source_root)):
    DisplayNoConfigMessage()

  # Find out the presumed location of generated site config.
  llvm_obj_root = lit.util.capture(["llvm-config", "--obj-root"]).strip()
  asan_site_cfg = os.path.join(llvm_obj_root, "projects", "compiler-rt",
@@ -49,8 +49,9 @@ if llvm_src_root is None:
  raise SystemExit

# Setup attributes common for all compiler-rt projects.
compiler_rt_lit_cfg = os.path.join(llvm_src_root, "projects", "compiler-rt",
                                   "lib", "lit.common.cfg")
compiler_rt_src_root = get_required_attr(config, "compiler_rt_src_root")
compiler_rt_lit_cfg = os.path.join(compiler_rt_src_root, "lib",
                                   "lit.common.cfg")
if (not compiler_rt_lit_cfg) or (not os.path.exists(compiler_rt_lit_cfg)):
  lit.fatal("Can't find common compiler-rt lit config at: %r"
            % compiler_rt_lit_cfg)
+1 −0
Original line number Diff line number Diff line
@@ -5,6 +5,7 @@ config.target_triple = "@TARGET_TRIPLE@"
config.host_os = "@HOST_OS@"
config.llvm_src_root = "@LLVM_SOURCE_DIR@"
config.llvm_obj_root = "@LLVM_BINARY_DIR@"
config.compiler_rt_src_root = "@COMPILER_RT_SOURCE_DIR@"
config.llvm_tools_dir = "@LLVM_TOOLS_DIR@"
config.clang = "@LLVM_BINARY_DIR@/bin/clang"

+2 −3
Original line number Diff line number Diff line
@@ -11,9 +11,8 @@ def get_required_attr(config, attr_name):
  return attr_value

# Setup attributes common for all compiler-rt projects.
llvm_src_root = get_required_attr(config, 'llvm_src_root')
compiler_rt_lit_unit_cfg = os.path.join(llvm_src_root, "projects",
                                        "compiler-rt", "lib",
compiler_rt_src_root = get_required_attr(config, 'compiler_rt_src_root')
compiler_rt_lit_unit_cfg = os.path.join(compiler_rt_src_root, "lib",
                                        "lit.common.unit.cfg")
lit.load_config(config, compiler_rt_lit_unit_cfg)

Loading