summaryrefslogtreecommitdiff
path: root/CMakeLists.txt
diff options
context:
space:
mode:
authorEvgeniy Stepanov <eugeni.stepanov@gmail.com>2014-02-14 09:22:10 +0000
committerEvgeniy Stepanov <eugeni.stepanov@gmail.com>2014-02-14 09:22:10 +0000
commit08c9d0bc3ac37d7d5def0318a1420e67cca53e41 (patch)
treed7a1020610e73102dc5e6342245e01fbb780c9db /CMakeLists.txt
parent53aa4fda49f94920139300227786ac47c393f1ce (diff)
[asan] Android test runner for ASan lit tests.
This change replaces 32- and 64- bit config.in-s with a single config template that is used to generate both 32 and 64 bits configs as well as the new arm-android config. Arm-android config is special because it can run tests on a remote device over adb (android debug bridge). We replace %clang with a script that run the compiler, upload the result to the device, and replaces it with another script. The second script runs the binary on the device and delivers stdout/stderr/exitcode back. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@201394 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r--CMakeLists.txt41
1 files changed, 24 insertions, 17 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 8f00eeaeb..55fe62f55 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -99,21 +99,25 @@ macro(test_target_arch arch)
endif()
endmacro()
-if("${LLVM_NATIVE_ARCH}" STREQUAL "X86")
- if (NOT MSVC)
- test_target_arch(x86_64 ${TARGET_64_BIT_CFLAGS})
+if(ANDROID_COMMON_FLAGS)
+ test_target_arch(arm_android "${ANDROID_COMMON_FLAGS}")
+else()
+ if("${LLVM_NATIVE_ARCH}" STREQUAL "X86")
+ if (NOT MSVC)
+ test_target_arch(x86_64 ${TARGET_64_BIT_CFLAGS})
+ endif()
+ test_target_arch(i386 ${TARGET_32_BIT_CFLAGS})
+ elseif("${LLVM_NATIVE_ARCH}" STREQUAL "PowerPC")
+ test_target_arch(powerpc64 ${TARGET_64_BIT_CFLAGS})
+ elseif("${LLVM_NATIVE_ARCH}" STREQUAL "ARM")
+ test_target_arch(arm "")
endif()
- test_target_arch(i386 ${TARGET_32_BIT_CFLAGS})
-elseif("${LLVM_NATIVE_ARCH}" STREQUAL "PowerPC")
- test_target_arch(powerpc64 ${TARGET_64_BIT_CFLAGS})
-elseif("${LLVM_NATIVE_ARCH}" STREQUAL "ARM")
- test_target_arch(arm "")
endif()
# We only support running instrumented tests when we're not cross compiling
-# and target a unix-like system. On Android we define the rules for building
-# unit tests, but don't execute them.
-if("${CMAKE_HOST_SYSTEM}" STREQUAL "${CMAKE_SYSTEM}" AND UNIX AND NOT ANDROID)
+# and target a unix-like system. We can run tests on Android even when we are
+# cross-compiling.
+if(("${CMAKE_HOST_SYSTEM}" STREQUAL "${CMAKE_SYSTEM}" AND UNIX) OR ANDROID)
option(COMPILER_RT_CAN_EXECUTE_TESTS "Can we execute instrumented tests" ON)
else()
option(COMPILER_RT_CAN_EXECUTE_TESTS "Can we execute instrumented tests" OFF)
@@ -230,12 +234,15 @@ filter_available_targets(SANITIZER_COMMON_SUPPORTED_ARCH
add_subdirectory(include)
-set(SANITIZER_COMMON_LIT_TEST_DEPS
- clang clang-headers FileCheck count not llvm-nm llvm-symbolizer
- compiler-rt-headers)
-# Check code style when running lit tests for sanitizers.
-if(UNIX)
- list(APPEND SANITIZER_COMMON_LIT_TEST_DEPS SanitizerLintCheck)
+# When ANDROID, we build tests with the host compiler (i.e. CMAKE_C_COMPILER),
+# and run tests with tools from the host toolchain.
+if (NOT ANDROID)
+ set(SANITIZER_COMMON_LIT_TEST_DEPS
+ clang clang-headers FileCheck count not llvm-nm llvm-symbolizer
+ compiler-rt-headers)
+ if(UNIX)
+ list(APPEND SANITIZER_COMMON_LIT_TEST_DEPS SanitizerLintCheck)
+ endif()
endif()
add_subdirectory(lib)