[Lldb-commits] [lldb] r374461 - [test] Reduce inconsistency between lit configuration files.

Jonas Devlieghere via lldb-commits lldb-commits at lists.llvm.org
Thu Oct 10 14:49:22 PDT 2019


Author: jdevlieghere
Date: Thu Oct 10 14:49:22 2019
New Revision: 374461

URL: http://llvm.org/viewvc/llvm-project?rev=374461&view=rev
Log:
[test] Reduce inconsistency between lit configuration files.

Add the Python extension to the configuration files in the API directory
to match the other test suites.

Added:
    lldb/trunk/test/API/lit.cfg.py
    lldb/trunk/test/API/lit.site.cfg.py.in
Removed:
    lldb/trunk/test/API/lit.cfg
    lldb/trunk/test/API/lit.site.cfg.in
Modified:
    lldb/trunk/test/CMakeLists.txt

Removed: lldb/trunk/test/API/lit.cfg
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/API/lit.cfg?rev=374460&view=auto
==============================================================================
--- lldb/trunk/test/API/lit.cfg (original)
+++ lldb/trunk/test/API/lit.cfg (removed)
@@ -1,101 +0,0 @@
-# -*- Python -*-
-
-# Configuration file for the 'lit' test runner.
-
-import os
-import platform
-import shlex
-import shutil
-
-import lit.formats
-
-# name: The name of this test suite.
-config.name = 'lldb-api'
-
-# suffixes: A list of file extensions to treat as test files.
-config.suffixes = ['.py']
-
-# test_source_root: The root path where tests are located.
-# test_exec_root: The root path where tests should be run.
-config.test_source_root = os.path.join(config.lldb_src_root, 'packages',
-                                       'Python', 'lldbsuite', 'test')
-config.test_exec_root = config.test_source_root
-
-if 'Address' in config.llvm_use_sanitizer:
-  config.environment['ASAN_OPTIONS'] = 'detect_stack_use_after_return=1'
-  # macOS flags needed for LLDB built with address sanitizer.
-  if 'Darwin' in config.host_os and 'x86' in config.host_triple:
-    import subprocess
-    resource_dir = subprocess.check_output(
-        [config.cmake_cxx_compiler, '-print-resource-dir']).strip()
-    runtime = os.path.join(resource_dir, 'lib', 'darwin',
-                           'libclang_rt.asan_osx_dynamic.dylib')
-    config.environment['DYLD_INSERT_LIBRARIES'] = runtime
-
-def find_shlibpath_var():
-  if platform.system() in ['Linux', 'FreeBSD', 'NetBSD', 'SunOS']:
-    yield 'LD_LIBRARY_PATH'
-  elif platform.system() == 'Darwin':
-    yield 'DYLD_LIBRARY_PATH'
-  elif platform.system() == 'Windows':
-    yield 'PATH'
-
-# Shared library build of LLVM may require LD_LIBRARY_PATH or equivalent.
-if config.shared_libs:
-  for shlibpath_var in find_shlibpath_var():
-    # In stand-alone build llvm_shlib_dir specifies LLDB's lib directory while
-    # llvm_libs_dir specifies LLVM's lib directory.
-    shlibpath = os.path.pathsep.join(
-        (config.llvm_shlib_dir, config.llvm_libs_dir,
-         config.environment.get(shlibpath_var, '')))
-    config.environment[shlibpath_var] = shlibpath
-  else:
-    lit_config.warning("unable to inject shared library path on '{}'".format(
-        platform.system()))
-
-# Clean the module caches in the test build directory. This is necessary in an
-# incremental build whenever clang changes underneath, so doing it once per
-# lit.py invocation is close enough.
-for cachedir in [config.clang_module_cache, config.lldb_module_cache]:
-  if os.path.isdir(cachedir):
-    print("Deleting module cache at %s."%cachedir)
-    shutil.rmtree(cachedir)
-
-# Set a default per-test timeout of 10 minutes. Setting a timeout per test
-# requires that killProcessAndChildren() is supported on the platform and
-# lit complains if the value is set but it is not supported.
-supported, errormsg = lit_config.maxIndividualTestTimeIsSupported
-if supported:
-    lit_config.maxIndividualTestTime = 600
-else:
-    lit_config.warning("Could not set a default per-test timeout. " + errormsg)
-
-# Build dotest command.
-dotest_cmd = [config.dotest_path]
-dotest_cmd.extend(config.dotest_args_str.split(';'))
-
-# We don't want to force users passing arguments to lit to use `;` as a
-# separator. We use Python's simple lexical analyzer to turn the args into a
-# list.
-if config.dotest_lit_args_str:
-  dotest_cmd.extend(shlex.split(config.dotest_lit_args_str))
-
-# Library path may be needed to locate just-built clang.
-if config.llvm_libs_dir:
-  dotest_cmd += ['--env', 'LLVM_LIBS_DIR=' + config.llvm_libs_dir]
-
-if config.lldb_build_directory:
-  dotest_cmd += ['--build-dir', config.lldb_build_directory]
-
-if config.lldb_module_cache:
-  dotest_cmd += ['--lldb-module-cache-dir', config.lldb_module_cache]
-
-if config.clang_module_cache:
-  dotest_cmd += ['--clang-module-cache-dir', config.clang_module_cache]
-
-# Load LLDB test format.
-sys.path.append(os.path.join(config.lldb_src_root, "test", "API"))
-import lldbtest
-
-# testFormat: The test format to use to interpret tests.
-config.test_format = lldbtest.LLDBTest(dotest_cmd)

