summaryrefslogtreecommitdiffstats
path: root/gnu/llvm/compiler-rt/lib/gwp_asan/tests/late_init.cpp
diff options
context:
space:
mode:
authorpatrick <patrick@openbsd.org>2021-01-02 17:10:07 +0000
committerpatrick <patrick@openbsd.org>2021-01-02 17:10:07 +0000
commit1f9cb04fc6f537ca6cf5a53c28927340cba218a2 (patch)
treeb7ed93e9425eb3b3592edb1eedf5dd5ca8a1b515 /gnu/llvm/compiler-rt/lib/gwp_asan/tests/late_init.cpp
parentAdd missing .Cm macros to the Address Family table. (diff)
downloadwireguard-openbsd-1f9cb04fc6f537ca6cf5a53c28927340cba218a2.tar.xz
wireguard-openbsd-1f9cb04fc6f537ca6cf5a53c28927340cba218a2.zip
Import compiler-rt 11.0.0 release.
ok kettenis@
Diffstat (limited to 'gnu/llvm/compiler-rt/lib/gwp_asan/tests/late_init.cpp')
-rw-r--r--gnu/llvm/compiler-rt/lib/gwp_asan/tests/late_init.cpp25
1 files changed, 25 insertions, 0 deletions
diff --git a/gnu/llvm/compiler-rt/lib/gwp_asan/tests/late_init.cpp b/gnu/llvm/compiler-rt/lib/gwp_asan/tests/late_init.cpp
new file mode 100644
index 00000000000..c7d62c8f3c8
--- /dev/null
+++ b/gnu/llvm/compiler-rt/lib/gwp_asan/tests/late_init.cpp
@@ -0,0 +1,25 @@
+//===-- late_init.cpp -------------------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#include "gwp_asan/guarded_pool_allocator.h"
+#include "gwp_asan/options.h"
+#include "gtest/gtest.h"
+
+TEST(LateInit, CheckLateInitIsOK) {
+ gwp_asan::GuardedPoolAllocator GPA;
+
+ for (size_t i = 0; i < 0x100; ++i)
+ EXPECT_FALSE(GPA.shouldSample());
+
+ gwp_asan::options::Options Opts;
+ Opts.Enabled = true;
+ Opts.SampleRate = 1;
+
+ GPA.init(Opts);
+ EXPECT_TRUE(GPA.shouldSample());
+}