[compiler-rt] r367849 - compiler-rt: Rename .cc file in test/hwasan to .cpp
Nico Weber via llvm-commits
llvm-commits at lists.llvm.org
Mon Aug 5 06:10:50 PDT 2019
Author: nico
Date: Mon Aug 5 06:10:50 2019
New Revision: 367849
URL: http://llvm.org/viewvc/llvm-project?rev=367849&view=rev
Log:
compiler-rt: Rename .cc file in test/hwasan to .cpp
Like r367463, but for test/hwasan.
Added:
compiler-rt/trunk/test/hwasan/TestCases/abort-message-android.cpp
- copied unchanged from r367848, compiler-rt/trunk/test/hwasan/TestCases/abort-message-android.cc
compiler-rt/trunk/test/hwasan/TestCases/allocator_returns_null.cpp
- copied unchanged from r367848, compiler-rt/trunk/test/hwasan/TestCases/allocator_returns_null.cc
compiler-rt/trunk/test/hwasan/TestCases/cfi.cpp
- copied unchanged from r367848, compiler-rt/trunk/test/hwasan/TestCases/cfi.cc
compiler-rt/trunk/test/hwasan/TestCases/check-interface.cpp
- copied unchanged from r367848, compiler-rt/trunk/test/hwasan/TestCases/check-interface.cc
compiler-rt/trunk/test/hwasan/TestCases/halt-on-error.cpp
- copied, changed from r367848, compiler-rt/trunk/test/hwasan/TestCases/halt-on-error.cc
compiler-rt/trunk/test/hwasan/TestCases/hwasan-print-shadow.cpp
- copied unchanged from r367848, compiler-rt/trunk/test/hwasan/TestCases/hwasan-print-shadow.cc
compiler-rt/trunk/test/hwasan/TestCases/malloc_fill.cpp
- copied unchanged from r367848, compiler-rt/trunk/test/hwasan/TestCases/malloc_fill.cc
compiler-rt/trunk/test/hwasan/TestCases/new-test.cpp
- copied unchanged from r367848, compiler-rt/trunk/test/hwasan/TestCases/new-test.cc
compiler-rt/trunk/test/hwasan/TestCases/realloc-test.cpp
- copied unchanged from r367848, compiler-rt/trunk/test/hwasan/TestCases/realloc-test.cc
compiler-rt/trunk/test/hwasan/TestCases/register-dump-no-fp.cpp
- copied, changed from r367848, compiler-rt/trunk/test/hwasan/TestCases/register-dump-no-fp.cc
compiler-rt/trunk/test/hwasan/TestCases/sanitizer_malloc.cpp
- copied unchanged from r367848, compiler-rt/trunk/test/hwasan/TestCases/sanitizer_malloc.cc
compiler-rt/trunk/test/hwasan/TestCases/try-catch.cpp
- copied unchanged from r367848, compiler-rt/trunk/test/hwasan/TestCases/try-catch.cc
Removed:
compiler-rt/trunk/test/hwasan/TestCases/abort-message-android.cc
compiler-rt/trunk/test/hwasan/TestCases/allocator_returns_null.cc
compiler-rt/trunk/test/hwasan/TestCases/cfi.cc
compiler-rt/trunk/test/hwasan/TestCases/check-interface.cc
compiler-rt/trunk/test/hwasan/TestCases/halt-on-error.cc
compiler-rt/trunk/test/hwasan/TestCases/hwasan-print-shadow.cc
compiler-rt/trunk/test/hwasan/TestCases/malloc_fill.cc
compiler-rt/trunk/test/hwasan/TestCases/new-test.cc
compiler-rt/trunk/test/hwasan/TestCases/realloc-test.cc
compiler-rt/trunk/test/hwasan/TestCases/register-dump-no-fp.cc
compiler-rt/trunk/test/hwasan/TestCases/sanitizer_malloc.cc
compiler-rt/trunk/test/hwasan/TestCases/try-catch.cc
Modified:
compiler-rt/trunk/test/hwasan/lit.cfg.py
Removed: compiler-rt/trunk/test/hwasan/TestCases/abort-message-android.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/hwasan/TestCases/abort-message-android.cc?rev=367848&view=auto
==============================================================================
--- compiler-rt/trunk/test/hwasan/TestCases/abort-message-android.cc (original)
+++ compiler-rt/trunk/test/hwasan/TestCases/abort-message-android.cc (removed)
@@ -1,28 +0,0 @@
-// RUN: %clangxx_hwasan -DERR=1 %s -o %t && not %run %t 2>&1 | FileCheck %s
-// RUN: %clangxx_hwasan -DERR=2 %s -o %t && not %run %t 2>&1 | FileCheck %s
-// REQUIRES: android
-
-#include <stdlib.h>
-#include <stdio.h>
-
-#include <sanitizer/hwasan_interface.h>
-
-__attribute__((no_sanitize("hwaddress")))
-extern "C" void android_set_abort_message(const char *msg) {
- fprintf(stderr, "== abort message start\n%s\n== abort message end\n", msg);
-}
-
-int main() {
- __hwasan_enable_allocator_tagging();
- char *volatile p = (char *)malloc(16);
- if (ERR==1) {
- p[16] = 1;
- } else {
- free(p);
- free(p);
- }
- // CHECK: ERROR: HWAddressSanitizer:
- // CHECK: == abort message start
- // CHECK: ERROR: HWAddressSanitizer:
- // CHECK: == abort message end
-}
Removed: compiler-rt/trunk/test/hwasan/TestCases/allocator_returns_null.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/hwasan/TestCases/allocator_returns_null.cc?rev=367848&view=auto
==============================================================================
--- compiler-rt/trunk/test/hwasan/TestCases/allocator_returns_null.cc (original)
+++ compiler-rt/trunk/test/hwasan/TestCases/allocator_returns_null.cc (removed)
@@ -1,118 +0,0 @@
-// Test the behavior of malloc/calloc/realloc/new when the allocation size
-// exceeds the HWASan allocator's max allowed one.
-// By default (allocator_may_return_null=0) the process should crash. With
-// allocator_may_return_null=1 the allocator should return 0 and set errno to
-// the appropriate error code.
-//
-// RUN: %clangxx_hwasan -O0 %s -o %t
-// RUN: not %run %t malloc 2>&1 | FileCheck %s --check-prefix=CHECK-mCRASH
-// RUN: %env_hwasan_opts=allocator_may_return_null=0 not %run %t malloc 2>&1 \
-// RUN: | FileCheck %s --check-prefix=CHECK-mCRASH
-// RUN: %env_hwasan_opts=allocator_may_return_null=1 %run %t malloc 2>&1 \
-// RUN: | FileCheck %s --check-prefix=CHECK-mNULL
-// RUN: %env_hwasan_opts=allocator_may_return_null=0 not %run %t calloc 2>&1 \
-// RUN: | FileCheck %s --check-prefix=CHECK-cCRASH
-// RUN: %env_hwasan_opts=allocator_may_return_null=1 %run %t calloc 2>&1 \
-// RUN: | FileCheck %s --check-prefix=CHECK-cNULL
-// RUN: %env_hwasan_opts=allocator_may_return_null=0 not %run %t calloc-overflow 2>&1 \
-// RUN: | FileCheck %s --check-prefix=CHECK-coCRASH
-// RUN: %env_hwasan_opts=allocator_may_return_null=1 %run %t calloc-overflow 2>&1 \
-// RUN: | FileCheck %s --check-prefix=CHECK-coNULL
-// RUN: %env_hwasan_opts=allocator_may_return_null=0 not %run %t realloc 2>&1 \
-// RUN: | FileCheck %s --check-prefix=CHECK-rCRASH
-// RUN: %env_hwasan_opts=allocator_may_return_null=1 %run %t realloc 2>&1 \
-// RUN: | FileCheck %s --check-prefix=CHECK-rNULL
-// RUN: %env_hwasan_opts=allocator_may_return_null=0 not %run %t realloc-after-malloc 2>&1 \
-// RUN: | FileCheck %s --check-prefix=CHECK-mrCRASH
-// RUN: %env_hwasan_opts=allocator_may_return_null=1 %run %t realloc-after-malloc 2>&1 \
-// RUN: | FileCheck %s --check-prefix=CHECK-mrNULL
-// RUN: %env_hwasan_opts=allocator_may_return_null=0 not %run %t new 2>&1 \
-// RUN: | FileCheck %s --check-prefix=CHECK-nCRASH
-// RUN: %env_hwasan_opts=allocator_may_return_null=1 not %run %t new 2>&1 \
-// RUN: | FileCheck %s --check-prefix=CHECK-nCRASH-OOM
-// RUN: %env_hwasan_opts=allocator_may_return_null=0 not %run %t new-nothrow 2>&1 \
-// RUN: | FileCheck %s --check-prefix=CHECK-nnCRASH
-// RUN: %env_hwasan_opts=allocator_may_return_null=1 %run %t new-nothrow 2>&1 \
-// RUN: | FileCheck %s --check-prefix=CHECK-nnNULL
-
-// REQUIRES: stable-runtime
-
-// TODO(alekseyshl): Fix it.
-// UNSUPPORTED: android
-
-#include <assert.h>
-#include <errno.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <limits>
-#include <new>
-
-int main(int argc, char **argv) {
- assert(argc == 2);
- const char *action = argv[1];
- fprintf(stderr, "%s:\n", action);
-
- static const size_t kMaxAllowedMallocSizePlusOne = (2UL << 30) + 1;
-
- void *x = nullptr;
- if (!strcmp(action, "malloc")) {
- x = malloc(kMaxAllowedMallocSizePlusOne);
- } else if (!strcmp(action, "calloc")) {
- x = calloc((kMaxAllowedMallocSizePlusOne / 4) + 1, 4);
- } else if (!strcmp(action, "calloc-overflow")) {
- volatile size_t kMaxSizeT = std::numeric_limits<size_t>::max();
- size_t kArraySize = 4096;
- volatile size_t kArraySize2 = kMaxSizeT / kArraySize + 10;
- x = calloc(kArraySize, kArraySize2);
- } else if (!strcmp(action, "realloc")) {
- x = realloc(0, kMaxAllowedMallocSizePlusOne);
- } else if (!strcmp(action, "realloc-after-malloc")) {
- char *t = (char*)malloc(100);
- *t = 42;
- x = realloc(t, kMaxAllowedMallocSizePlusOne);
- assert(*t == 42);
- free(t);
- } else if (!strcmp(action, "new")) {
- x = operator new(kMaxAllowedMallocSizePlusOne);
- } else if (!strcmp(action, "new-nothrow")) {
- x = operator new(kMaxAllowedMallocSizePlusOne, std::nothrow);
- } else {
- assert(0);
- }
-
- fprintf(stderr, "errno: %d\n", errno);
-
- free(x);
-
- return x != nullptr;
-}
-
-// CHECK-mCRASH: malloc:
-// CHECK-mCRASH: SUMMARY: HWAddressSanitizer: allocation-size-too-big
-// CHECK-cCRASH: calloc:
-// CHECK-cCRASH: SUMMARY: HWAddressSanitizer: allocation-size-too-big
-// CHECK-coCRASH: calloc-overflow:
-// CHECK-coCRASH: SUMMARY: HWAddressSanitizer: calloc-overflow
-// CHECK-rCRASH: realloc:
-// CHECK-rCRASH: SUMMARY: HWAddressSanitizer: allocation-size-too-big
-// CHECK-mrCRASH: realloc-after-malloc:
-// CHECK-mrCRASH: SUMMARY: HWAddressSanitizer: allocation-size-too-big
-// CHECK-nCRASH: new:
-// CHECK-nCRASH: SUMMARY: HWAddressSanitizer: allocation-size-too-big
-// CHECK-nCRASH-OOM: new:
-// CHECK-nCRASH-OOM: SUMMARY: HWAddressSanitizer: out-of-memory
-// CHECK-nnCRASH: new-nothrow:
-// CHECK-nnCRASH: SUMMARY: HWAddressSanitizer: allocation-size-too-big
-
-// CHECK-mNULL: malloc:
-// CHECK-mNULL: errno: 12
-// CHECK-cNULL: calloc:
-// CHECK-cNULL: errno: 12
-// CHECK-coNULL: calloc-overflow:
-// CHECK-coNULL: errno: 12
-// CHECK-rNULL: realloc:
-// CHECK-rNULL: errno: 12
-// CHECK-mrNULL: realloc-after-malloc:
-// CHECK-mrNULL: errno: 12
-// CHECK-nnNULL: new-nothrow:
Removed: compiler-rt/trunk/test/hwasan/TestCases/cfi.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/hwasan/TestCases/cfi.cc?rev=367848&view=auto
==============================================================================
--- compiler-rt/trunk/test/hwasan/TestCases/cfi.cc (original)
+++ compiler-rt/trunk/test/hwasan/TestCases/cfi.cc (removed)
@@ -1,18 +0,0 @@
-// RUN: %clangxx_hwasan -fsanitize=cfi -fno-sanitize-trap=cfi -flto -fvisibility=hidden -fuse-ld=lld %s -o %t
-// RUN: not %run %t 2>&1 | FileCheck %s
-
-// REQUIRES: android
-
-// Smoke test for CFI + HWASAN.
-
-struct A {
- virtual void f();
-};
-
-void A::f() {}
-
-int main() {
- // CHECK: control flow integrity check for type {{.*}} failed during cast to unrelated type
- A *a = reinterpret_cast<A *>(reinterpret_cast<void *>(&main));
- (void)a;
-}
Removed: compiler-rt/trunk/test/hwasan/TestCases/check-interface.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/hwasan/TestCases/check-interface.cc?rev=367848&view=auto
==============================================================================
--- compiler-rt/trunk/test/hwasan/TestCases/check-interface.cc (original)
+++ compiler-rt/trunk/test/hwasan/TestCases/check-interface.cc (removed)
@@ -1,22 +0,0 @@
-// RUN: %clangxx_hwasan -mllvm -hwasan-instrument-with-calls=1 -O0 %s -o %t
-// RUN: %clangxx_hwasan -mllvm -hwasan-instrument-with-calls=1 -O0 %s -o %t -fsanitize-recover=hwaddress
-
-// REQUIRES: stable-runtime
-
-// Utilizes all flavors of __hwasan_load/store interface functions to verify
-// that the instrumentation and the interface provided by HWASan do match.
-// In case of a discrepancy, this test fails to link.
-
-#include <sanitizer/hwasan_interface.h>
-
-#define F(T) void f_##T(T *a, T *b) { *a = *b; }
-
-F(uint8_t)
-F(uint16_t)
-F(uint32_t)
-F(uint64_t)
-
-typedef unsigned V32 __attribute__((__vector_size__(32)));
-F(V32)
-
-int main() {}
Removed: compiler-rt/trunk/test/hwasan/TestCases/halt-on-error.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/hwasan/TestCases/halt-on-error.cc?rev=367848&view=auto
==============================================================================
--- compiler-rt/trunk/test/hwasan/TestCases/halt-on-error.cc (original)
+++ compiler-rt/trunk/test/hwasan/TestCases/halt-on-error.cc (removed)
@@ -1,42 +0,0 @@
-// RUN: %clangxx_hwasan -O0 %s -o %t && not %run %t 2>&1 | FileCheck %s --check-prefixes=COMMON
-// RUN: %clangxx_hwasan -O0 %s -o %t && not %env_hwasan_opts=halt_on_error=1 %run %t 2>&1 | FileCheck %s --check-prefix=COMMON
-// RUN: %clangxx_hwasan -O0 %s -o %t && not %env_hwasan_opts=halt_on_error=0 %run %t 2>&1 | FileCheck %s --check-prefix=COMMON
-
-// RUN: %clangxx_hwasan -O0 %s -o %t -fsanitize-recover=hwaddress && not %run %t 2>&1 | FileCheck %s --check-prefix=COMMON
-// RUN: %clangxx_hwasan -O0 %s -o %t -fsanitize-recover=hwaddress && not %env_hwasan_opts=halt_on_error=1 %run %t 2>&1 | FileCheck %s --check-prefix=COMMON
-// RUN: %clangxx_hwasan -O0 %s -o %t -fsanitize-recover=hwaddress && not %env_hwasan_opts=halt_on_error=0 %run %t 2>&1 | FileCheck %s --check-prefixes=COMMON,RECOVER
-
-// RUN: %clangxx_hwasan -mllvm -hwasan-instrument-with-calls=1 -O0 %s -o %t && not %run %t 2>&1 | FileCheck %s --check-prefix=COMMON
-// RUN: %clangxx_hwasan -mllvm -hwasan-instrument-with-calls=1 -O0 %s -o %t && not %env_hwasan_opts=halt_on_error=1 %run %t 2>&1 | FileCheck %s --check-prefix=COMMON
-// RUN: %clangxx_hwasan -mllvm -hwasan-instrument-with-calls=1 -O0 %s -o %t && not %env_hwasan_opts=halt_on_error=0 %run %t 2>&1 | FileCheck %s --check-prefix=COMMON
-
-// RUN: %clangxx_hwasan -mllvm -hwasan-instrument-with-calls=1 -O0 %s -o %t -fsanitize-recover=hwaddress && not %run %t 2>&1 | FileCheck %s --check-prefix=COMMON
-// RUN: %clangxx_hwasan -mllvm -hwasan-instrument-with-calls=1 -O0 %s -o %t -fsanitize-recover=hwaddress && not %env_hwasan_opts=halt_on_error=1 %run %t 2>&1 | FileCheck %s --check-prefix=COMMON
-// RUN: %clangxx_hwasan -mllvm -hwasan-instrument-with-calls=1 -O0 %s -o %t -fsanitize-recover=hwaddress && not %env_hwasan_opts=halt_on_error=0 %run %t 2>&1 | FileCheck %s --check-prefixes=COMMON,RECOVER
-
-// REQUIRES: stable-runtime
-
-#include <stdlib.h>
-#include <sanitizer/hwasan_interface.h>
-
-int main() {
- __hwasan_enable_allocator_tagging();
- int* volatile x = (int*)malloc(16);
- free(x);
- __hwasan_disable_allocator_tagging();
- return x[2] + ((char *)x)[6] + ((char *)x)[9];
- // COMMON: READ of size 4 at
- // When instrumenting with callbacks, main is actually #1, and #0 is __hwasan_load4.
- // COMMON: #{{.*}} in main {{.*}}halt-on-error.cc:27
- // COMMON: SUMMARY: HWAddressSanitizer: tag-mismatch {{.*}} in
-
- // RECOVER: READ of size 1 at
- // RECOVER: #{{.*}} in main {{.*}}halt-on-error.cc:27
- // RECOVER: SUMMARY: HWAddressSanitizer: tag-mismatch {{.*}} in
-
- // RECOVER: READ of size 1 at
- // RECOVER: #{{.*}} in main {{.*}}halt-on-error.cc:27
- // RECOVER: SUMMARY: HWAddressSanitizer: tag-mismatch {{.*}} in
-
- // COMMON-NOT: tag-mismatch
-}
Copied: compiler-rt/trunk/test/hwasan/TestCases/halt-on-error.cpp (from r367848, compiler-rt/trunk/test/hwasan/TestCases/halt-on-error.cc)
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/hwasan/TestCases/halt-on-error.cpp?p2=compiler-rt/trunk/test/hwasan/TestCases/halt-on-error.cpp&p1=compiler-rt/trunk/test/hwasan/TestCases/halt-on-error.cc&r1=367848&r2=367849&rev=367849&view=diff
==============================================================================
--- compiler-rt/trunk/test/hwasan/TestCases/halt-on-error.cc (original)
+++ compiler-rt/trunk/test/hwasan/TestCases/halt-on-error.cpp Mon Aug 5 06:10:50 2019
@@ -27,15 +27,15 @@ int main() {
return x[2] + ((char *)x)[6] + ((char *)x)[9];
// COMMON: READ of size 4 at
// When instrumenting with callbacks, main is actually #1, and #0 is __hwasan_load4.
- // COMMON: #{{.*}} in main {{.*}}halt-on-error.cc:27
+ // COMMON: #{{.*}} in main {{.*}}halt-on-error.cpp:27
// COMMON: SUMMARY: HWAddressSanitizer: tag-mismatch {{.*}} in
// RECOVER: READ of size 1 at
- // RECOVER: #{{.*}} in main {{.*}}halt-on-error.cc:27
+ // RECOVER: #{{.*}} in main {{.*}}halt-on-error.cpp:27
// RECOVER: SUMMARY: HWAddressSanitizer: tag-mismatch {{.*}} in
// RECOVER: READ of size 1 at
- // RECOVER: #{{.*}} in main {{.*}}halt-on-error.cc:27
+ // RECOVER: #{{.*}} in main {{.*}}halt-on-error.cpp:27
// RECOVER: SUMMARY: HWAddressSanitizer: tag-mismatch {{.*}} in
// COMMON-NOT: tag-mismatch
Removed: compiler-rt/trunk/test/hwasan/TestCases/hwasan-print-shadow.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/hwasan/TestCases/hwasan-print-shadow.cc?rev=367848&view=auto
==============================================================================
--- compiler-rt/trunk/test/hwasan/TestCases/hwasan-print-shadow.cc (original)
+++ compiler-rt/trunk/test/hwasan/TestCases/hwasan-print-shadow.cc (removed)
@@ -1,29 +0,0 @@
-// RUN: %clangxx_hwasan -DSIZE=16 -O0 %s -o %t && %run %t 2>&1 | FileCheck %s
-
-// REQUIRES: stable-runtime
-
-#include <assert.h>
-#include <stdlib.h>
-#include <sys/mman.h>
-#include <sanitizer/hwasan_interface.h>
-
-int main() {
- char *p = (char *)mmap(nullptr, 4096, PROT_READ | PROT_WRITE,
- MAP_PRIVATE | MAP_ANONYMOUS, 0, 0);
- assert(p);
-
- __hwasan_tag_memory(p, 1, 32);
- __hwasan_tag_memory(p + 32, 3, 16);
- __hwasan_tag_memory(p + 48, 0, 32);
- __hwasan_tag_memory(p + 80, 4, 16);
-
- char *q = (char *)__hwasan_tag_pointer(p, 7);
- __hwasan_print_shadow(q + 5, 89 - 5);
- // CHECK: HWASan shadow map for {{.*}}5 .. {{.*}}9 (pointer tag 7)
- // CHECK-NEXT: {{.*}}0: 1
- // CHECK-NEXT: {{.*}}0: 1
- // CHECK-NEXT: {{.*}}0: 3
- // CHECK-NEXT: {{.*}}0: 0
- // CHECK-NEXT: {{.*}}0: 0
- // CHECK-NEXT: {{.*}}0: 4
-}
Removed: compiler-rt/trunk/test/hwasan/TestCases/malloc_fill.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/hwasan/TestCases/malloc_fill.cc?rev=367848&view=auto
==============================================================================
--- compiler-rt/trunk/test/hwasan/TestCases/malloc_fill.cc (original)
+++ compiler-rt/trunk/test/hwasan/TestCases/malloc_fill.cc (removed)
@@ -1,22 +0,0 @@
-// Check that we fill malloc-ed memory correctly.
-// RUN: %clangxx_hwasan %s -o %t
-// RUN: %run %t | FileCheck %s
-// RUN: %env_hwasan_opts=max_malloc_fill_size=10:malloc_fill_byte=8 %run %t | FileCheck %s --check-prefix=CHECK-10-8
-// RUN: %env_hwasan_opts=max_malloc_fill_size=20:malloc_fill_byte=171 %run %t | FileCheck %s --check-prefix=CHECK-20-ab
-
-#include <stdio.h>
-int main(int argc, char **argv) {
- // With asan allocator this makes sure we get memory from mmap.
- static const int kSize = 1 << 25;
- unsigned char *x = new unsigned char[kSize];
- printf("-");
- for (int i = 0; i <= 32; i++) {
- printf("%02x", x[i]);
- }
- printf("-\n");
- delete [] x;
-}
-
-// CHECK: -bebebebebebebebebebebebebebebebebebebebebebebebebebebebebebebebebe-
-// CHECK-10-8: -080808080808080808080000000000000000000000000000000000000000000000-
-// CHECK-20-ab: -abababababababababababababababababababab00000000000000000000000000-
Removed: compiler-rt/trunk/test/hwasan/TestCases/new-test.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/hwasan/TestCases/new-test.cc?rev=367848&view=auto
==============================================================================
--- compiler-rt/trunk/test/hwasan/TestCases/new-test.cc (original)
+++ compiler-rt/trunk/test/hwasan/TestCases/new-test.cc (removed)
@@ -1,18 +0,0 @@
-// Test basic new functionality.
-// RUN: %clangxx_hwasan %s -o %t
-// RUN: %run %t
-
-#include <stdlib.h>
-#include <assert.h>
-#include <sanitizer/hwasan_interface.h>
-#include <sanitizer/allocator_interface.h>
-
-int main() {
- __hwasan_enable_allocator_tagging();
-
- size_t volatile n = 0;
- char *a1 = new char[n];
- assert(a1 != nullptr);
- assert(__sanitizer_get_allocated_size(a1) == 0);
- delete[] a1;
-}
Removed: compiler-rt/trunk/test/hwasan/TestCases/realloc-test.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/hwasan/TestCases/realloc-test.cc?rev=367848&view=auto
==============================================================================
--- compiler-rt/trunk/test/hwasan/TestCases/realloc-test.cc (original)
+++ compiler-rt/trunk/test/hwasan/TestCases/realloc-test.cc (removed)
@@ -1,44 +0,0 @@
-// Test basic realloc functionality.
-// RUN: %clang_hwasan %s -o %t && %run %t
-// RUN: %clang_hwasan %s -DREALLOCARRAY -o %t && %run %t
-
-#include <assert.h>
-#include <sanitizer/hwasan_interface.h>
-
-#ifdef REALLOCARRAY
-extern "C" void *reallocarray(void *, size_t nmemb, size_t size);
-#define REALLOC(p, s) reallocarray(p, 1, s)
-#else
-#include <stdlib.h>
-#define REALLOC(p, s) realloc(p, s)
-#endif
-
-int main() {
- __hwasan_enable_allocator_tagging();
- char *x = (char*)REALLOC(nullptr, 4);
- x[0] = 10;
- x[1] = 20;
- x[2] = 30;
- x[3] = 40;
- char *x1 = (char*)REALLOC(x, 5);
- assert(x1 != x); // not necessary true for C,
- // but true today for hwasan.
- assert(x1[0] == 10 && x1[1] == 20 && x1[2] == 30 && x1[3] == 40);
- x1[4] = 50;
-
- char *x2 = (char*)REALLOC(x1, 6);
- x2[5] = 60;
- assert(x2 != x1);
- assert(x2[0] == 10 && x2[1] == 20 && x2[2] == 30 && x2[3] == 40 &&
- x2[4] == 50 && x2[5] == 60);
-
- char *x3 = (char*)REALLOC(x2, 6);
- assert(x3 != x2);
- assert(x3[0] == 10 && x3[1] == 20 && x3[2] == 30 && x3[3] == 40 &&
- x3[4] == 50 && x3[5] == 60);
-
- char *x4 = (char*)REALLOC(x3, 5);
- assert(x4 != x3);
- assert(x4[0] == 10 && x4[1] == 20 && x4[2] == 30 && x4[3] == 40 &&
- x4[4] == 50);
-}
Removed: compiler-rt/trunk/test/hwasan/TestCases/register-dump-no-fp.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/hwasan/TestCases/register-dump-no-fp.cc?rev=367848&view=auto
==============================================================================
--- compiler-rt/trunk/test/hwasan/TestCases/register-dump-no-fp.cc (original)
+++ compiler-rt/trunk/test/hwasan/TestCases/register-dump-no-fp.cc (removed)
@@ -1,28 +0,0 @@
-// RUN: %clangxx_hwasan -fomit-frame-pointer -momit-leaf-frame-pointer \
-// RUN: -O0 %s -o %t && not %run %t 2>&1 | FileCheck %s --check-prefixes=CHECK
-// RUN: %clangxx_hwasan -fomit-frame-pointer -momit-leaf-frame-pointer \
-// RUN: -O1 %s -o %t && not %run %t 2>&1 | FileCheck %s --check-prefixes=CHECK
-// RUN: %clangxx_hwasan -fomit-frame-pointer -momit-leaf-frame-pointer \
-// RUN: -O2 %s -o %t && not %run %t 2>&1 | FileCheck %s --check-prefixes=CHECK
-// RUN: %clangxx_hwasan -fomit-frame-pointer -momit-leaf-frame-pointer \
-// RUN: -O3 %s -o %t && not %run %t 2>&1 | FileCheck %s --check-prefixes=CHECK
-
-// This test ensures that the CFA is implemented properly for slow
-// (non-frame-pointer) unwinding.
-#include <sanitizer/hwasan_interface.h>
-#include <stdio.h>
-#include <stdlib.h>
-
-__attribute__((noinline)) void f(int *p) { *p = 3; }
-
-// CHECK: ERROR: HWAddressSanitizer:
-// CHECK: #0 {{.*}} in f(int*) {{.*}}register-dump-no-fp.cc:[[@LINE-3]]
-
-int main() {
- __hwasan_enable_allocator_tagging();
-
- int *volatile a = new int;
- a = (int *)__hwasan_tag_pointer(a, 0);
- f(a);
- // CHECK: #1 {{.*}} in main {{.*}}register-dump-no-fp.cc:[[@LINE-1]]
-}
Copied: compiler-rt/trunk/test/hwasan/TestCases/register-dump-no-fp.cpp (from r367848, compiler-rt/trunk/test/hwasan/TestCases/register-dump-no-fp.cc)
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/hwasan/TestCases/register-dump-no-fp.cpp?p2=compiler-rt/trunk/test/hwasan/TestCases/register-dump-no-fp.cpp&p1=compiler-rt/trunk/test/hwasan/TestCases/register-dump-no-fp.cc&r1=367848&r2=367849&rev=367849&view=diff
==============================================================================
--- compiler-rt/trunk/test/hwasan/TestCases/register-dump-no-fp.cc (original)
+++ compiler-rt/trunk/test/hwasan/TestCases/register-dump-no-fp.cpp Mon Aug 5 06:10:50 2019
@@ -16,7 +16,7 @@
__attribute__((noinline)) void f(int *p) { *p = 3; }
// CHECK: ERROR: HWAddressSanitizer:
-// CHECK: #0 {{.*}} in f(int*) {{.*}}register-dump-no-fp.cc:[[@LINE-3]]
+// CHECK: #0 {{.*}} in f(int*) {{.*}}register-dump-no-fp.cpp:[[@LINE-3]]
int main() {
__hwasan_enable_allocator_tagging();
@@ -24,5 +24,5 @@ int main() {
int *volatile a = new int;
a = (int *)__hwasan_tag_pointer(a, 0);
f(a);
- // CHECK: #1 {{.*}} in main {{.*}}register-dump-no-fp.cc:[[@LINE-1]]
+ // CHECK: #1 {{.*}} in main {{.*}}register-dump-no-fp.cpp:[[@LINE-1]]
}
Removed: compiler-rt/trunk/test/hwasan/TestCases/sanitizer_malloc.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/hwasan/TestCases/sanitizer_malloc.cc?rev=367848&view=auto
==============================================================================
--- compiler-rt/trunk/test/hwasan/TestCases/sanitizer_malloc.cc (original)
+++ compiler-rt/trunk/test/hwasan/TestCases/sanitizer_malloc.cc (removed)
@@ -1,30 +0,0 @@
-// Test allocator aliases.
-//
-// RUN: %clangxx_hwasan -O0 %s -o %t && %run %t
-
-#include <sanitizer/hwasan_interface.h>
-
-int main() {
- void *volatile sink;
- sink = (void *)&__sanitizer_posix_memalign;
- sink = (void *)&__sanitizer_memalign;
- sink = (void *)&__sanitizer_aligned_alloc;
- sink = (void *)&__sanitizer___libc_memalign;
- sink = (void *)&__sanitizer_valloc;
- sink = (void *)&__sanitizer_pvalloc;
- sink = (void *)&__sanitizer_free;
- sink = (void *)&__sanitizer_cfree;
- sink = (void *)&__sanitizer_malloc_usable_size;
- sink = (void *)&__sanitizer_mallinfo;
- sink = (void *)&__sanitizer_mallopt;
- sink = (void *)&__sanitizer_malloc_stats;
- sink = (void *)&__sanitizer_calloc;
- sink = (void *)&__sanitizer_realloc;
- sink = (void *)&__sanitizer_reallocarray;
- sink = (void *)&__sanitizer_malloc;
-
- // sanity check
- void *p = __sanitizer_malloc(100);
- p = __sanitizer_realloc(p, 200);
- __sanitizer_free(p);
-}
Removed: compiler-rt/trunk/test/hwasan/TestCases/try-catch.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/hwasan/TestCases/try-catch.cc?rev=367848&view=auto
==============================================================================
--- compiler-rt/trunk/test/hwasan/TestCases/try-catch.cc (original)
+++ compiler-rt/trunk/test/hwasan/TestCases/try-catch.cc (removed)
@@ -1,63 +0,0 @@
-// RUN: %clangxx_hwasan %s -o %t && %run %t 2>&1 | FileCheck %s --check-prefix=GOOD
-// RUN: %clangxx_hwasan %s -mllvm -hwasan-instrument-landing-pads=0 -o %t && not %run %t 2>&1 | FileCheck %s --check-prefix=BAD
-
-// C++ tests on x86_64 require instrumented libc++/libstdc++.
-// REQUIRES: aarch64-target-arch
-
-#include <stdexcept>
-#include <cstdio>
-
-static void optimization_barrier(void* arg) {
- asm volatile("" : : "r"(arg) : "memory");
-}
-
-__attribute__((noinline))
-void h() {
- char x[1000];
- optimization_barrier(x);
- throw std::runtime_error("hello");
-}
-
-__attribute__((noinline))
-void g() {
- char x[1000];
- optimization_barrier(x);
- h();
- optimization_barrier(x);
-}
-
-__attribute__((noinline))
-void hwasan_read(char *p, int size) {
- char volatile sink;
- for (int i = 0; i < size; ++i)
- sink = p[i];
-}
-
-__attribute__((noinline, no_sanitize("hwaddress"))) void after_catch() {
- char x[10000];
- hwasan_read(&x[0], sizeof(x));
-}
-
-
-__attribute__((noinline))
-void f() {
- char x[1000];
- try {
- // Put two tagged frames on the stack, throw an exception from the deepest one.
- g();
- } catch (const std::runtime_error &e) {
- // Put an untagged frame on stack, check that it is indeed untagged.
- // This relies on exception support zeroing out stack tags.
- // BAD: tag-mismatch
- after_catch();
- // Check that an in-scope stack allocation is still tagged.
- // This relies on exception support not zeroing too much.
- hwasan_read(&x[0], sizeof(x));
- // GOOD: hello
- printf("%s\n", e.what());
- }
-}
-
-int main() {
- f();
-}
Modified: compiler-rt/trunk/test/hwasan/lit.cfg.py
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/hwasan/lit.cfg.py?rev=367849&r1=367848&r2=367849&view=diff
==============================================================================
--- compiler-rt/trunk/test/hwasan/lit.cfg.py (original)
+++ compiler-rt/trunk/test/hwasan/lit.cfg.py Mon Aug 5 06:10:50 2019
@@ -30,7 +30,7 @@ config.substitutions.append(('%env_hwasa
'env HWASAN_OPTIONS=' + default_hwasan_opts_str))
# Default test suffixes.
-config.suffixes = ['.c', '.cc', '.cpp']
+config.suffixes = ['.c', '.cpp']
if config.host_os not in ['Linux', 'Android']:
config.unsupported = True
More information about the llvm-commits
mailing list