[compiler-rt] r261344 - [PGO] Enable profile-rt testing on all supported targets
Xinliang David Li via llvm-commits
llvm-commits at lists.llvm.org
Fri Feb 19 09:52:29 PST 2016
Author: davidxl
Date: Fri Feb 19 11:52:28 2016
New Revision: 261344
URL: http://llvm.org/viewvc/llvm-project?rev=261344&view=rev
Log:
[PGO] Enable profile-rt testing on all supported targets
Differential Revision: http://reviews.llvm.org/D17361
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=261344&r1=261343&r2=261344&view=diff
==============================================================================
--- compiler-rt/trunk/test/profile/CMakeLists.txt (original)
+++ compiler-rt/trunk/test/profile/CMakeLists.txt Fri Feb 19 11:52:28 2016
@@ -1,16 +1,35 @@
set(PROFILE_LIT_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR})
set(PROFILE_LIT_BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR})
+set(PROFILE_TESTSUITES)
set(PROFILE_TEST_DEPS ${SANITIZER_COMMON_LIT_TEST_DEPS})
if(NOT COMPILER_RT_STANDALONE_BUILD)
list(APPEND PROFILE_TEST_DEPS profile llvm-profdata)
endif()
-configure_lit_site_cfg(
- ${CMAKE_CURRENT_SOURCE_DIR}/lit.site.cfg.in
- ${CMAKE_CURRENT_BINARY_DIR}/lit.site.cfg
- )
+set(PROFILE_TEST_ARCH ${PROFILE_SUPPORTED_ARCH})
+if(APPLE)
+ darwin_filter_host_archs(PROFILE_SUPPORTED_ARCH PROFILE_TEST_ARCH)
+endif()
+
+foreach(arch ${PROFILE_TEST_ARCH})
+ set(PROFILE_TEST_TARGET_ARCH ${arch})
+ if(${arch} MATCHES "arm|aarch64")
+ # This is only true if we're cross-compiling.
+ set(PROFILE_TEST_TARGET_CFLAGS ${COMPILER_RT_TEST_COMPILER_CFLAGS})
+ else()
+ get_target_flags_for_arch(${arch} PROFILE_TEST_TARGET_CFLAGS)
+ string(REPLACE ";" " " PROFILE_TEST_TARGET_CFLAGS "${PROFILE_TEST_TARGET_CFLAGS}")
+ endif()
+ set(CONFIG_NAME Profile-${arch})
+ configure_lit_site_cfg(
+ ${CMAKE_CURRENT_SOURCE_DIR}/lit.site.cfg.in
+ ${CMAKE_CURRENT_BINARY_DIR}/${CONFIG_NAME}/lit.site.cfg
+ )
+ list(APPEND PROFILE_TESTSUITES ${CMAKE_CURRENT_BINARY_DIR}/${CONFIG_NAME})
+endforeach()
+
add_lit_testsuite(check-profile "Running the profile tests"
- ${CMAKE_CURRENT_BINARY_DIR}
+ ${PROFILE_TESTSUITES}
DEPENDS ${PROFILE_TEST_DEPS})
set_target_properties(check-profile PROPERTIES FOLDER "Profile tests")
Modified: compiler-rt/trunk/test/profile/lit.cfg
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/profile/lit.cfg?rev=261344&r1=261343&r2=261344&view=diff
==============================================================================
--- compiler-rt/trunk/test/profile/lit.cfg (original)
+++ compiler-rt/trunk/test/profile/lit.cfg Fri Feb 19 11:52:28 2016
@@ -2,8 +2,17 @@
import os
+def get_required_attr(config, attr_name):
+ attr_value = getattr(config, attr_name, None)
+ if attr_value == None:
+ lit_config.fatal(
+ "No attribute %r in test configuration! You may need to run "
+ "tests from your build directory or add this attribute "
+ "to lit.site.cfg " % attr_name)
+ return attr_value
+
# Setup config name.
-config.name = 'Profile'
+config.name = 'Profile-' + config.target_arch
# Setup source root.
config.test_source_root = os.path.dirname(__file__)
@@ -11,7 +20,7 @@ config.test_source_root = os.path.dirnam
# 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
+ config.test_exec_root = os.path.join(config.profile_lit_binary_dir, config.name)
# If the above check didn't work, we're probably in the source tree. Use some
# magic to re-execute from the build tree.
@@ -36,15 +45,20 @@ config.suffixes = ['.c', '.cc', '.cpp',
config.excludes = ['Inputs']
# Clang flags.
-clang_cflags = [config.target_cflags] + extra_linkflags
+target_cflags=[get_required_attr(config, "target_cflags")]
+clang_cflags = target_cflags + extra_linkflags
+clang_cxxflags = config.cxx_mode_flags + clang_cflags
def build_invocation(compile_flags):
return " " + " ".join([config.clang] + compile_flags) + " "
# Add clang substitutions.
config.substitutions.append( ("%clang ", build_invocation(clang_cflags)) )
+config.substitutions.append( ("%clangxx ", build_invocation(clang_cxxflags)) )
config.substitutions.append( ("%clang_profgen ", build_invocation(clang_cflags) + " -fprofile-instr-generate ") )
config.substitutions.append( ("%clang_profuse=", build_invocation(clang_cflags) + " -fprofile-instr-use=") )
+config.substitutions.append( ("%clangxx_profgen ", build_invocation(clang_cxxflags) + " -fprofile-instr-generate ") )
+config.substitutions.append( ("%clangxx_profuse=", build_invocation(clang_cxxflags) + " -fprofile-instr-use=") )
config.substitutions.append( ("%clang_profgen_gcc=", build_invocation(clang_cflags) + " -fprofile-generate=") )
config.substitutions.append( ("%clang_profuse_gcc=", build_invocation(clang_cflags) + " -fprofile-use=") )
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=261344&r1=261343&r2=261344&view=diff
==============================================================================
--- compiler-rt/trunk/test/profile/lit.site.cfg.in (original)
+++ compiler-rt/trunk/test/profile/lit.site.cfg.in Fri Feb 19 11:52:28 2016
@@ -3,6 +3,8 @@
# Tool-specific config options.
config.profile_lit_binary_dir = "@PROFILE_LIT_BINARY_DIR@"
+config.target_cflags = "@PROFILE_TEST_TARGET_CFLAGS@"
+config.target_arch = "@PROFILE_TEST_TARGET_ARCH@"
# 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