Require OpenCLDriverName in DeviceRegistryPath

Change-Id: I93a8ca95082f6ddb48adffe33145568f32d77418
Signed-off-by: Mateusz Jablonski <mateusz.jablonski@intel.com>
This commit is contained in:
Jaroslaw Chodor
2020-08-24 01:55:47 +02:00
committed by Mateusz Jablonski
parent e729995f2c
commit 39f42b20ba
9 changed files with 42 additions and 4 deletions

View File

@ -118,9 +118,10 @@ class MockRegistryReader : public SettingsReader {
} else if (key == "UserModeDriverNameWOW") {
properMediaSharingExtensions = true;
return returnString;
}
if (key == "DriverStorePathForComputeRuntime") {
} else if (key == "DriverStorePathForComputeRuntime") {
return driverStorePath;
} else if (key == "OpenCLDriverName") {
return openCLDriverName;
}
return value;
}
@ -133,6 +134,7 @@ class MockRegistryReader : public SettingsReader {
bool properNameKey = false;
bool properVersionKey = false;
std::string driverStorePath = "driverStore\\0x8086";
std::string openCLDriverName = "igdrcl.dll";
bool properMediaSharingExtensions = false;
bool using64bit = false;
std::string returnString = "";
@ -231,6 +233,15 @@ TEST(DriverInfo, givenInitializedOsInterfaceWhenCreateDriverInfoWindowsThenSetRe
EXPECT_STREQ(driverInfo->getRegistryReaderRegKey(), driverInfo->reader->getRegKey());
};
TEST_F(DriverInfoWindowsTest, whenThereIsNoOpenCLDriverNamePointedByDriverInfoThenItIsNotCompatible) {
VariableBackup<const wchar_t *> currentLibraryPathBackup(&SysCalls::currentLibraryPath);
currentLibraryPathBackup = L"driverStore\\0x8086\\myLib.dll";
static_cast<MockRegistryReader *>(driverInfo->registryReader.get())->openCLDriverName = "";
EXPECT_FALSE(driverInfo->isCompatibleDriverStore());
}
TEST_F(DriverInfoWindowsTest, whenCurrentLibraryIsLoadedFromDriverStorePointedByDriverInfoThenItIsCompatible) {
VariableBackup<const wchar_t *> currentLibraryPathBackup(&SysCalls::currentLibraryPath);
currentLibraryPathBackup = L"driverStore\\0x8086\\myLib.dll";

View File

@ -45,6 +45,15 @@ DWORD getModuleFileName(HMODULE hModule, LPWSTR lpFilename, DWORD nSize) {
lstrcpyW(lpFilename, currentLibraryPath);
return TRUE;
}
char *openCLDriverName = "igdrcl.dll";
char *getenv(const char *variableName) {
if (strcmp(variableName, "OpenCLDriverName") == 0) {
return openCLDriverName;
}
return ::getenv(variableName);
}
} // namespace SysCalls
} // namespace NEO