Added: lldb/trunk/test/API/lit.cfg.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/API/lit.cfg.py?rev=374461&view=auto
==============================================================================
--- lldb/trunk/test/API/lit.cfg.py (added)
+++ lldb/trunk/test/API/lit.cfg.py Thu Oct 10 14:49:22 2019
@@ -0,0 +1,101 @@
+# -*- Python -*-
+
+# Configuration file for the 'lit' test runner.
+
+import os
+import platform
+import shlex
+import shutil
+
+import lit.formats
+
+# name: The name of this test suite.
+config.name = 'lldb-api'
+
+# suffixes: A list of file extensions to treat as test files.
+config.suffixes = ['.py']
+
+# test_source_root: The root path where tests are located.
+# test_exec_root: The root path where tests should be run.
+config.test_source_root = os.path.join(config.lldb_src_root, 'packages',
+                                       'Python', 'lldbsuite', 'test')
+config.test_exec_root = config.test_source_root
+
+if 'Address' in config.llvm_use_sanitizer:
+  config.environment['ASAN_OPTIONS'] = 'detect_stack_use_after_return=1'
+  # macOS flags needed for LLDB built with address sanitizer.
+  if 'Darwin' in config.host_os and 'x86' in config.host_triple:
+    import subprocess
+    resource_dir = subprocess.check_output(
+        [config.cmake_cxx_compiler, '-print-resource-dir']).strip()
+    runtime = os.path.join(resource_dir, 'lib', 'darwin',
+                           'libclang_rt.asan_osx_dynamic.dylib')
+    config.environment['DYLD_INSERT_LIBRARIES'] = runtime
+
+def find_shlibpath_var():
+  if platform.system() in ['Linux', 'FreeBSD', 'NetBSD', 'SunOS']:
+    yield 'LD_LIBRARY_PATH'
+  elif platform.system() == 'Darwin':
+    yield 'DYLD_LIBRARY_PATH'
+  elif platform.system() == 'Windows':
+    yield 'PATH'
+
+# Shared library build of LLVM may require LD_LIBRARY_PATH or equivalent.
+if config.shared_libs:
+  for shlibpath_var in find_shlibpath_var():
+    # In stand-alone build llvm_shlib_dir specifies LLDB's lib directory while
+    # llvm_libs_dir specifies LLVM's lib directory.
+    shlibpath = os.path.pathsep.join(
+        (config.llvm_shlib_dir, config.llvm_libs_dir,
+         config.environment.get(shlibpath_var, '')))
+    config.environment[shlibpath_var] = shlibpath
+  else:
+    lit_config.warning("unable to inject shared library path on '{}'".format(
+        platform.system()))
+
+# Clean the module caches in the test build directory. This is necessary in an
+# incremental build whenever clang changes underneath, so doing it once per
+# lit.py invocation is close enough.
+for cachedir in [config.clang_module_cache, config.lldb_module_cache]:
+  if os.path.isdir(cachedir):
+    print("Deleting module cache at %s."%cachedir)
+    shutil.rmtree(cachedir)
+
+# Set a default per-test timeout of 10 minutes. Setting a timeout per test
+# requires that killProcessAndChildren() is supported on the platform and
+# lit complains if the value is set but it is not supported.
+supported, errormsg = lit_config.maxIndividualTestTimeIsSupported
+if supported:
+    lit_config.maxIndividualTestTime = 600
+else:
+    lit_config.warning("Could not set a default per-test timeout. " + errormsg)
+
+# Build dotest command.
+dotest_cmd = [config.dotest_path]
+dotest_cmd.extend(config.dotest_args_str.split(';'))
+
+# We don't want to force users passing arguments to lit to use `;` as a
+# separator. We use Python's simple lexical analyzer to turn the args into a
+# list.
+if config.dotest_lit_args_str:
+  dotest_cmd.extend(shlex.split(config.dotest_lit_args_str))
+
+# Library path may be needed to locate just-built clang.
+if config.llvm_libs_dir:
+  dotest_cmd += ['--env', 'LLVM_LIBS_DIR=' + config.llvm_libs_dir]
+
+if config.lldb_build_directory:
+  dotest_cmd += ['--build-dir', config.lldb_build_directory]
+
+if config.lldb_module_cache:
+  dotest_cmd += ['--lldb-module-cache-dir', config.lldb_module_cache]
+
+if config.clang_module_cache:
+  dotest_cmd += ['--clang-module-cache-dir', config.clang_module_cache]
+
+# Load LLDB test format.
+sys.path.append(os.path.join(config.lldb_src_root, "test", "API"))
+import lldbtest
+
+# testFormat: The test format to use to interpret tests.
+config.test_format = lldbtest.LLDBTest(dotest_cmd)

