Add global destructor of platforms

Change-Id: I7f0c9a9a13cae5cbf831e0d4e410c78c001a75d1
Signed-off-by: Mateusz Jablonski <mateusz.jablonski@intel.com>
This commit is contained in:
Mateusz Jablonski
2020-09-01 12:38:50 +02:00
committed by sys_ocldev
parent e079d94869
commit 40d487fa90
31 changed files with 100 additions and 55 deletions

View File

@@ -55,7 +55,7 @@ struct clCreateCommandQueueWithPropertiesApi : public ApiFixture<>,
}
void SetUp() override {
platformsImpl.clear();
platformsImpl->clear();
MemoryManagementFixture::SetUp();
ApiFixture::SetUp();
}

View File

@@ -99,7 +99,7 @@ TEST_F(clGetDeviceIDsTests, GivenDeviceTypeCpuWhenGettingDeviceIdsThenDeviceNotF
}
TEST(clGetDeviceIDsTest, givenMultipleRootDevicesWhenGetDeviceIdsThenAllRootDevicesAreReturned) {
platformsImpl.clear();
platformsImpl->clear();
constexpr auto numRootDevices = 3u;
VariableBackup<UltHwConfig> backup(&ultHwConfig);
ultHwConfig.useMockedPrepareDeviceEnvironmentsFunc = false;
@@ -116,7 +116,7 @@ TEST(clGetDeviceIDsTest, givenMultipleRootDevicesWhenGetDeviceIdsThenAllRootDevi
}
}
TEST(clGetDeviceIDsTest, givenMultipleRootDevicesWhenGetDeviceIdsButNumEntriesIsLowerThanNumDevicesThenSubsetOfRootDevicesIsReturned) {
platformsImpl.clear();
platformsImpl->clear();
constexpr auto numRootDevices = 3u;
VariableBackup<UltHwConfig> backup(&ultHwConfig);
ultHwConfig.useMockedPrepareDeviceEnvironmentsFunc = false;
@@ -147,7 +147,7 @@ TEST(clGetDeviceIDsTest, givenMultipleRootDevicesWhenGetDeviceIdsButNumEntriesIs
}
TEST(clGetDeviceIDsTest, givenMultipleRootDevicesAndLimitedNumberOfReturnedDevicesWhenGetDeviceIdsThenLimitedNumberOfRootDevicesIsReturned) {
platformsImpl.clear();
platformsImpl->clear();
constexpr auto numRootDevices = 3u;
VariableBackup<UltHwConfig> backup(&ultHwConfig);
ultHwConfig.useMockedPrepareDeviceEnvironmentsFunc = false;
@@ -177,7 +177,7 @@ TEST(clGetDeviceIDsNegativeTests, whenFailToCreateDeviceThenclGetDeviceIDsReturn
DeviceFactory::createRootDeviceFunc = [](ExecutionEnvironment &executionEnvironment, uint32_t rootDeviceIndex) -> std::unique_ptr<Device> {
return nullptr;
};
platformsImpl.clear();
platformsImpl->clear();
constexpr auto numRootDevices = 3u;
cl_uint numDevices = 0;

View File

@@ -49,7 +49,7 @@ TEST_F(clGetPlatformIDsTests, GivenNumEntriesZeroAndPlatformNotNullWhenGettingPl
}
TEST(clGetPlatformIDsNegativeTests, GivenFailedInitializationWhenGettingPlatformIdsThenClOutOfHostMemoryErrorIsReturned) {
platformsImpl.clear();
platformsImpl->clear();
VariableBackup<UltHwConfig> backup{&ultHwConfig};
ultHwConfig.mockedPrepareDeviceEnvironmentsFuncResult = false;
@@ -63,14 +63,14 @@ TEST(clGetPlatformIDsNegativeTests, GivenFailedInitializationWhenGettingPlatform
EXPECT_EQ(0u, numPlatforms);
EXPECT_EQ(nullptr, platformRet);
platformsImpl.clear();
platformsImpl->clear();
}
TEST(clGetPlatformIDsNegativeTests, whenFailToCreateDeviceThenClGetPlatfomsIdsReturnsOutOfHostMemoryError) {
VariableBackup<decltype(DeviceFactory::createRootDeviceFunc)> createFuncBackup{&DeviceFactory::createRootDeviceFunc};
DeviceFactory::createRootDeviceFunc = [](ExecutionEnvironment &executionEnvironment, uint32_t rootDeviceIndex) -> std::unique_ptr<Device> {
return nullptr;
};
platformsImpl.clear();
platformsImpl->clear();
cl_int retVal = CL_SUCCESS;
cl_platform_id platformRet = nullptr;
@@ -82,7 +82,7 @@ TEST(clGetPlatformIDsNegativeTests, whenFailToCreateDeviceThenClGetPlatfomsIdsRe
EXPECT_EQ(0u, numPlatforms);
EXPECT_EQ(nullptr, platformRet);
platformsImpl.clear();
platformsImpl->clear();
}
TEST(clGetPlatformIDsNegativeTests, whenFailToCreatePlatformThenClGetPlatfomsIdsReturnsOutOfHostMemoryError) {
@@ -90,7 +90,7 @@ TEST(clGetPlatformIDsNegativeTests, whenFailToCreatePlatformThenClGetPlatfomsIds
Platform::createFunc = [](ExecutionEnvironment &executionEnvironment) -> std::unique_ptr<Platform> {
return nullptr;
};
platformsImpl.clear();
platformsImpl->clear();
cl_int retVal = CL_SUCCESS;
cl_platform_id platformRet = nullptr;
@@ -102,7 +102,7 @@ TEST(clGetPlatformIDsNegativeTests, whenFailToCreatePlatformThenClGetPlatfomsIds
EXPECT_EQ(0u, numPlatforms);
EXPECT_EQ(nullptr, platformRet);
platformsImpl.clear();
platformsImpl->clear();
}
TEST(clGetPlatformIDsNegativeTests, whenFailToInitializePlatformThenClGetPlatfomsIdsReturnsOutOfHostMemoryError) {
@@ -116,7 +116,7 @@ TEST(clGetPlatformIDsNegativeTests, whenFailToInitializePlatformThenClGetPlatfom
Platform::createFunc = [](ExecutionEnvironment &executionEnvironment) -> std::unique_ptr<Platform> {
return std::make_unique<FailingPlatform>(executionEnvironment);
};
platformsImpl.clear();
platformsImpl->clear();
cl_int retVal = CL_SUCCESS;
cl_platform_id platformRet = nullptr;
@@ -128,6 +128,6 @@ TEST(clGetPlatformIDsNegativeTests, whenFailToInitializePlatformThenClGetPlatfom
EXPECT_EQ(0u, numPlatforms);
EXPECT_EQ(nullptr, platformRet);
platformsImpl.clear();
platformsImpl->clear();
}
} // namespace ULT