summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorGreg Fitzgerald <gregf@codeaurora.org>2014-04-30 21:32:30 +0000
committerGreg Fitzgerald <gregf@codeaurora.org>2014-04-30 21:32:30 +0000
commit16bae2463f98c0e3988b3bd94fce5012ae6a68ba (patch)
tree9d37d5fcd1e7131a14f52a48e999d89d216a8778 /test
parentcbb872db8f91cb20723f09f6fed8099d9f00a0d8 (diff)
Allow any test to be executed via a %run command.
Configure %run with COMPILER_RT_EMULATOR: $ cmake -DCOMPILER_RT_EMULATOR="qemu-arm -L $SYSROOT" git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@207707 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test')
-rw-r--r--test/asan/CMakeLists.txt20
-rw-r--r--test/asan/lit.cfg2
-rw-r--r--test/asan/lit.site.cfg.in1
-rw-r--r--test/lit.common.cfg3
-rw-r--r--test/lit.common.configured.in2
-rw-r--r--test/lsan/lit.common.cfg2
-rw-r--r--test/profile/instrprof-basic.c2
-rw-r--r--test/profile/lit.cfg12
-rw-r--r--test/ubsan/lit.common.cfg2
9 files changed, 35 insertions, 11 deletions
diff --git a/test/asan/CMakeLists.txt b/test/asan/CMakeLists.txt
index 0dd6f816a..2080a72cc 100644
--- a/test/asan/CMakeLists.txt
+++ b/test/asan/CMakeLists.txt
@@ -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(
diff --git a/test/asan/lit.cfg b/test/asan/lit.cfg
index 7f47b43ed..c96cfaac3 100644
--- a/test/asan/lit.cfg
+++ b/test/asan/lit.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 "
diff --git a/test/asan/lit.site.cfg.in b/test/asan/lit.site.cfg.in
index 76e0c5542..04a9a49be 100644
--- a/test/asan/lit.site.cfg.in
+++ b/test/asan/lit.site.cfg.in
@@ -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@"
diff --git a/test/lit.common.cfg b/test/lit.common.cfg
index 078ab684a..054d32cde 100644
--- a/test/lit.common.cfg
+++ b/test/lit.common.cfg
@@ -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:
diff --git a/test/lit.common.configured.in b/test/lit.common.configured.in
index 7a9dd29b2..10eb7b5e1 100644
--- a/test/lit.common.configured.in
+++ b/test/lit.common.configured.in
@@ -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.
diff --git a/test/lsan/lit.common.cfg b/test/lsan/lit.common.cfg
index f46151515..7411d7a98 100644
--- a/test/lsan/lit.common.cfg
+++ b/test/lsan/lit.common.cfg
@@ -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 "
diff --git a/test/profile/instrprof-basic.c b/test/profile/instrprof-basic.c
index b84c96dab..3db083140 100644
--- a/test/profile/instrprof-basic.c
+++ b/test/profile/instrprof-basic.c
@@ -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
diff --git a/test/profile/lit.cfg b/test/profile/lit.cfg
index dcfd36e6f..da09f1a61 100644
--- a/test/profile/lit.cfg
+++ b/test/profile/lit.cfg
@@ -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']:
diff --git a/test/ubsan/lit.common.cfg b/test/ubsan/lit.common.cfg
index 1e32653fe..61eec0341 100644
--- a/test/ubsan/lit.common.cfg
+++ b/test/ubsan/lit.common.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 "