[ASan/Win] Add an OOM test
authorTimur Iskhodzhanov <timurrrr@google.com>
Mon, 16 Feb 2015 15:24:20 +0000 (15:24 +0000)
committerTimur Iskhodzhanov <timurrrr@google.com>
Mon, 16 Feb 2015 15:24:20 +0000 (15:24 +0000)
llvm-svn: 229399

compiler-rt/test/asan/TestCases/Windows/oom.cc [new file with mode: 0644]

diff --git a/compiler-rt/test/asan/TestCases/Windows/oom.cc b/compiler-rt/test/asan/TestCases/Windows/oom.cc
new file mode 100644 (file)
index 0000000..b24cddf
--- /dev/null
@@ -0,0 +1,12 @@
+// RUN: %clang_cl_asan -O0 %s -Fe%t
+// RUN: not %run %t 2>&1 | FileCheck %s
+
+#include <malloc.h>
+
+int main() {
+  while (true) {
+    void *ptr = malloc(200 * 1024 * 1024);  // 200MB
+    free(ptr);
+  }
+// CHECK: failed to allocate
+}