[compiler-rt] r205263 - InstrProf: lit.cfg magic for running tests from source
Duncan P. N. Exon Smith
dexonsmith at apple.com
Mon Mar 31 16:14:28 PDT 2014
Author: dexonsmith
Date: Mon Mar 31 18:14:28 2014
New Revision: 205263
URL: http://llvm.org/viewvc/llvm-project?rev=205263&view=rev
Log:
InstrProf: lit.cfg magic for running tests from source
Implement magic in compiler-rt to enable llvm-lit to be invoked on the
source tree in lib/profile. This relies on a paired commit in the llvm
tree that exposes a new built-in parameter.
<rdar://problem/16458307>
Modified:
compiler-rt/trunk/test/profile/CMakeLists.txt
compiler-rt/trunk/test/profile/lit.cfg
compiler-rt/trunk/test/profile/lit.site.cfg.in
Modified: compiler-rt/trunk/test/profile/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/profile/CMakeLists.txt?rev=205263&r1=205262&r2=205263&view=diff
==============================================================================
--- compiler-rt/trunk/test/profile/CMakeLists.txt (original)
+++ compiler-rt/trunk/test/profile/CMakeLists.txt Mon Mar 31 18:14:28 2014
@@ -1,4 +1,5 @@
set(PROFILE_LIT_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR})
+set(PROFILE_LIT_BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR})
set(PROFILE_TEST_DEPS)
if(NOT COMPILER_RT_STANDALONE_BUILD)
Modified: compiler-rt/trunk/test/profile/lit.cfg
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/profile/lit.cfg?rev=205263&r1=205262&r2=205263&view=diff
==============================================================================
--- compiler-rt/trunk/test/profile/lit.cfg (original)
+++ compiler-rt/trunk/test/profile/lit.cfg Mon Mar 31 18:14:28 2014
@@ -8,6 +8,22 @@ config.name = 'Profile'
# Setup source root.
config.test_source_root = os.path.dirname(__file__)
+# Setup executable root.
+if hasattr(config, 'profile_lit_binary_dir') and \
+ config.profile_lit_binary_dir is not None:
+ config.test_exec_root = config.profile_lit_binary_dir
+
+# If the above check didn't work, we're probably in the source tree. Use some
+# magic to re-execute from the build tree.
+if config.test_exec_root is None:
+ # The magic relies on knowing compilerrt_site_basedir.
+ compilerrt_basedir = lit_config.params.get('compilerrt_site_basedir', None)
+ if compilerrt_basedir:
+ site_cfg = os.path.join(compilerrt_basedir, 'profile', 'lit.site.cfg')
+ if os.path.exists(site_cfg):
+ lit_config.load_config(config, site_cfg)
+ raise SystemExit
+
# Test suffixes.
config.suffixes = ['.c', '.cc', '.cpp', '.m', '.mm', '.ll', '.test']
Modified: compiler-rt/trunk/test/profile/lit.site.cfg.in
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/profile/lit.site.cfg.in?rev=205263&r1=205262&r2=205263&view=diff
==============================================================================
--- compiler-rt/trunk/test/profile/lit.site.cfg.in (original)
+++ compiler-rt/trunk/test/profile/lit.site.cfg.in Mon Mar 31 18:14:28 2014
@@ -1,6 +1,9 @@
## Autogenerated by LLVM/Clang configuration.
# Do not edit!
+# Tool-specific config options.
+config.profile_lit_binary_dir = "@PROFILE_LIT_BINARY_DIR@"
+
# Load common config for all compiler-rt lit tests.
lit_config.load_config(config, "@COMPILER_RT_BINARY_DIR@/test/lit.common.configured")
More information about the llvm-commits
mailing list