Add a getRootDeviceIndex method

Change-Id: I7f46a42b5ce25a53365b9faaeba62f2c3232f104
Signed-off-by: Jobczyk, Lukasz <lukasz.jobczyk@intel.com>
This commit is contained in:
Jobczyk, Lukasz
2019-10-21 13:41:35 +02:00
committed by sys_ocldev
parent 9ed6194420
commit 77d7d9f740
6 changed files with 25 additions and 0 deletions

View File

@@ -22,6 +22,21 @@ TEST(SubDevicesTest, givenDefaultConfigWhenCreateRootDeviceThenItDoesntContainSu
EXPECT_EQ(1u, device->getNumAvailableDevices());
}
TEST(SubDevicesTest, givenCreateMultipleSubDevicesFlagSetWhenCreateRootDeviceThenItsSubdevicesHaveProperRootIdSet) {
DebugManagerStateRestore restorer;
DebugManager.flags.CreateMultipleSubDevices.set(2);
auto device = std::unique_ptr<MockDevice>(MockDevice::createWithNewExecutionEnvironment<MockDevice>(*platformDevices));
EXPECT_EQ(2u, device->getNumSubDevices());
EXPECT_EQ(0u, device->getDeviceIndex());
EXPECT_EQ(1u, device->subdevices.at(0)->getDeviceIndex());
EXPECT_EQ(2u, device->subdevices.at(1)->getDeviceIndex());
EXPECT_EQ(0u, device->getRootDeviceIndex());
EXPECT_EQ(0u, device->subdevices.at(0)->getRootDeviceIndex());
EXPECT_EQ(0u, device->subdevices.at(1)->getRootDeviceIndex());
}
TEST(SubDevicesTest, givenCreateMultipleSubDevicesFlagSetWhenCreateRootDeviceThenItContainsSubDevices) {
DebugManagerStateRestore restorer;
DebugManager.flags.CreateMultipleSubDevices.set(2);