2017-12-21 07:45:38 +08:00
|
|
|
/*
|
2021-01-21 20:10:13 +08:00
|
|
|
* Copyright (C) 2020-2021 Intel Corporation
|
2017-12-21 07:45:38 +08:00
|
|
|
*
|
2018-09-18 15:11:08 +08:00
|
|
|
* SPDX-License-Identifier: MIT
|
2017-12-21 07:45:38 +08:00
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2021-01-21 20:10:13 +08:00
|
|
|
#include "shared/test/common/fixtures/device_fixture.h"
|
2017-12-21 07:45:38 +08:00
|
|
|
|
2021-04-16 20:52:30 +08:00
|
|
|
#include "shared/source/built_ins/sip.h"
|
|
|
|
|
2019-02-27 18:39:32 +08:00
|
|
|
#include "gtest/gtest.h"
|
|
|
|
|
2019-03-26 18:59:46 +08:00
|
|
|
namespace NEO {
|
2017-12-21 07:45:38 +08:00
|
|
|
void DeviceFixture::SetUp() {
|
2020-03-24 18:42:54 +08:00
|
|
|
hardwareInfo = *defaultHwInfo;
|
2019-05-08 23:16:25 +08:00
|
|
|
SetUpImpl(&hardwareInfo);
|
2017-12-21 07:45:38 +08:00
|
|
|
}
|
|
|
|
|
2019-03-26 18:59:46 +08:00
|
|
|
void DeviceFixture::SetUpImpl(const NEO::HardwareInfo *hardwareInfo) {
|
2021-12-21 02:16:04 +08:00
|
|
|
pDevice = MockDevice::createWithNewExecutionEnvironment<MockDevice>(hardwareInfo, rootDeviceIndex);
|
2017-12-21 07:45:38 +08:00
|
|
|
ASSERT_NE(nullptr, pDevice);
|
|
|
|
|
2019-07-15 20:28:09 +08:00
|
|
|
auto &commandStreamReceiver = pDevice->getGpgpuCommandStreamReceiver();
|
2017-12-21 07:45:38 +08:00
|
|
|
pTagMemory = commandStreamReceiver.getTagAddress();
|
|
|
|
ASSERT_NE(nullptr, const_cast<uint32_t *>(pTagMemory));
|
|
|
|
}
|
|
|
|
|
|
|
|
void DeviceFixture::TearDown() {
|
2020-05-28 20:05:12 +08:00
|
|
|
delete pDevice;
|
2019-02-04 20:08:47 +08:00
|
|
|
pDevice = nullptr;
|
2017-12-21 07:45:38 +08:00
|
|
|
}
|
|
|
|
|
2018-07-25 23:12:44 +08:00
|
|
|
MockDevice *DeviceFixture::createWithUsDeviceId(unsigned short usDeviceId) {
|
2020-03-24 18:42:54 +08:00
|
|
|
hardwareInfo = *defaultHwInfo;
|
2019-05-08 22:00:24 +08:00
|
|
|
hardwareInfo.platform.usDeviceID = usDeviceId;
|
2019-05-08 23:16:25 +08:00
|
|
|
return MockDevice::createWithNewExecutionEnvironment<MockDevice>(&hardwareInfo);
|
2017-12-21 07:45:38 +08:00
|
|
|
}
|
2019-03-26 18:59:46 +08:00
|
|
|
} // namespace NEO
|