mirror of
https://github.com/intel/compute-runtime.git
synced 2026-01-13 01:42:56 +08:00
Refactor duplicate Linux code.
Related-To: NEO-3008 Change-Id: Ia920fc9e4b948fb73fe6c6abc7d2c35f1814dc85 Signed-off-by: Piotr Fusik <piotr.fusik@intel.com>
This commit is contained in:
@@ -66,9 +66,8 @@ TEST_F(DrmBufferObjectTest, exec) {
|
||||
mock->ioctl_expected.total = 1;
|
||||
mock->ioctl_res = 0;
|
||||
|
||||
BufferObject::ResidencyVector residency;
|
||||
drm_i915_gem_exec_object2 execObjectsStorage = {};
|
||||
auto ret = bo->exec(0, 0, 0, false, 1, residency, &execObjectsStorage);
|
||||
auto ret = bo->exec(0, 0, 0, false, 1, nullptr, 0u, &execObjectsStorage);
|
||||
EXPECT_EQ(mock->ioctl_res, ret);
|
||||
EXPECT_EQ(0u, mock->execBuffer.flags);
|
||||
}
|
||||
@@ -76,9 +75,9 @@ TEST_F(DrmBufferObjectTest, exec) {
|
||||
TEST_F(DrmBufferObjectTest, exec_ioctlFailed) {
|
||||
mock->ioctl_expected.total = 1;
|
||||
mock->ioctl_res = -1;
|
||||
BufferObject::ResidencyVector residency;
|
||||
mock->errnoValue = EFAULT;
|
||||
drm_i915_gem_exec_object2 execObjectsStorage = {};
|
||||
EXPECT_THROW(bo->exec(0, 0, 0, false, 1, residency, &execObjectsStorage), std::exception);
|
||||
EXPECT_EQ(EFAULT, bo->exec(0, 0, 0, false, 1, nullptr, 0u, &execObjectsStorage));
|
||||
}
|
||||
|
||||
TEST_F(DrmBufferObjectTest, setTiling_success) {
|
||||
|
||||
@@ -165,8 +165,7 @@ TEST_F(DrmMemoryManagerTest, givenDrmContextIdWhenAllocationIsCreatedThenPinWith
|
||||
mock->ioctl_expected.gemClose = 2;
|
||||
|
||||
auto memoryManager = std::make_unique<TestedDrmMemoryManager>(false, true, false, *executionEnvironment);
|
||||
auto &osContextLinux = static_cast<OsContextLinux &>(memoryManager->getDefaultCommandStreamReceiver(0)->getOsContext());
|
||||
auto drmContextId = osContextLinux.getDrmContextId();
|
||||
auto drmContextId = memoryManager->getDefaultDrmContextId();
|
||||
ASSERT_NE(nullptr, memoryManager->getPinBB());
|
||||
EXPECT_NE(0u, drmContextId);
|
||||
|
||||
|
||||
@@ -180,13 +180,15 @@ TEST(DrmTest, givenDrmWhenOsContextIsCreatedThenCreateAndDestroyNewDrmOsContext)
|
||||
drmMock.StoredCtxId = drmContextId1;
|
||||
OsContextLinux osContext1(drmMock, 0u, 1, aub_stream::ENGINE_RCS, PreemptionMode::Disabled, false);
|
||||
|
||||
EXPECT_EQ(drmContextId1, osContext1.getDrmContextId());
|
||||
EXPECT_EQ(1u, osContext1.getDrmContextIds().size());
|
||||
EXPECT_EQ(drmContextId1, osContext1.getDrmContextIds()[0]);
|
||||
EXPECT_EQ(0u, drmMock.receivedDestroyContextId);
|
||||
|
||||
{
|
||||
drmMock.StoredCtxId = drmContextId2;
|
||||
OsContextLinux osContext2(drmMock, 0u, 1, aub_stream::ENGINE_RCS, PreemptionMode::Disabled, false);
|
||||
EXPECT_EQ(drmContextId2, osContext2.getDrmContextId());
|
||||
EXPECT_EQ(1u, osContext2.getDrmContextIds().size());
|
||||
EXPECT_EQ(drmContextId2, osContext2.getDrmContextIds()[0]);
|
||||
EXPECT_EQ(0u, drmMock.receivedDestroyContextId);
|
||||
}
|
||||
EXPECT_EQ(drmContextId2, drmMock.receivedDestroyContextId);
|
||||
|
||||
Reference in New Issue
Block a user