summaryrefslogtreecommitdiff
path: root/test/sanitizer_common/TestCases/Linux/assert.cpp
diff options
context:
space:
mode:
authorNico Weber <nicolasweber@gmx.de>2019-08-05 13:57:03 +0000
committerNico Weber <nicolasweber@gmx.de>2019-08-05 13:57:03 +0000
commit71638dc011521b02024972b12f2dae8ba89001b0 (patch)
tree0af34b7e7c5897557f886c3c348c2cfa98e20a43 /test/sanitizer_common/TestCases/Linux/assert.cpp
parenta467d95f64447ccbca75f597d23f84f8aee9ea7e (diff)
downloadcompiler-rt-71638dc011521b02024972b12f2dae8ba89001b0.tar.gz
compiler-rt: Rename cc files below test/sanitizer_common to cpp
See r367803 and similar other changes. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@367863 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/sanitizer_common/TestCases/Linux/assert.cpp')
-rw-r--r--test/sanitizer_common/TestCases/Linux/assert.cpp25
1 files changed, 25 insertions, 0 deletions
diff --git a/test/sanitizer_common/TestCases/Linux/assert.cpp b/test/sanitizer_common/TestCases/Linux/assert.cpp
new file mode 100644
index 000000000..2a73c5088
--- /dev/null
+++ b/test/sanitizer_common/TestCases/Linux/assert.cpp
@@ -0,0 +1,25 @@
+// Test the handle_abort option.
+
+// RUN: %clangxx %s -o %t
+// RUN: not --crash %run %t 2>&1 | FileCheck --check-prefix=CHECK0 %s
+// RUN: %env_tool_opts=handle_abort=0 not --crash %run %t 2>&1 | FileCheck --check-prefix=CHECK0 %s
+// RUN: %env_tool_opts=handle_abort=1 not %run %t 2>&1 | FileCheck --check-prefix=CHECK1 %s
+
+#include <assert.h>
+#include <stdio.h>
+#include <sanitizer/asan_interface.h>
+
+void death() {
+ fprintf(stderr, "DEATH CALLBACK\n");
+}
+
+int main(int argc, char **argv) {
+ __sanitizer_set_death_callback(death);
+ assert(argc == 100);
+}
+
+// CHECK0-NOT: Sanitizer:DEADLYSIGNAL
+// CHECK1: ERROR: {{.*}}Sanitizer: ABRT
+// CHECK1: {{ #0 }}
+// CHECK1: DEATH CALLBACK
+// CHECK0-NOT: Sanitizer