compute-runtime/shared/test/unit_test/fixtures/mock_aub_center_fixture.h

43 lines
1.6 KiB
C++

/*
* Copyright (C) 2019-2021 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
#pragma once
#include "shared/source/execution_environment/root_device_environment.h"
#include "shared/test/common/helpers/default_hw_info.h"
#include "shared/test/common/mocks/mock_aub_center.h"
#include "shared/test/common/mocks/mock_aub_manager.h"
#include "shared/test/unit_test/tests_configuration.h"
namespace NEO {
struct MockAubCenterFixture {
MockAubCenterFixture() = default;
MockAubCenterFixture(CommandStreamReceiverType commandStreamReceiverType) : commandStreamReceiverType(commandStreamReceiverType){};
void SetUp() { // NOLINT(readability-identifier-naming)
}
void TearDown() { // NOLINT(readability-identifier-naming)
}
static void setMockAubCenter(RootDeviceEnvironment &rootDeviceEnvironment) {
setMockAubCenter(rootDeviceEnvironment, CommandStreamReceiverType::CSR_AUB);
}
static void setMockAubCenter(RootDeviceEnvironment &rootDeviceEnvironment, CommandStreamReceiverType commandStreamReceiverType) {
if (testMode != TestMode::AubTests && testMode != TestMode::AubTestsWithTbx) {
rootDeviceEnvironment.initGmm();
auto mockAubCenter = std::make_unique<MockAubCenter>(defaultHwInfo.get(), *rootDeviceEnvironment.getGmmHelper(), false, "", commandStreamReceiverType);
mockAubCenter->aubManager = std::make_unique<MockAubManager>();
rootDeviceEnvironment.aubCenter.reset(mockAubCenter.release());
}
}
protected:
CommandStreamReceiverType commandStreamReceiverType = CommandStreamReceiverType::CSR_AUB;
};
} // namespace NEO