Removed: lldb/trunk/test/API/lit.site.cfg.in
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/API/lit.site.cfg.in?rev=374460&view=auto
==============================================================================
--- lldb/trunk/test/API/lit.site.cfg.in (original)
+++ lldb/trunk/test/API/lit.site.cfg.in (removed)
@@ -1,47 +0,0 @@
- at LIT_SITE_CFG_IN_HEADER@
-
-config.test_exec_root = "@LLDB_BINARY_DIR@"
-config.llvm_src_root = "@LLVM_SOURCE_DIR@"
-config.llvm_obj_root = "@LLVM_BINARY_DIR@"
-config.llvm_tools_dir = "@LLVM_TOOLS_DIR@"
-config.llvm_libs_dir = "@LLVM_LIBS_DIR@"
-config.llvm_shlib_dir = "@SHLIBDIR@"
-config.llvm_build_mode = "@LLVM_BUILD_MODE@"
-config.lit_tools_dir = "@LLVM_LIT_TOOLS_DIR@"
-config.lldb_obj_root = "@LLDB_BINARY_DIR@"
-config.lldb_src_root = "@LLDB_SOURCE_DIR@"
-config.cmake_cxx_compiler = "@CMAKE_CXX_COMPILER@"
-config.host_os = "@HOST_OS@"
-config.host_triple = "@LLVM_HOST_TRIPLE@"
-config.shared_libs = @LLVM_ENABLE_SHARED_LIBS@
-config.llvm_use_sanitizer = "@LLVM_USE_SANITIZER@"
-config.target_triple = "@TARGET_TRIPLE@"
-config.lldb_build_directory = "@LLDB_TEST_BUILD_DIRECTORY@"
-config.python_executable = "@PYTHON_EXECUTABLE@"
-config.dotest_path = "@LLDB_SOURCE_DIR@/test/API/dotest.py"
-config.dotest_args_str = "@LLDB_DOTEST_ARGS@"
-config.lldb_disable_python = @LLDB_DISABLE_PYTHON@
-config.dotest_lit_args_str = None
-# The API tests use their own module caches.
-config.lldb_module_cache = os.path.join("@LLDB_TEST_MODULE_CACHE_LLDB@", "lldb-api")
-config.clang_module_cache = os.path.join("@LLDB_TEST_MODULE_CACHE_CLANG@", "lldb-api")
-
-# Additional dotest arguments can be passed to lit by providing a
-# semicolon-separates list: --param dotest-args="arg;arg".
-dotest_lit_args_str = lit_config.params.get('dotest-args', None)
-if dotest_lit_args_str:
-    config.dotest_lit_args_str = dotest_lit_args_str
-
-# Support substitution of the tools and libs dirs with user parameters. This is
-# used when we can't determine the tool dir at configuration time.
-try:
-    config.llvm_tools_dir = config.llvm_tools_dir % lit_config.params
-    config.llvm_libs_dir = config.llvm_libs_dir % lit_config.params
-    config.dotest_args_str = config.dotest_args_str % lit_config.params
-    config.llvm_build_mode = config.llvm_build_mode % lit_config.params
-except KeyError as e:
-    key, = e.args
-    lit_config.fatal("unable to find %r parameter, use '--param=%s=VALUE'" % (key,key))
-
-# Let the main config do the real work.
-lit_config.load_config(config, "@LLDB_SOURCE_DIR@/test/API/lit.cfg")

