Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / compiler-rt / lib / gwp_asan / tests / late_init.cpp
blob8a947270c2d651f8474f94f551170cba8fd1c1eb
1 //===-- late_init.cpp -------------------------------------------*- C++ -*-===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
9 #include "gwp_asan/guarded_pool_allocator.h"
10 #include "gwp_asan/options.h"
11 #include "gwp_asan/tests/harness.h"
13 TEST(LateInit, CheckLateInitIsOK) {
14 gwp_asan::GuardedPoolAllocator GPA;
16 for (size_t i = 0; i < 0x100; ++i)
17 EXPECT_FALSE(GPA.shouldSample());
19 gwp_asan::options::Options Opts;
20 Opts.Enabled = true;
21 Opts.SampleRate = 1;
23 GPA.init(Opts);
24 EXPECT_TRUE(GPA.shouldSample());