diff options
author | Alexey Samsonov <samsonov@google.com> | 2013-06-06 09:23:34 +0000 |
---|---|---|
committer | Alexey Samsonov <samsonov@google.com> | 2013-06-06 09:23:34 +0000 |
commit | 2874f70250286e581c3b15be0f1f8ad3b9e86aa5 (patch) | |
tree | 30f7d3da64697083dc294311eac536d1421bb989 /compiler-rt/lib/asan/lit_tests/TestCases/memcmp_strict_test.cc | |
parent | 15439bcf79decf81f94bfaf2e4b39167bf954b18 (diff) | |
download | bcm5719-llvm-2874f70250286e581c3b15be0f1f8ad3b9e86aa5.tar.gz bcm5719-llvm-2874f70250286e581c3b15be0f1f8ad3b9e86aa5.zip |
[ASan] move all lit_tests under TestCases
llvm-svn: 183395
Diffstat (limited to 'compiler-rt/lib/asan/lit_tests/TestCases/memcmp_strict_test.cc')
-rw-r--r-- | compiler-rt/lib/asan/lit_tests/TestCases/memcmp_strict_test.cc | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/compiler-rt/lib/asan/lit_tests/TestCases/memcmp_strict_test.cc b/compiler-rt/lib/asan/lit_tests/TestCases/memcmp_strict_test.cc new file mode 100644 index 00000000000..00bf921c744 --- /dev/null +++ b/compiler-rt/lib/asan/lit_tests/TestCases/memcmp_strict_test.cc @@ -0,0 +1,16 @@ +// RUN: %clangxx_asan -m64 -O0 %s -o %t && ASAN_OPTIONS=strict_memcmp=0 %t 2>&1 | %symbolize | FileCheck %s --check-prefix=CHECK-nonstrict +// RUN: %clangxx_asan -m64 -O0 %s -o %t && ASAN_OPTIONS=strict_memcmp=1 %t 2>&1 | %symbolize | FileCheck %s --check-prefix=CHECK-strict +// Default to strict_memcmp=1. +// RUN: %clangxx_asan -m64 -O0 %s -o %t && %t 2>&1 | %symbolize | FileCheck %s --check-prefix=CHECK-strict + +#include <stdio.h> +#include <string.h> +int main() { + char kFoo[] = "foo"; + char kFubar[] = "fubar"; + int res = memcmp(kFoo, kFubar, strlen(kFubar)); + printf("res: %d\n", res); + // CHECK-nonstrict: {{res: -1}} + // CHECK-strict: AddressSanitizer: stack-buffer-overflow + return 0; +} |