From 316d58822dada9440bd06ecfc758dcc2364d617c Mon Sep 17 00:00:00 2001 From: Dimitry Andric Date: Mon, 2 Jan 2017 19:18:27 +0000 Subject: Vendor import of compiler-rt trunk r290819: https://llvm.org/svn/llvm-project/compiler-rt/trunk@290819 --- test/scudo/interface.cpp | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 test/scudo/interface.cpp (limited to 'test/scudo/interface.cpp') diff --git a/test/scudo/interface.cpp b/test/scudo/interface.cpp new file mode 100644 index 0000000000000..f9353066efa37 --- /dev/null +++ b/test/scudo/interface.cpp @@ -0,0 +1,28 @@ +// RUN: %clang_scudo %s -o %t +// RUN: %run %t 2>&1 + +// Tests that the sanitizer interface functions behave appropriately. + +#include + +#include + +#include + +int main(int argc, char **argv) +{ + void *p; + std::vector sizes{1, 8, 16, 32, 1024, 32768, + 1 << 16, 1 << 17, 1 << 20, 1 << 24}; + for (size_t size : sizes) { + p = malloc(size); + if (!p) + return 1; + if (!__sanitizer_get_ownership(p)) + return 1; + if (__sanitizer_get_allocated_size(p) < size) + return 1; + free(p); + } + return 0; +} -- cgit v1.2.3