[test/sanitizer-common] Linux/sanitizer_set_death_callback_test.cc -> Posix/sanitizer...
authorFilipe Cabecinhas <me@filcab.net>
Wed, 9 Mar 2016 15:39:49 +0000 (15:39 +0000)
committerFilipe Cabecinhas <me@filcab.net>
Wed, 9 Mar 2016 15:39:49 +0000 (15:39 +0000)
llvm-svn: 263018

compiler-rt/test/sanitizer_common/TestCases/Linux/sanitizer_set_death_callback_test.cc [deleted file]
compiler-rt/test/sanitizer_common/TestCases/Posix/sanitizer_set_death_callback_test.cc [new file with mode: 0644]

diff --git a/compiler-rt/test/sanitizer_common/TestCases/Linux/sanitizer_set_death_callback_test.cc b/compiler-rt/test/sanitizer_common/TestCases/Linux/sanitizer_set_death_callback_test.cc
deleted file mode 100644 (file)
index fdb68c0..0000000
+++ /dev/null
@@ -1,40 +0,0 @@
-// RUN: %clangxx -O2 %s -o %t && not %run %t 2>&1 | FileCheck %s
-
-// REQUIRES: stable-runtime
-
-#include <sanitizer/common_interface_defs.h>
-#include <stdio.h>
-
-volatile char *zero = 0;
-
-void Death() {
-  fprintf(stderr, "DEATH CALLBACK EXECUTED\n");
-}
-// CHECK: DEATH CALLBACK EXECUTED
-
-char global;
-volatile char *sink;
-
-__attribute__((noinline))
-void MaybeInit(int *uninitialized) {
-  if (zero)
-    *uninitialized = 1;
-}
-
-__attribute__((noinline))
-void Leak() {
-  sink = new char[100];  // trigger lsan report.
-}
-
-int main(int argc, char **argv) {
-  int uninitialized;
-  __sanitizer_set_death_callback(Death);
-  MaybeInit(&uninitialized);
-  if (uninitialized)  // trigger msan report.
-    global = 77;
-  sink = new char[100];
-  delete[] sink;
-  global = sink[0];  // use-after-free: trigger asan/tsan report.
-  Leak();
-  sink = 0;
-}
diff --git a/compiler-rt/test/sanitizer_common/TestCases/Posix/sanitizer_set_death_callback_test.cc b/compiler-rt/test/sanitizer_common/TestCases/Posix/sanitizer_set_death_callback_test.cc
new file mode 100644 (file)
index 0000000..fdb68c0
--- /dev/null
@@ -0,0 +1,40 @@
+// RUN: %clangxx -O2 %s -o %t && not %run %t 2>&1 | FileCheck %s
+
+// REQUIRES: stable-runtime
+
+#include <sanitizer/common_interface_defs.h>
+#include <stdio.h>
+
+volatile char *zero = 0;
+
+void Death() {
+  fprintf(stderr, "DEATH CALLBACK EXECUTED\n");
+}
+// CHECK: DEATH CALLBACK EXECUTED
+
+char global;
+volatile char *sink;
+
+__attribute__((noinline))
+void MaybeInit(int *uninitialized) {
+  if (zero)
+    *uninitialized = 1;
+}
+
+__attribute__((noinline))
+void Leak() {
+  sink = new char[100];  // trigger lsan report.
+}
+
+int main(int argc, char **argv) {
+  int uninitialized;
+  __sanitizer_set_death_callback(Death);
+  MaybeInit(&uninitialized);
+  if (uninitialized)  // trigger msan report.
+    global = 77;
+  sink = new char[100];
+  delete[] sink;
+  global = sink[0];  // use-after-free: trigger asan/tsan report.
+  Leak();
+  sink = 0;
+}