Added: lldb/trunk/test/API/lit.site.cfg.py.in
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/API/lit.site.cfg.py.in?rev=374461&view=auto
==============================================================================
--- lldb/trunk/test/API/lit.site.cfg.py.in (added)
+++ lldb/trunk/test/API/lit.site.cfg.py.in Thu Oct 10 14:49:22 2019
@@ -0,0 +1,47 @@
+ at LIT_SITE_CFG_IN_HEADER@
+
+config.test_exec_root = "@LLDB_BINARY_DIR@"
+config.llvm_src_root = "@LLVM_SOURCE_DIR@"
+config.llvm_obj_root = "@LLVM_BINARY_DIR@"
+config.llvm_tools_dir = "@LLVM_TOOLS_DIR@"
+config.llvm_libs_dir = "@LLVM_LIBS_DIR@"
+config.llvm_shlib_dir = "@SHLIBDIR@"
+config.llvm_build_mode = "@LLVM_BUILD_MODE@"
+config.lit_tools_dir = "@LLVM_LIT_TOOLS_DIR@"
+config.lldb_obj_root = "@LLDB_BINARY_DIR@"
+config.lldb_src_root = "@LLDB_SOURCE_DIR@"
+config.cmake_cxx_compiler = "@CMAKE_CXX_COMPILER@"
+config.host_os = "@HOST_OS@"
+config.host_triple = "@LLVM_HOST_TRIPLE@"
+config.shared_libs = @LLVM_ENABLE_SHARED_LIBS@
+config.llvm_use_sanitizer = "@LLVM_USE_SANITIZER@"
+config.target_triple = "@TARGET_TRIPLE@"
+config.lldb_build_directory = "@LLDB_TEST_BUILD_DIRECTORY@"
+config.python_executable = "@PYTHON_EXECUTABLE@"
+config.dotest_path = "@LLDB_SOURCE_DIR@/test/API/dotest.py"
+config.dotest_args_str = "@LLDB_DOTEST_ARGS@"
+config.lldb_disable_python = @LLDB_DISABLE_PYTHON@
+config.dotest_lit_args_str = None
+# The API tests use their own module caches.
+config.lldb_module_cache = os.path.join("@LLDB_TEST_MODULE_CACHE_LLDB@", "lldb-api")
+config.clang_module_cache = os.path.join("@LLDB_TEST_MODULE_CACHE_CLANG@", "lldb-api")
+
+# Additional dotest arguments can be passed to lit by providing a
+# semicolon-separates list: --param dotest-args="arg;arg".
+dotest_lit_args_str = lit_config.params.get('dotest-args', None)
+if dotest_lit_args_str:
+    config.dotest_lit_args_str = dotest_lit_args_str
+
+# Support substitution of the tools and libs dirs with user parameters. This is
+# used when we can't determine the tool dir at configuration time.
+try:
+    config.llvm_tools_dir = config.llvm_tools_dir % lit_config.params
+    config.llvm_libs_dir = config.llvm_libs_dir % lit_config.params
+    config.dotest_args_str = config.dotest_args_str % lit_config.params
+    config.llvm_build_mode = config.llvm_build_mode % lit_config.params
+except KeyError as e:
+    key, = e.args
+    lit_config.fatal("unable to find %r parameter, use '--param=%s=VALUE'" % (key,key))
+
+# Let the main config do the real work.
+lit_config.load_config(config, "@LLDB_SOURCE_DIR@/test/API/lit.cfg.py")

