[llvm] r361998 - lit: modernize the lit configuration for the lit tests
Stella Stamenova via llvm-commits
llvm-commits at lists.llvm.org
Wed May 29 11:07:39 PDT 2019
Author: stella.stamenova
Date: Wed May 29 11:07:39 2019
New Revision: 361998
URL: http://llvm.org/viewvc/llvm-project?rev=361998&view=rev
Log:
lit: modernize the lit configuration for the lit tests
Summary: This also normalizes the config feature that represents the windows platform to "system-windows" as opposed to having both "windows" and "system-windows"
Reviewers: asmith, probinson
Subscribers: delcypher, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D61798
Modified:
llvm/trunk/utils/lit/tests/lit.cfg
llvm/trunk/utils/lit/tests/lit.site.cfg.in
llvm/trunk/utils/lit/tests/shtest-timeout.py
Modified: llvm/trunk/utils/lit/tests/lit.cfg
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/lit/tests/lit.cfg?rev=361998&r1=361997&r2=361998&view=diff
==============================================================================
--- llvm/trunk/utils/lit/tests/lit.cfg (original)
+++ llvm/trunk/utils/lit/tests/lit.cfg Wed May 29 11:07:39 2019
@@ -4,6 +4,7 @@ import os
import sys
import lit.formats
+from lit.llvm import llvm_config
# Configuration file for the 'lit' test runner.
@@ -25,42 +26,35 @@ config.test_exec_root = config.test_sour
config.target_triple = '(unused)'
-src_root = os.path.join(config.test_source_root, '..')
llvm_src_root = getattr(config, 'llvm_src_root', None)
-if llvm_src_root != None:
- # ``src_root`` may be in LLVM's binary build directory which does not contain
+if llvm_src_root:
+ # ``test_source_root`` may be in LLVM's binary build directory which does not contain
# ``lit.py``, so use `llvm_src_root` instead.
lit_path = os.path.join(llvm_src_root, 'utils', 'lit')
else:
- lit_path = src_root
+ lit_path = os.path.join(config.test_source_root, '..')
-pythonpath_list = [lit_path] # Required because some tests import the lit module
+# Required because some tests import the lit module
+llvm_config.with_environment('PYTHONPATH', lit_path, append_path=True)
-# Ensure the user's PYTHONPATH is included.
-if 'PYTHONPATH' in os.environ:
- pythonpath_list.append(os.environ['PYTHONPATH'])
-if 'PYTHONPATH' in config.environment:
- pythonpath_list.append(config.environment['PYTHONPATH'])
-config.environment['PYTHONPATH'] = os.pathsep.join(pythonpath_list)
+# Add llvm and lit tools directories if this config is being loaded indirectly.
+for attribute in ('llvm_tools_dir', 'lit_tools_dir'):
+ directory = getattr(config, attribute, None)
+ if directory:
+ llvm_config.with_environment('PATH', directory, append_path=True)
-config.substitutions.append(('%{src_root}', src_root))
config.substitutions.append(('%{inputs}', os.path.join(
- src_root, 'tests', 'Inputs')))
+ config.test_source_root, 'Inputs')))
config.substitutions.append(('%{lit}', "%%{python} %s" % (
- os.path.join(lit_path, 'lit.py'),)))
+ os.path.join(lit_path, 'lit.py'),)))
config.substitutions.append(('%{python}', '"%s"' % (sys.executable)))
-
# Enable coverage.py reporting, assuming the coverage module has been installed
# and sitecustomize.py in the virtualenv has been modified appropriately.
if lit_config.params.get('check-coverage', None):
config.environment['COVERAGE_PROCESS_START'] = os.path.join(
os.path.dirname(__file__), ".coveragerc")
-# Add a feature to detect the Python version.
-config.available_features.add("python%d.%d" % (sys.version_info[0],
- sys.version_info[1]))
-
# Add a feature to detect if psutil is available
try:
import psutil
@@ -69,14 +63,3 @@ try:
except ImportError:
lit_config.warning('Could not import psutil. Some tests will be skipped and'
' the --timeout command line argument will not work.')
-
-if sys.platform.startswith('win') or sys.platform.startswith('cygwin'):
- config.available_features.add('windows')
-
-# Add llvm and lit tools directories if this config is being loaded indirectly.
-path = config.environment['PATH']
-for attribute in ('llvm_tools_dir', 'lit_tools_dir'):
- directory = getattr(config, attribute, None)
- if directory:
- path = os.path.pathsep.join((directory, path))
-config.environment['PATH'] = path
Modified: llvm/trunk/utils/lit/tests/lit.site.cfg.in
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/lit/tests/lit.site.cfg.in?rev=361998&r1=361997&r2=361998&view=diff
==============================================================================
--- llvm/trunk/utils/lit/tests/lit.site.cfg.in (original)
+++ llvm/trunk/utils/lit/tests/lit.site.cfg.in Wed May 29 11:07:39 2019
@@ -16,5 +16,8 @@ except KeyError:
key, = e.args
lit_config.fatal("unable to find %r parameter, use '--param=%s=VALUE'" % (key,key))
+import lit.llvm
+lit.llvm.initialize(lit_config, config)
+
# Let the main config do the real work.
lit_config.load_config(config, "@LLVM_BINARY_DIR@/utils/lit/tests/lit.cfg")
Modified: llvm/trunk/utils/lit/tests/shtest-timeout.py
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/lit/tests/shtest-timeout.py?rev=361998&r1=361997&r2=361998&view=diff
==============================================================================
--- llvm/trunk/utils/lit/tests/shtest-timeout.py (original)
+++ llvm/trunk/utils/lit/tests/shtest-timeout.py Wed May 29 11:07:39 2019
@@ -1,9 +1,7 @@
# REQUIRES: python-psutil
# llvm.org/PR33944
-# This should be system-windows as windows does not cover all cases, but
-# apparently neither does system-windows
-# UNSUPPORTED: windows
+# UNSUPPORTED: system-windows
# FIXME: This test is fragile because it relies on time which can
# be affected by system performance. In particular we are currently
More information about the llvm-commits
mailing list