2017-12-21 07:45:38 +08:00
|
|
|
/*
|
2019-01-04 00:52:08 +08:00
|
|
|
* Copyright (C) 2017-2019 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
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2018-07-25 23:12:44 +08:00
|
|
|
#include "unit_tests/fixtures/device_fixture.h"
|
2017-12-21 07:45:38 +08:00
|
|
|
|
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() {
|
2019-05-08 23:16:25 +08:00
|
|
|
hardwareInfo = *platformDevices[0];
|
|
|
|
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) {
|
2018-07-25 23:12:44 +08:00
|
|
|
pDevice = MockDevice::createWithNewExecutionEnvironment<MockDevice>(hardwareInfo);
|
2017-12-21 07:45:38 +08:00
|
|
|
ASSERT_NE(nullptr, pDevice);
|
|
|
|
|
|
|
|
auto &commandStreamReceiver = pDevice->getCommandStreamReceiver();
|
|
|
|
pTagMemory = commandStreamReceiver.getTagAddress();
|
|
|
|
ASSERT_NE(nullptr, const_cast<uint32_t *>(pTagMemory));
|
|
|
|
}
|
|
|
|
|
|
|
|
void DeviceFixture::TearDown() {
|
|
|
|
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) {
|
2019-05-08 23:16:25 +08:00
|
|
|
hardwareInfo = *platformDevices[0];
|
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
|