Modified: lldb/trunk/test/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/CMakeLists.txt?rev=374461&r1=374460&r2=374461&view=diff
==============================================================================
--- lldb/trunk/test/CMakeLists.txt (original)
+++ lldb/trunk/test/CMakeLists.txt Thu Oct 10 14:49:22 2019
@@ -87,32 +87,40 @@ if(NOT LLDB_BUILT_STANDALONE)
   )
 endif()
 
-# the value is not canonicalized within LLVM
+# These values are not canonicalized within LLVM.
 llvm_canonicalize_cmake_booleans(
   LLDB_DISABLE_PYTHON
   LLVM_ENABLE_ZLIB
   LLVM_ENABLE_SHARED_LIBS
   LLDB_IS_64_BITS)
 
+# Configure the top level test suite.
+configure_lit_site_cfg(
+  ${CMAKE_CURRENT_SOURCE_DIR}/lit.site.cfg.py.in
+  ${CMAKE_CURRENT_BINARY_DIR}/lit.site.cfg.py
+  MAIN_CONFIG
+  ${CMAKE_CURRENT_SOURCE_DIR}/lit.cfg.py)
+
+# Configure the Shell test suite.
 configure_lit_site_cfg(
   ${CMAKE_CURRENT_SOURCE_DIR}/Shell/lit.site.cfg.py.in
   ${CMAKE_CURRENT_BINARY_DIR}/Shell/lit.site.cfg.py
   MAIN_CONFIG
   ${CMAKE_CURRENT_SOURCE_DIR}/Shell/lit.cfg.py)
+
+# Configure the Unit test suite.
 configure_lit_site_cfg(
   ${CMAKE_CURRENT_SOURCE_DIR}/Unit/lit.site.cfg.py.in
   ${CMAKE_CURRENT_BINARY_DIR}/Unit/lit.site.cfg.py
   MAIN_CONFIG
   ${CMAKE_CURRENT_SOURCE_DIR}/Unit/lit.cfg.py)
+
+# Configure the API test suite.
 configure_lit_site_cfg(
-  ${CMAKE_CURRENT_SOURCE_DIR}/API/lit.site.cfg.in
-  ${CMAKE_CURRENT_BINARY_DIR}/API/lit.site.cfg)
-configure_lit_site_cfg(
-  ${CMAKE_CURRENT_SOURCE_DIR}/lit.site.cfg.py.in
-  ${CMAKE_CURRENT_BINARY_DIR}/lit.site.cfg.py
+  ${CMAKE_CURRENT_SOURCE_DIR}/API/lit.site.cfg.py.in
+  ${CMAKE_CURRENT_BINARY_DIR}/API/lit.site.cfg.py
   MAIN_CONFIG
-  ${CMAKE_CURRENT_SOURCE_DIR}/lit.cfg.py)
-
+  ${CMAKE_CURRENT_SOURCE_DIR}/API/lit.cfg.py)
 configure_file(
   ${CMAKE_CURRENT_SOURCE_DIR}/Shell/lit-lldb-init.in
   ${CMAKE_CURRENT_BINARY_DIR}/Shell/lit-lldb-init)




More information about the lldb-commits mailing list