Files
compute-runtime/opencl/test/unit_test/fixtures/memory_management_fixture.h
Pawel Cieslak 8a700c5187 Move non-ult shared files to single directory
Add SKIP_SHARED_UNIT_TESTS flag

Related-To: NEO-5201
Signed-off-by: Pawel Cieslak <pawel.cieslak@intel.com>
2021-02-10 21:03:13 +01:00

43 lines
1.1 KiB
C++

/*
* Copyright (C) 2017-2021 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
#pragma once
#include "shared/test/common/helpers/memory_management.h"
#include "gtest/gtest.h"
#include <functional>
struct MemoryManagementFixture {
MemoryManagementFixture() {
MemoryManagement::detailedAllocationLoggingActive = true;
};
virtual ~MemoryManagementFixture() { MemoryManagement::detailedAllocationLoggingActive = false; };
// Typical Fixture methods
virtual void SetUp(void);
virtual void TearDown(void);
// Helper methods
void setFailingAllocation(size_t allocation);
void clearFailingAllocation(void);
::testing::AssertionResult assertLeak(
const char *leakExpr,
size_t leakIndex);
void checkForLeaks(void);
typedef std::function<void(size_t)> InjectedFunction;
void injectFailures(InjectedFunction &method, uint32_t maxIndex = 0);
void injectFailureOnIndex(InjectedFunction &method, uint32_t index);
// Used to keep track of # of allocations prior at SetUp time
// Gets compared to # at TearDown time
size_t previousAllocations;
};