forked from OSchip/llvm-project
[sanitizer] Support check-asan on Android
This patch enabled asan tests from sanitizer_common. llvm-svn: 313444
This commit is contained in:
parent
0dc3ef3734
commit
cd2d9a6b98
|
@ -9,6 +9,7 @@
|
|||
// lit doesn't set ASAN_OPTIONS anyway.
|
||||
// RUN: not %run %t 2>&1 | FileCheck %s
|
||||
|
||||
// Android runs with abort_on_error=0
|
||||
// UNSUPPORTED: android
|
||||
|
||||
#include <stdlib.h>
|
||||
|
|
|
@ -4,7 +4,7 @@ set(SANITIZER_COMMON_TEST_DEPS ${SANITIZER_COMMON_LIT_TEST_DEPS})
|
|||
set(SANITIZER_COMMON_TESTSUITES)
|
||||
|
||||
set(SUPPORTED_TOOLS)
|
||||
if(CMAKE_SYSTEM_NAME MATCHES "Darwin|Linux|FreeBSD|NetBSD" AND NOT ANDROID)
|
||||
if(CMAKE_SYSTEM_NAME MATCHES "Darwin|Linux|FreeBSD|NetBSD")
|
||||
list(APPEND SUPPORTED_TOOLS asan)
|
||||
endif()
|
||||
if(CMAKE_SYSTEM_NAME MATCHES "Linux" AND NOT ANDROID)
|
||||
|
@ -43,8 +43,11 @@ if(COMPILER_RT_INCLUDE_TESTS)
|
|||
configure_lit_site_cfg(
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/Unit/lit.site.cfg.in
|
||||
${CMAKE_CURRENT_BINARY_DIR}/Unit/lit.site.cfg)
|
||||
list(APPEND SANITIZER_COMMON_TESTSUITES ${CMAKE_CURRENT_BINARY_DIR}/Unit)
|
||||
list(APPEND SANITIZER_COMMON_TEST_DEPS SanitizerUnitTests)
|
||||
# FIXME: support unit test in the android test runner
|
||||
if (NOT ANDROID)
|
||||
list(APPEND SANITIZER_COMMON_TESTSUITES ${CMAKE_CURRENT_BINARY_DIR}/Unit)
|
||||
list(APPEND SANITIZER_COMMON_TEST_DEPS SanitizerUnitTests)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(SANITIZER_COMMON_TESTSUITES)
|
||||
|
|
|
@ -10,6 +10,9 @@
|
|||
// lit doesn't set options anyway.
|
||||
// RUN: not %run %t 2>&1
|
||||
|
||||
// Android needs abort_on_error=0
|
||||
// UNSUPPORTED: android
|
||||
|
||||
namespace __sanitizer {
|
||||
void Die();
|
||||
}
|
||||
|
|
|
@ -1,6 +1,9 @@
|
|||
// RUN: %clang %s -o %t && %run %t
|
||||
// Verify that even if iconv returned -1
|
||||
// we still treat the initialized part of outbuf as properly initialized.
|
||||
|
||||
// UNSUPPORTED: android
|
||||
|
||||
#include <iconv.h>
|
||||
#include <assert.h>
|
||||
#include <stdio.h>
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
// RUN: %clangxx -O0 %s -o %t && %run %t
|
||||
|
||||
// UNSUPPORTED: android
|
||||
|
||||
#include <assert.h>
|
||||
#include <signal.h>
|
||||
#include <stdio.h>
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
// RUN: %clangxx -O2 %s -o %t && %run %t 2>&1 | FileCheck %s
|
||||
|
||||
// XFAIL: android
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
// getauxval() used instead of sysconf() in GetPageSize() is defined starting
|
||||
|
|
|
@ -1,8 +1,10 @@
|
|||
// RUN: %clangxx -DSHARED %s -shared -o %T/get_module_and_offset_for_pc.so -fPIC
|
||||
// RUN: %clangxx -DSO_DIR=\"%T\" -O0 %s -ldl -o %t
|
||||
// RUN: %run %t 2>&1 | FileCheck %s
|
||||
|
||||
// UNSUPPORTED: i386-darwin
|
||||
//
|
||||
// XFAIL: android
|
||||
|
||||
// Tests __sanitizer_get_module_and_offset_for_pc.
|
||||
|
||||
#include <assert.h>
|
||||
|
|
|
@ -34,6 +34,8 @@
|
|||
// RUN: %env_tool_opts=include_if_exists='"%t.options-not-found.%b"' %run %t 2>&1 | tee %t.out
|
||||
// RUN: FileCheck %s --check-prefix=CHECK-WITHOUT-HELP --check-prefix=CHECK-FOUND < %t.out
|
||||
|
||||
// Android tests run on remote device so includes will not work.
|
||||
// UNSUPPORTED: android
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
// RUN: %clangxx -O0 %s -o %t && %env_tool_opts=stack_trace_format=DEFAULT %run %t 2>&1 | FileCheck %s
|
||||
// RUN: %clangxx -O3 %s -o %t && %env_tool_opts=stack_trace_format=DEFAULT %run %t 2>&1 | FileCheck %s
|
||||
// RUN: %env_tool_opts=stack_trace_format='"frame:%n lineno:%l"' %run %t 2>&1 | FileCheck %s --check-prefix=CUSTOM
|
||||
// RUN: %env_tool_opts=stack_trace_format=frame%n_lineno%l %run %t 2>&1 | FileCheck %s --check-prefix=CUSTOM
|
||||
// RUN: %env_tool_opts=symbolize_inline_frames=false:stack_trace_format=DEFAULT %run %t 2>&1 | FileCheck %s --check-prefix=NOINLINE
|
||||
|
||||
// UNSUPPORTED: darwin
|
||||
|
@ -19,8 +19,8 @@ int main() {
|
|||
// CHECK: {{ #1 0x.* in FooBarBaz(\(\))? .*}}print-stack-trace.cc:[[@LINE-8]]
|
||||
// CHECK: {{ #2 0x.* in main.*}}print-stack-trace.cc:[[@LINE-5]]
|
||||
|
||||
// CUSTOM: frame:1 lineno:[[@LINE-11]]
|
||||
// CUSTOM: frame:2 lineno:[[@LINE-8]]
|
||||
// CUSTOM: frame1_lineno[[@LINE-11]]
|
||||
// CUSTOM: frame2_lineno[[@LINE-8]]
|
||||
|
||||
// NOINLINE: #0 0x{{.*}} in __sanitizer_print_stack_trace
|
||||
// NOINLINE: #1 0x{{.*}} in main{{.*}}print-stack-trace.cc:[[@LINE-15]]
|
||||
|
|
|
@ -36,6 +36,12 @@ if config.host_os == 'Darwin':
|
|||
# On Darwin, we default to `abort_on_error=1`, which would make tests run
|
||||
# much slower. Let's override this and run lit tests with 'abort_on_error=0'.
|
||||
default_tool_options += ['abort_on_error=0']
|
||||
elif config.android:
|
||||
# The same as on Darwin, we default to "abort_on_error=1" which slows down
|
||||
# testing. Also, all existing tests are using "not" instead of "not --crash"
|
||||
# which does not work for abort()-terminated programs.
|
||||
default_tool_options += ['abort_on_error=0']
|
||||
|
||||
default_tool_options_str = ':'.join(default_tool_options)
|
||||
if default_tool_options_str:
|
||||
config.environment[tool_options] = default_tool_options_str
|
||||
|
@ -45,7 +51,7 @@ clang_cflags = config.debug_info_flags + tool_cflags + [config.target_cflags]
|
|||
clang_cxxflags = config.cxx_mode_flags + clang_cflags
|
||||
|
||||
def build_invocation(compile_flags):
|
||||
return " " + " ".join([config.clang] + compile_flags) + " "
|
||||
return " " + " ".join([config.compile_wrapper, config.clang] + compile_flags) + " "
|
||||
|
||||
config.substitutions.append( ("%clang ", build_invocation(clang_cflags)) )
|
||||
config.substitutions.append( ("%clangxx ", build_invocation(clang_cxxflags)) )
|
||||
|
|
Loading…
Reference in New Issue