From cd51ffa29073a5388151cbbe6fd6a28b322892e4 Mon Sep 17 00:00:00 2001 From: Vitaly Buka Date: Thu, 20 Dec 2018 10:15:51 +0000 Subject: [PATCH] [asan] Fix and re-enable few test on Android llvm-svn: 349736 --- .../asan/TestCases/Linux/asan_rt_confict_test-2.cc | 5 ++--- .../test/asan/TestCases/Linux/local_alias.cc | 9 +++------ .../test/asan/TestCases/Linux/odr-violation.cc | 23 ++++++++++------------ .../test/asan/TestCases/Linux/odr-vtable.cc | 9 +++------ compiler-rt/test/asan/TestCases/Linux/odr_c_test.c | 8 +++----- .../test/asan/TestCases/Linux/preinit_test.cc | 7 ++----- 6 files changed, 23 insertions(+), 38 deletions(-) diff --git a/compiler-rt/test/asan/TestCases/Linux/asan_rt_confict_test-2.cc b/compiler-rt/test/asan/TestCases/Linux/asan_rt_confict_test-2.cc index 4c935e2..9d59992 100644 --- a/compiler-rt/test/asan/TestCases/Linux/asan_rt_confict_test-2.cc +++ b/compiler-rt/test/asan/TestCases/Linux/asan_rt_confict_test-2.cc @@ -1,12 +1,11 @@ // Test that mixed static/dynamic sanitization of program objects // is prohibited. // -// RUN: %clangxx_asan -DBUILD_SO=1 -fPIC -shared %s -o %t.so -// RUN: %clangxx_asan_static %s %t.so -o %t +// RUN: %clangxx_asan -DBUILD_SO=1 -fPIC -shared %s -o %dynamiclib +// RUN: %clangxx_asan_static %s %ld_flags_rpath_exe -o %t // RUN: not %run %t 2>&1 | FileCheck %s // REQUIRES: asan-dynamic-runtime -// XFAIL: android #if BUILD_SO char dummy; diff --git a/compiler-rt/test/asan/TestCases/Linux/local_alias.cc b/compiler-rt/test/asan/TestCases/Linux/local_alias.cc index 635e30b..a8b3d75 100644 --- a/compiler-rt/test/asan/TestCases/Linux/local_alias.cc +++ b/compiler-rt/test/asan/TestCases/Linux/local_alias.cc @@ -4,13 +4,10 @@ // false positive global-buffer-overflow due to sanitized library poisons // globals from non-sanitized one. // -// FIXME: https://github.com/google/sanitizers/issues/316 -// XFAIL: android -// -// RUN: %clangxx_asan -DBUILD_INSTRUMENTED_DSO=1 -fPIC -shared -mllvm -asan-use-private-alias %s -o %t-INSTRUMENTED-SO.so -// RUN: %clangxx -DBUILD_UNINSTRUMENTED_DSO=1 -fPIC -shared %s -o %t-UNINSTRUMENTED-SO.so +// RUN: %clangxx_asan -DBUILD_INSTRUMENTED_DSO=1 -fPIC -shared -mllvm -asan-use-private-alias %s -o %dynamiclib1 +// RUN: %clangxx -DBUILD_UNINSTRUMENTED_DSO=1 -fPIC -shared %s -o %dynamiclib2 // RUN: %clangxx %s -c -mllvm -asan-use-private-alias -o %t.o -// RUN: %clangxx_asan %t.o %t-UNINSTRUMENTED-SO.so %t-INSTRUMENTED-SO.so -o %t-EXE +// RUN: %clangxx_asan %t.o %ld_flags_rpath_exe2 %ld_flags_rpath_exe1 -o %t-EXE // RUN: %run %t-EXE #if defined (BUILD_INSTRUMENTED_DSO) diff --git a/compiler-rt/test/asan/TestCases/Linux/odr-violation.cc b/compiler-rt/test/asan/TestCases/Linux/odr-violation.cc index 05ee1e5..87e540f 100644 --- a/compiler-rt/test/asan/TestCases/Linux/odr-violation.cc +++ b/compiler-rt/test/asan/TestCases/Linux/odr-violation.cc @@ -1,19 +1,16 @@ -// FIXME: https://code.google.com/p/address-sanitizer/issues/detail?id=316 -// XFAIL: android -// // We use fast_unwind_on_malloc=0 to have full unwinding even w/o frame // pointers. This setting is not on by default because it's too expensive. // // Different size: detect a bug if detect_odr_violation>=1 -// RUN: %clangxx_asan -DBUILD_SO=1 -fPIC -shared %s -o %t-ODR-SO.so -// RUN: %clangxx_asan %s %t-ODR-SO.so -Wl,-R. -o %t-ODR-EXE +// RUN: %clangxx_asan -DBUILD_SO=1 -fPIC -shared %s -o %dynamiclib +// RUN: %clangxx_asan %s %ld_flags_rpath_exe -o %t-ODR-EXE // RUN: %env_asan_opts=fast_unwind_on_malloc=0:detect_odr_violation=1 not %run %t-ODR-EXE 2>&1 | FileCheck %s // RUN: %env_asan_opts=fast_unwind_on_malloc=0:detect_odr_violation=2 not %run %t-ODR-EXE 2>&1 | FileCheck %s // RUN: %env_asan_opts=fast_unwind_on_malloc=0:detect_odr_violation=0 %run %t-ODR-EXE 2>&1 | FileCheck %s --check-prefix=DISABLED // RUN: %env_asan_opts=fast_unwind_on_malloc=0 not %run %t-ODR-EXE 2>&1 | FileCheck %s // // Same size: report a bug only if detect_odr_violation>=2. -// RUN: %clangxx_asan -DBUILD_SO=1 -fPIC -shared %s -o %t-ODR-SO.so -DSZ=100 +// RUN: %clangxx_asan -DBUILD_SO=1 -fPIC -shared %s -o %dynamiclib -DSZ=100 // RUN: %env_asan_opts=fast_unwind_on_malloc=0:detect_odr_violation=1 %run %t-ODR-EXE 2>&1 | FileCheck %s --check-prefix=DISABLED // RUN: %env_asan_opts=fast_unwind_on_malloc=0:detect_odr_violation=2 not %run %t-ODR-EXE 2>&1 | FileCheck %s // RUN: %env_asan_opts=fast_unwind_on_malloc=0 not %run %t-ODR-EXE 2>&1 | FileCheck %s @@ -24,18 +21,18 @@ // RUN: rm -f %t.supp // // Use private aliases for global variables without indicator symbol. -// RUN: %clangxx_asan -DBUILD_SO=1 -fPIC -shared -mllvm -asan-use-private-alias %s -o %t-ODR-SO.so -DSZ=100 -// RUN: %clangxx_asan -mllvm -asan-use-private-alias %s %t-ODR-SO.so -Wl,-R. -o %t-ODR-EXE +// RUN: %clangxx_asan -DBUILD_SO=1 -fPIC -shared -mllvm -asan-use-private-alias %s -o %dynamiclib -DSZ=100 +// RUN: %clangxx_asan -mllvm -asan-use-private-alias %s %ld_flags_rpath_exe -o %t-ODR-EXE // RUN: %env_asan_opts=fast_unwind_on_malloc=0 %run %t-ODR-EXE 2>&1 | FileCheck %s --check-prefix=DISABLED // Use private aliases for global variables: use indicator symbol to detect ODR violation. -// RUN: %clangxx_asan -DBUILD_SO=1 -fPIC -shared -mllvm -asan-use-private-alias -mllvm -asan-use-odr-indicator %s -o %t-ODR-SO.so -DSZ=100 -// RUN: %clangxx_asan -mllvm -asan-use-private-alias -mllvm -asan-use-odr-indicator %s %t-ODR-SO.so -Wl,-R. -o %t-ODR-EXE +// RUN: %clangxx_asan -DBUILD_SO=1 -fPIC -shared -mllvm -asan-use-private-alias -mllvm -asan-use-odr-indicator %s -o %dynamiclib -DSZ=100 +// RUN: %clangxx_asan -mllvm -asan-use-private-alias -mllvm -asan-use-odr-indicator %s %ld_flags_rpath_exe -o %t-ODR-EXE // RUN: %env_asan_opts=fast_unwind_on_malloc=0 not %run %t-ODR-EXE 2>&1 | FileCheck %s // Same as above but with clang switches. -// RUN: %clangxx_asan -DBUILD_SO=1 -fPIC -shared -fsanitize-address-use-odr-indicator %s -o %t-ODR-SO.so -DSZ=100 -// RUN: %clangxx_asan -fsanitize-address-use-odr-indicator %s %t-ODR-SO.so -Wl,-R. -o %t-ODR-EXE +// RUN: %clangxx_asan -DBUILD_SO=1 -fPIC -shared -fsanitize-address-use-odr-indicator %s -o %dynamiclib -DSZ=100 +// RUN: %clangxx_asan -fsanitize-address-use-odr-indicator %s %ld_flags_rpath_exe -o %t-ODR-EXE // RUN: %env_asan_opts=fast_unwind_on_malloc=0 not %run %t-ODR-EXE 2>&1 | FileCheck %s // GNU driver doesn't handle .so files properly. @@ -60,6 +57,6 @@ int main(int argc, char **argv) { // CHECK: These globals were registered at these points: // CHECK: ODR-EXE -// CHECK: ODR-SO +// CHECK: odr-violation.cc.dynamic // CHECK: SUMMARY: AddressSanitizer: odr-violation: global 'foo::G' at {{.*}}odr-violation.cc // DISABLED: PASS diff --git a/compiler-rt/test/asan/TestCases/Linux/odr-vtable.cc b/compiler-rt/test/asan/TestCases/Linux/odr-vtable.cc index 283295d..fdbab4b 100644 --- a/compiler-rt/test/asan/TestCases/Linux/odr-vtable.cc +++ b/compiler-rt/test/asan/TestCases/Linux/odr-vtable.cc @@ -1,9 +1,6 @@ -// FIXME: Same as test/asan/TestCases/Linux/odr-violation.cc ? -// XFAIL: android - -// RUN: %clangxx_asan -fno-rtti -DBUILD_SO1 -fPIC -shared %s -o %t1.so -// RUN: %clangxx_asan -fno-rtti -DBUILD_SO2 -fPIC -shared %s -o %t2.so -// RUN: %clangxx_asan -fno-rtti %t1.so %t2.so %s -Wl,-R. -o %t +// RUN: %clangxx_asan -fno-rtti -DBUILD_SO1 -fPIC -shared %s -o %dynamiclib1 +// RUN: %clangxx_asan -fno-rtti -DBUILD_SO2 -fPIC -shared %s -o %dynamiclib2 +// RUN: %clangxx_asan -fno-rtti %s %ld_flags_rpath_exe1 %ld_flags_rpath_exe2 -o %t // RUN: %env_asan_opts=fast_unwind_on_malloc=0:detect_odr_violation=2 not %run %t 2>&1 | FileCheck %s struct XYZ { diff --git a/compiler-rt/test/asan/TestCases/Linux/odr_c_test.c b/compiler-rt/test/asan/TestCases/Linux/odr_c_test.c index b1d2349..c1423ed 100644 --- a/compiler-rt/test/asan/TestCases/Linux/odr_c_test.c +++ b/compiler-rt/test/asan/TestCases/Linux/odr_c_test.c @@ -1,13 +1,11 @@ // Test that we can properly report an ODR violation // between an instrumented global and a non-instrumented global. -// RUN: %clang_asan %s -fPIC -shared -o %t-1.so -DFILE1 -// RUN: %clang_asan %s -fPIC -shared -o %t-2.so -DFILE2 -// RUN: %clang_asan %s -fPIE %t-1.so %t-2.so -Wl,-R`pwd` -o %t +// RUN: %clang_asan %s -fPIC -shared -o %dynamiclib1 -DFILE1 +// RUN: %clang_asan %s -fPIC -shared -o %dynamiclib2 -DFILE2 +// RUN: %clang_asan %s -fPIE %ld_flags_rpath_exe1 %ld_flags_rpath_exe2 -o %t // RUN: not %run %t 2>&1 | FileCheck %s // -// REQUIRES: x86_64-target-arch -// // CHECK: The following global variable is not properly aligned. // CHECK: ERROR: AddressSanitizer: odr-violation #if defined(FILE1) diff --git a/compiler-rt/test/asan/TestCases/Linux/preinit_test.cc b/compiler-rt/test/asan/TestCases/Linux/preinit_test.cc index 10dde67..f8c2b6b 100644 --- a/compiler-rt/test/asan/TestCases/Linux/preinit_test.cc +++ b/compiler-rt/test/asan/TestCases/Linux/preinit_test.cc @@ -1,8 +1,5 @@ -// FIXME: https://code.google.com/p/address-sanitizer/issues/detail?id=316 -// XFAIL: android -// -// RUN: %clangxx -DFUNC=zzzz %s -shared -o %t.so -fPIC -// RUN: %clangxx_asan -DFUNC=main %s -o %t -Wl,-R. %t.so +// RUN: %clangxx -DFUNC=zzzz %s -shared -o %dynamiclib -fPIC +// RUN: %clangxx_asan -DFUNC=main %s -o %t %ld_flags_rpath_exe // RUN: %run %t // GNU driver doesn't handle .so files properly. -- 2.7.4