forked from OSchip/llvm-project
Allow any test to be executed via a %run command.
Configure %run with COMPILER_RT_EMULATOR: $ cmake -DCOMPILER_RT_EMULATOR="qemu-arm -L $SYSROOT" llvm-svn: 207707
This commit is contained in:
parent
cbb9791e3b
commit
6759fd9fdd
|
@ -9,7 +9,7 @@ if(CAN_TARGET_arm_android)
|
|||
get_filename_component(ASAN_TEST_LLVM_TOOLS_DIR ${CMAKE_C_COMPILER} PATH)
|
||||
set(ASAN_TEST_CONFIG_SUFFIX "-arm-android")
|
||||
set(ASAN_TEST_BITS "32")
|
||||
get_target_flags_for_arch(arm_android ASAN_TEST_TARGET_CFLAGS)
|
||||
get_target_flags_for_arch(arm_android COMPILER_RT_TEST_COMPILER_CFLAGS)
|
||||
configure_lit_site_cfg(
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/lit.site.cfg.in
|
||||
${CMAKE_CURRENT_BINARY_DIR}/ARMAndroidConfig/lit.site.cfg
|
||||
|
@ -17,10 +17,24 @@ if(CAN_TARGET_arm_android)
|
|||
list(APPEND ASAN_TESTSUITES ${CMAKE_CURRENT_BINARY_DIR}/ARMAndroidConfig)
|
||||
endif()
|
||||
|
||||
if(CAN_TARGET_arm)
|
||||
# This is only true if we are cross-compiling.
|
||||
# Build all tests with host compiler and use host tools.
|
||||
set(ASAN_TEST_TARGET_CC ${COMPILER_RT_TEST_COMPILER})
|
||||
set(ASAN_TEST_CONFIG_SUFFIX "-arm-linux")
|
||||
set(ASAN_TEST_BITS "32")
|
||||
set(ASAN_TEST_DYNAMIC False)
|
||||
configure_lit_site_cfg(
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/lit.site.cfg.in
|
||||
${CMAKE_CURRENT_BINARY_DIR}/ARMLinuxConfig/lit.site.cfg
|
||||
)
|
||||
list(APPEND ASAN_TESTSUITES ${CMAKE_CURRENT_BINARY_DIR}/ARMLinuxConfig)
|
||||
endif()
|
||||
|
||||
if(CAN_TARGET_x86_64 OR CAN_TARGET_powerpc64)
|
||||
set(ASAN_TEST_CONFIG_SUFFIX "64")
|
||||
set(ASAN_TEST_BITS "64")
|
||||
set(ASAN_TEST_TARGET_CFLAGS ${TARGET_64_BIT_CFLAGS})
|
||||
set(COMPILER_RT_TEST_COMPILER_CFLAGS ${TARGET_64_BIT_CFLAGS})
|
||||
set(ASAN_TEST_DYNAMIC False)
|
||||
configure_lit_site_cfg(
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/lit.site.cfg.in
|
||||
|
@ -40,7 +54,7 @@ endif()
|
|||
if(CAN_TARGET_i386)
|
||||
set(ASAN_TEST_CONFIG_SUFFIX "32")
|
||||
set(ASAN_TEST_BITS "32")
|
||||
set(ASAN_TEST_TARGET_CFLAGS ${TARGET_32_BIT_CFLAGS})
|
||||
set(COMPILER_RT_TEST_COMPILER_CFLAGS ${TARGET_32_BIT_CFLAGS})
|
||||
set(ASAN_TEST_DYNAMIC False)
|
||||
set(ASAN_TEST_TARGET_ARCH "i386")
|
||||
configure_lit_site_cfg(
|
||||
|
|
|
@ -4,7 +4,7 @@ import os
|
|||
|
||||
def get_required_attr(config, attr_name):
|
||||
attr_value = getattr(config, attr_name, None)
|
||||
if not attr_value:
|
||||
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 "
|
||||
|
|
|
@ -4,7 +4,6 @@
|
|||
# Tool-specific config options.
|
||||
config.name_suffix = "@ASAN_TEST_CONFIG_SUFFIX@"
|
||||
config.asan_lit_source_dir = "@ASAN_LIT_SOURCE_DIR@"
|
||||
config.target_cflags = "@ASAN_TEST_TARGET_CFLAGS@"
|
||||
config.clang = "@ASAN_TEST_TARGET_CC@"
|
||||
config.llvm_tools_dir = "@ASAN_TEST_LLVM_TOOLS_DIR@"
|
||||
config.bits = "@ASAN_TEST_BITS@"
|
||||
|
|
|
@ -56,6 +56,9 @@ config.substitutions.append(
|
|||
(' clang', """\n\n*** Do not use 'clangXXX' in tests,
|
||||
instead define '%clangXXX' substitution in lit config. ***\n\n""") )
|
||||
|
||||
# Allow tests to be executed on a simulator or remotely.
|
||||
config.substitutions.append( ('%run', config.emulator) )
|
||||
|
||||
# Add supported compiler_rt architectures to a list of available features.
|
||||
compiler_rt_arch = getattr(config, 'compiler_rt_arch', None)
|
||||
if compiler_rt_arch:
|
||||
|
|
|
@ -8,6 +8,7 @@ def set_default(attr, value):
|
|||
|
||||
# Generic config options for all compiler-rt lit tests.
|
||||
set_default("target_triple", "@TARGET_TRIPLE@")
|
||||
set_default("target_cflags", "@COMPILER_RT_TEST_COMPILER_FLAGS@")
|
||||
set_default("host_arch", "@HOST_ARCH@")
|
||||
set_default("target_arch", "@HOST_ARCH@")
|
||||
set_default("host_os", "@HOST_OS@")
|
||||
|
@ -22,6 +23,7 @@ set_default("compiler_rt_arch", "@COMPILER_RT_SUPPORTED_ARCH@")
|
|||
set_default("python_executable", "@PYTHON_EXECUTABLE@")
|
||||
set_default("compiler_rt_debug", @COMPILER_RT_DEBUG_PYBOOL@)
|
||||
set_default("compiler_rt_libdir", "@COMPILER_RT_LIBRARY_OUTPUT_DIR@")
|
||||
set_default("emulator", "@COMPILER_RT_EMULATOR@")
|
||||
|
||||
# LLVM tools dir can be passed in lit parameters, so try to
|
||||
# apply substitution.
|
||||
|
|
|
@ -6,7 +6,7 @@ import os
|
|||
|
||||
def get_required_attr(config, attr_name):
|
||||
attr_value = getattr(config, attr_name, None)
|
||||
if not attr_value:
|
||||
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 "
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
// RUN: %clang_profgen -o %t -O3 %s
|
||||
// RUN: env LLVM_PROFILE_FILE=%t.profraw %t
|
||||
// RUN: env LLVM_PROFILE_FILE=%t.profraw %run %t
|
||||
// RUN: llvm-profdata merge -o %t.profdata %t.profraw
|
||||
// RUN: %clang_profuse=%t.profdata -o - -S -emit-llvm %s | FileCheck %s
|
||||
|
||||
|
|
|
@ -27,10 +27,16 @@ if config.test_exec_root is None:
|
|||
# Test suffixes.
|
||||
config.suffixes = ['.c', '.cc', '.cpp', '.m', '.mm', '.ll', '.test']
|
||||
|
||||
# Clang flags.
|
||||
clang_cflags = [config.target_cflags]
|
||||
|
||||
def build_invocation(compile_flags):
|
||||
return " " + " ".join([config.clang] + compile_flags) + " "
|
||||
|
||||
# Add clang substitutions.
|
||||
config.substitutions.append( ("%clang ", config.clang + " ") )
|
||||
config.substitutions.append( ("%clang_profgen ", config.clang + " -fprofile-instr-generate ") )
|
||||
config.substitutions.append( ("%clang_profuse=", config.clang + " -fprofile-instr-use=") )
|
||||
config.substitutions.append( ("%clang ", build_invocation([])) )
|
||||
config.substitutions.append( ("%clang_profgen ", build_invocation(clang_cflags) + " -fprofile-instr-generate ") )
|
||||
config.substitutions.append( ("%clang_profuse=", build_invocation(clang_cflags) + " -fprofile-instr-use=") )
|
||||
|
||||
# Profile tests are currently supported on Linux and Darwin only.
|
||||
if config.host_os not in ['Linux', 'Darwin']:
|
||||
|
|
|
@ -4,7 +4,7 @@ import os
|
|||
|
||||
def get_required_attr(config, attr_name):
|
||||
attr_value = getattr(config, attr_name, None)
|
||||
if not attr_value:
|
||||
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 "
|
||||
|
|
Loading…
Reference in New Issue