11f9cb04fSpatrick //===-- late_init.cpp -------------------------------------------*- C++ -*-===// 21f9cb04fSpatrick // 31f9cb04fSpatrick // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 41f9cb04fSpatrick // See https://llvm.org/LICENSE.txt for license information. 51f9cb04fSpatrick // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 61f9cb04fSpatrick // 71f9cb04fSpatrick //===----------------------------------------------------------------------===// 81f9cb04fSpatrick 91f9cb04fSpatrick #include "gwp_asan/guarded_pool_allocator.h" 101f9cb04fSpatrick #include "gwp_asan/options.h" 11*d89ec533Spatrick #include "gwp_asan/tests/harness.h" 121f9cb04fSpatrick TEST(LateInit,CheckLateInitIsOK)131f9cb04fSpatrickTEST(LateInit, CheckLateInitIsOK) { 141f9cb04fSpatrick gwp_asan::GuardedPoolAllocator GPA; 151f9cb04fSpatrick 161f9cb04fSpatrick for (size_t i = 0; i < 0x100; ++i) 171f9cb04fSpatrick EXPECT_FALSE(GPA.shouldSample()); 181f9cb04fSpatrick 191f9cb04fSpatrick gwp_asan::options::Options Opts; 201f9cb04fSpatrick Opts.Enabled = true; 211f9cb04fSpatrick Opts.SampleRate = 1; 221f9cb04fSpatrick 231f9cb04fSpatrick GPA.init(Opts); 241f9cb04fSpatrick EXPECT_TRUE(GPA.shouldSample()); 251f9cb04fSpatrick } 26