[UBSan] Temporarily disable checks for stack traces in UBSan reports on Darwin

to make the tests green.
Slow stack unwinding is disabled in libsanitizer on Darwin now.

llvm-svn: 216657
This commit is contained in:
Alexander Potapenko 2014-08-28 09:25:06 +00:00
parent 8354cfaf95
commit 53cce89a81
4 changed files with 17 additions and 7 deletions

View File

@ -113,8 +113,6 @@ if config.host_arch.find('64') != -1 and config.android != "TRUE":
else:
kernel_bits = '32'
# Define CHECK-%os to check for OS-dependent output.
config.substitutions.append( ('CHECK-%os', ("CHECK-" + config.host_os)))
config.substitutions.append( ('CHECK-%kernel_bits', ("CHECK-kernel-" + kernel_bits + "-bits")))
config.available_features.add("asan-" + config.bits + "-bits")

View File

@ -69,6 +69,9 @@ config.substitutions.append(
# Allow tests to be executed on a simulator or remotely.
config.substitutions.append( ('%run', config.emulator) )
# Define CHECK-%os to check for OS-dependent output.
config.substitutions.append( ('CHECK-%os', ("CHECK-" + config.host_os)))
# Add supported compiler_rt architectures to a list of available features.
compiler_rt_arch = getattr(config, 'compiler_rt_arch', None)
if compiler_rt_arch:

View File

@ -1,13 +1,18 @@
// RUN: %clangxx -fsanitize=return -g %s -O3 -o %t
// RUN: not %run %t 2>&1 | FileCheck %s
// RUN: UBSAN_OPTIONS=print_stacktrace=1 not %run %t 2>&1 | FileCheck %s --check-prefix=STACKTRACE
// RUN: UBSAN_OPTIONS=print_stacktrace=1 not %run %t 2>&1 | FileCheck %s --check-prefix=CHECK-%os-STACKTRACE
// CHECK: missing_return.cpp:[[@LINE+1]]:5: runtime error: execution reached the end of a value-returning function without returning a value
int f() {
// STACKTRACE: #0 {{.*}} in f(){{.*}}missing_return.cpp:[[@LINE-1]]
// Slow stack unwinding is disabled on Darwin for now, see
// https://code.google.com/p/address-sanitizer/issues/detail?id=137
// CHECK-Linux-STACKTRACE: #0 {{.*}} in f(){{.*}}missing_return.cpp:[[@LINE-1]]
// Check for already checked line to avoid lit error reports.
// CHECK-Darwin-STACKTRACE: missing_return.cpp
}
int main(int, char **argv) {
return f();
// STACKTRACE: #1 {{.*}} in main{{.*}}missing_return.cpp:[[@LINE-1]]
// Disabled on Darwin, see above.
// CHECK-Linux-STACKTRACE: #1 {{.*}} in main{{.*}}missing_return.cpp:[[@LINE-1]]
}

View File

@ -6,7 +6,7 @@
// RUN: %run %t m1 2>&1 | FileCheck %s --check-prefix=CHECK-MEMBER
// RUN: %run %t f1 2>&1 | FileCheck %s --check-prefix=CHECK-MEMFUN
// RUN: %run %t n1 2>&1 | FileCheck %s --check-prefix=CHECK-NEW
// RUN: UBSAN_OPTIONS=print_stacktrace=1 %run %t l1 2>&1 | FileCheck %s --check-prefix=CHECK-LOAD --check-prefix=CHECK-STACK-LOAD
// RUN: UBSAN_OPTIONS=print_stacktrace=1 %run %t l1 2>&1 | FileCheck %s --check-prefix=CHECK-LOAD --check-prefix=CHECK-%os-STACK-LOAD
#include <new>
@ -32,7 +32,11 @@ int main(int, char **argv) {
// CHECK-LOAD-NEXT: {{^ 00 00 00 01 02 03 04 05}}
// CHECK-LOAD-NEXT: {{^ \^}}
return *p && 0;
// CHECK-STACK-LOAD: #0 {{.*}} in main{{.*}}misaligned.cpp
// Slow stack unwinding is disabled on Darwin for now, see
// https://code.google.com/p/address-sanitizer/issues/detail?id=137
// CHECK-Linux-STACK-LOAD: #0 {{.*}} in main{{.*}}misaligned.cpp
// Check for the already checked line to avoid lit error reports.
// CHECK-Darwin-STACK-LOAD: {{ }}
case 's':
// CHECK-STORE: misaligned.cpp:[[@LINE+4]]:5: runtime error: store to misaligned address [[PTR:0x[0-9a-f]*]] for type 'int', which requires 4 byte alignment