[llvm-branch-commits] [llvm-branch] r367993 - Merge r367730 for PR42812
Hans Wennborg via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Tue Aug 6 01:18:29 PDT 2019
Author: hans
Date: Tue Aug 6 01:18:29 2019
New Revision: 367993
URL: http://llvm.org/viewvc/llvm-project?rev=367993&view=rev
Log:
Merge r367730 for PR42812
> [lit] Fix 42812: lit test suite can no longer be run stand-alone
>
> Summary:
> This change updates the lit.cfg file to use llvm_config when it is available, but when it is not, it directly modifies the config object. This makes it possible to run the lit tests standalone without having built llvm (as long as the correct binaries are present in the path such as FileCheck and not).
>
> Because the lit tests don't take a hard dependency on llvm_config, some features such as system-windows have to have definitions in lit's cfg file as well. This is a potential issue as the os features sometimes change names (for example, we went from windows to system-windows, etc.). This can cause drift between lit's tests and the rest of the llvm tests.
>
> Reviewers: probinson, mgorny
>
> Reviewed By: mgorny
>
> Subscribers: delcypher, llvm-commits, asmith
>
> Tags: #llvm
>
> Differential Revision: https://reviews.llvm.org/D65674
Modified:
llvm/branches/release_90/utils/lit/tests/lit.cfg
Modified: llvm/branches/release_90/utils/lit/tests/lit.cfg
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/release_90/utils/lit/tests/lit.cfg?rev=367993&r1=367992&r2=367993&view=diff
==============================================================================
--- llvm/branches/release_90/utils/lit/tests/lit.cfg (original)
+++ llvm/branches/release_90/utils/lit/tests/lit.cfg Tue Aug 6 01:18:29 2019
@@ -35,9 +35,13 @@ else:
lit_path = os.path.join(config.test_source_root, '..')
# Required because some tests import the lit module
-llvm_config.with_environment('PYTHONPATH', lit_path, append_path=True)
+if llvm_config:
+ llvm_config.with_environment('PYTHONPATH', lit_path, append_path=True)
+else:
+ config.environment['PYTHONPATH'] = os.pathsep.join([lit_path])
# Add llvm and lit tools directories if this config is being loaded indirectly.
+# In this case, we can also expect llvm_config to have been imported correctly.
for attribute in ('llvm_tools_dir', 'lit_tools_dir'):
directory = getattr(config, attribute, None)
if directory:
@@ -63,3 +67,10 @@ try:
except ImportError:
lit_config.warning('Could not import psutil. Some tests will be skipped and'
' the --timeout command line argument will not work.')
+
+# When running the lit tests standalone, we want to define the same features
+# that the llvm_config defines. This means that the 'system-windows' feature
+# (and any others) need to match the names in llvm_config for consistency
+if not llvm_config:
+ if sys.platform.startswith('win') or sys.platform.startswith('cygwin'):
+ config.available_features.add('system-windows')
More information about the llvm-branch-commits
mailing list