[PATCH] D59953: Add .py extension to clang-tools-extra lit cfg files

2019-03-28 Thread Phabricator via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL357231: Add .py extension to clang-tools-extra lit cfg files 
(authored by nico, committed by ).
Herald added subscribers: llvm-commits, mstorsjo.
Herald added a project: LLVM.

Changed prior to commit:
  https://reviews.llvm.org/D59953?vs=192698=192768#toc

Repository:
  rL LLVM

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D59953/new/

https://reviews.llvm.org/D59953

Files:
  clang-tools-extra/trunk/test/CMakeLists.txt
  clang-tools-extra/trunk/test/Unit/lit.cfg
  clang-tools-extra/trunk/test/Unit/lit.cfg.py
  clang-tools-extra/trunk/test/Unit/lit.site.cfg.in
  clang-tools-extra/trunk/test/Unit/lit.site.cfg.py.in
  clang-tools-extra/trunk/test/lit.cfg
  clang-tools-extra/trunk/test/lit.cfg.py
  clang-tools-extra/trunk/test/lit.site.cfg.in
  clang-tools-extra/trunk/test/lit.site.cfg.py.in

Index: clang-tools-extra/trunk/test/lit.site.cfg.py.in
===
--- clang-tools-extra/trunk/test/lit.site.cfg.py.in
+++ clang-tools-extra/trunk/test/lit.site.cfg.py.in
@@ -0,0 +1,31 @@
+@LIT_SITE_CFG_IN_HEADER@
+
+import sys
+
+config.llvm_tools_dir = "@LLVM_TOOLS_DIR@"
+config.llvm_libs_dir = "@LLVM_LIBS_DIR@"
+config.lit_tools_dir = "@LLVM_LIT_TOOLS_DIR@"
+config.clang_tools_binary_dir = "@CLANG_TOOLS_BINARY_DIR@"
+config.clang_tools_dir = "@CLANG_TOOLS_DIR@"
+config.clang_libs_dir = "@SHLIBDIR@"
+config.python_executable = "@PYTHON_EXECUTABLE@"
+config.target_triple = "@TARGET_TRIPLE@"
+config.clang_staticanalyzer = @CLANG_ENABLE_STATIC_ANALYZER@
+config.clangd_xpc_support = @CLANGD_BUILD_XPC_SUPPORT@
+
+# 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.clang_tools_dir = config.clang_tools_dir % lit_config.params
+config.llvm_tools_dir = config.llvm_tools_dir % lit_config.params
+config.llvm_libs_dir = config.llvm_libs_dir % lit_config.params
+except KeyError:
+e = sys.exc_info()[1]
+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, "@CLANG_TOOLS_SOURCE_DIR@/test/lit.cfg.py")
Index: clang-tools-extra/trunk/test/Unit/lit.site.cfg.py.in
===
--- clang-tools-extra/trunk/test/Unit/lit.site.cfg.py.in
+++ clang-tools-extra/trunk/test/Unit/lit.site.cfg.py.in
@@ -0,0 +1,9 @@
+@LIT_SITE_CFG_IN_HEADER@
+
+config.extra_tools_obj_dir = "@CLANG_TOOLS_BINARY_DIR@/unittests"
+config.extra_tools_src_dir = "@CLANG_TOOLS_SOURCE_DIR@/unittests"
+config.llvm_libs_dir = "@LLVM_LIBS_DIR@"
+config.shlibdir = "@SHLIBDIR@"
+config.target_triple = "@TARGET_TRIPLE@"
+
+lit_config.load_config(config, "@CLANG_TOOLS_SOURCE_DIR@/test/Unit/lit.cfg.py")
Index: clang-tools-extra/trunk/test/Unit/lit.cfg.py
===
--- clang-tools-extra/trunk/test/Unit/lit.cfg.py
+++ clang-tools-extra/trunk/test/Unit/lit.cfg.py
@@ -0,0 +1,37 @@
+# -*- Python -*-
+
+import platform
+
+import lit.formats
+
+config.name = "Extra Tools Unit Tests"
+config.suffixes = [] # Seems not to matter for google tests?
+
+# Test Source and Exec root dirs both point to the same directory where google
+# test binaries are built.
+
+config.test_source_root = config.extra_tools_obj_dir
+config.test_exec_root = config.test_source_root
+
+# All GoogleTests are named to have 'Tests' as their suffix. The '.' option is
+# a special value for GoogleTest indicating that it should look through the
+# entire testsuite recursively for tests (alternatively, one could provide a
+# ;-separated list of subdirectories).
+config.test_format = lit.formats.GoogleTest('.', 'Tests')
+
+if platform.system() == 'Darwin':
+shlibpath_var = 'DYLD_LIBRARY_PATH'
+elif platform.system() == 'Windows':
+shlibpath_var = 'PATH'
+else:
+shlibpath_var = 'LD_LIBRARY_PATH'
+
+# Point the dynamic loader at dynamic libraries in 'lib'.
+shlibpath = os.path.pathsep.join((config.shlibdir, config.llvm_libs_dir,
+ config.environment.get(shlibpath_var,'')))
+
+# Win32 seeks DLLs along %PATH%.
+if sys.platform in ['win32', 'cygwin'] and os.path.isdir(config.shlibdir):
+shlibpath = os.path.pathsep.join((config.shlibdir, shlibpath))
+
+config.environment[shlibpath_var] = shlibpath
Index: clang-tools-extra/trunk/test/lit.cfg.py
===
--- clang-tools-extra/trunk/test/lit.cfg.py
+++ clang-tools-extra/trunk/test/lit.cfg.py
@@ -0,0 +1,145 @@
+# -*- Python -*-
+
+import os
+import platform
+import re
+import subprocess
+
+import lit.formats
+import lit.util
+
+# Configuration file for the 'lit' test runner.
+
+# name: The name of this 

