diff options
Diffstat (limited to 'test/hwasan')
-rw-r--r-- | test/hwasan/TestCases/halt-on-error.cc | 38 |
1 files changed, 27 insertions, 11 deletions
diff --git a/test/hwasan/TestCases/halt-on-error.cc b/test/hwasan/TestCases/halt-on-error.cc index 7c3cc5c68..fdf6d27d7 100644 --- a/test/hwasan/TestCases/halt-on-error.cc +++ b/test/hwasan/TestCases/halt-on-error.cc @@ -1,4 +1,19 @@ -// RUN: %clangxx_hwasan -O0 %s -o %t && not %env_hwasan_opts=halt_on_error=0 %run %t 2>&1 | FileCheck %s +// 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> @@ -10,17 +25,18 @@ int main() { free(x); __hwasan_disable_allocator_tagging(); return x[2] + ((char *)x)[6] + ((char *)x)[9]; - // CHECK: READ of size 4 at - // CHECK: #0 {{.*}} in main {{.*}}halt-on-error.cc:12 - // CHECK: SUMMARY: HWAddressSanitizer: tag-mismatch {{.*}} in main + // 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 - // CHECK: READ of size 1 at - // CHECK: #0 {{.*}} in main {{.*}}halt-on-error.cc:12 - // CHECK: SUMMARY: HWAddressSanitizer: tag-mismatch {{.*}} in main + // RECOVER: READ of size 1 at + // RECOVER: #{{.*}} in main {{.*}}halt-on-error.cc:27 + // RECOVER: SUMMARY: HWAddressSanitizer: tag-mismatch {{.*}} in - // CHECK: READ of size 1 at - // CHECK: #0 {{.*}} in main {{.*}}halt-on-error.cc:12 - // CHECK: SUMMARY: HWAddressSanitizer: tag-mismatch {{.*}} in main + // RECOVER: READ of size 1 at + // RECOVER: #{{.*}} in main {{.*}}halt-on-error.cc:27 + // RECOVER: SUMMARY: HWAddressSanitizer: tag-mismatch {{.*}} in - // CHECK-NOT: tag-mismatch + // COMMON-NOT: tag-mismatch } |