fix: ensure system info is queried only once

Signed-off-by: Mateusz Jablonski <mateusz.jablonski@intel.com>
This commit is contained in:
Mateusz Jablonski
2024-07-26 11:59:53 +00:00
committed by Compute-Runtime-Automation
parent 0cdfa882eb
commit 7f6c6c6bb9
3 changed files with 20 additions and 0 deletions

View File

@@ -130,6 +130,21 @@ TEST(DrmSystemInfoTest, whenSetupHardwareInfoThenReleaseHelperContainsCorrectIpV
EXPECT_EQ(55u, exposedReleaseHelper->hardwareIpVersion.release);
}
TEST(DrmSystemInfoTest, whenQueryingSystemInfoTwiceThenSystemInfoIsCreatedOnlyOnce) {
auto executionEnvironment = std::make_unique<MockExecutionEnvironment>();
DrmMockEngine drm(*executionEnvironment->rootDeviceEnvironments[0]);
EXPECT_TRUE(drm.querySystemInfo());
auto systemInfo = drm.getSystemInfo();
EXPECT_NE(nullptr, systemInfo);
EXPECT_EQ(2u + drm.getBaseIoctlCalls(), drm.ioctlCallsCount);
EXPECT_TRUE(drm.querySystemInfo());
EXPECT_EQ(systemInfo, drm.getSystemInfo());
EXPECT_EQ(2u + drm.getBaseIoctlCalls(), drm.ioctlCallsCount);
}
TEST(DrmSystemInfoTest, whenQueryingSystemInfoThenSystemInfoIsCreatedAndReturnsNonZeros) {
auto executionEnvironment = std::make_unique<MockExecutionEnvironment>();
DrmMockEngine drm(*executionEnvironment->rootDeviceEnvironments[0]);