[PATCH] D59953: Add .py extension to clang-tools-extra lit cfg files

2019-03-28 Thread Nico Weber via Phabricator via cfe-commits
thakis updated this revision to Diff 192698.
thakis retitled this revision from "Rename clang-tools-extra lit cfg files to 
lit.site.cfg.py" to "Add .py extension to clang-tools-extra lit cfg files".
thakis added a comment.

Ok, ptal.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D59953/new/

https://reviews.llvm.org/D59953

Files:
  clang-tools-extra/test/CMakeLists.txt
  clang-tools-extra/test/Unit/lit.cfg
  clang-tools-extra/test/Unit/lit.cfg.py
  clang-tools-extra/test/Unit/lit.site.cfg.in
  clang-tools-extra/test/Unit/lit.site.cfg.py.in
  clang-tools-extra/test/lit.cfg
  clang-tools-extra/test/lit.cfg.py
  clang-tools-extra/test/lit.site.cfg.in
  clang-tools-extra/test/lit.site.cfg.py.in


Index: clang-tools-extra/test/lit.site.cfg.py.in
===
--- clang-tools-extra/test/lit.site.cfg.py.in
+++ clang-tools-extra/test/lit.site.cfg.py.in
@@ -28,4 +28,4 @@
 lit.llvm.initialize(lit_config, config)
 
 # Let the main config do the real work.
-lit_config.load_config(config, "@CLANG_TOOLS_SOURCE_DIR@/test/lit.cfg")
+lit_config.load_config(config, "@CLANG_TOOLS_SOURCE_DIR@/test/lit.cfg.py")
Index: clang-tools-extra/test/Unit/lit.site.cfg.py.in
===
--- clang-tools-extra/test/Unit/lit.site.cfg.py.in
+++ clang-tools-extra/test/Unit/lit.site.cfg.py.in
@@ -6,4 +6,4 @@
 config.shlibdir = "@SHLIBDIR@"
 config.target_triple = "@TARGET_TRIPLE@"
 
-lit_config.load_config(config, "@CLANG_TOOLS_SOURCE_DIR@/test/Unit/lit.cfg")
+lit_config.load_config(config, "@CLANG_TOOLS_SOURCE_DIR@/test/Unit/lit.cfg.py")
Index: clang-tools-extra/test/CMakeLists.txt
===
--- clang-tools-extra/test/CMakeLists.txt
+++ clang-tools-extra/test/CMakeLists.txt
@@ -20,13 +20,17 @@
   CLANGD_BUILD_XPC_SUPPORT)
 
 configure_lit_site_cfg(
-  ${CMAKE_CURRENT_SOURCE_DIR}/lit.site.cfg.in
-  ${CMAKE_CURRENT_BINARY_DIR}/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_lit_site_cfg(
-  ${CMAKE_CURRENT_SOURCE_DIR}/Unit/lit.site.cfg.in
-  ${CMAKE_CURRENT_BINARY_DIR}/Unit/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
   )
 
 option(CLANG_TOOLS_TEST_USE_VG "Run Clang tools' tests under Valgrind" OFF)


Index: clang-tools-extra/test/lit.site.cfg.py.in
===
--- clang-tools-extra/test/lit.site.cfg.py.in
+++ clang-tools-extra/test/lit.site.cfg.py.in
@@ -28,4 +28,4 @@
 lit.llvm.initialize(lit_config, config)
 
 # Let the main config do the real work.
-lit_config.load_config(config, "@CLANG_TOOLS_SOURCE_DIR@/test/lit.cfg")
+lit_config.load_config(config, "@CLANG_TOOLS_SOURCE_DIR@/test/lit.cfg.py")
Index: clang-tools-extra/test/Unit/lit.site.cfg.py.in
===
--- clang-tools-extra/test/Unit/lit.site.cfg.py.in
+++ clang-tools-extra/test/Unit/lit.site.cfg.py.in
@@ -6,4 +6,4 @@
 config.shlibdir = "@SHLIBDIR@"
 config.target_triple = "@TARGET_TRIPLE@"
 
-lit_config.load_config(config, "@CLANG_TOOLS_SOURCE_DIR@/test/Unit/lit.cfg")
+lit_config.load_config(config, "@CLANG_TOOLS_SOURCE_DIR@/test/Unit/lit.cfg.py")
Index: clang-tools-extra/test/CMakeLists.txt
===
--- clang-tools-extra/test/CMakeLists.txt
+++ clang-tools-extra/test/CMakeLists.txt
@@ -20,13 +20,17 @@
   CLANGD_BUILD_XPC_SUPPORT)
 
 configure_lit_site_cfg(
-  ${CMAKE_CURRENT_SOURCE_DIR}/lit.site.cfg.in
-  ${CMAKE_CURRENT_BINARY_DIR}/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_lit_site_cfg(
-  ${CMAKE_CURRENT_SOURCE_DIR}/Unit/lit.site.cfg.in
-  ${CMAKE_CURRENT_BINARY_DIR}/Unit/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
   )
 
 option(CLANG_TOOLS_TEST_USE_VG "Run Clang tools' tests under Valgrind" OFF)
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits