Fix ocloc options parsing

Signed-off-by: Mateusz Hoppe <mateusz.hoppe@intel.com>
This commit is contained in:
Mateusz Hoppe
2021-10-12 08:15:25 +00:00
committed by Compute-Runtime-Automation
parent 281a23419a
commit 02d8b3a024
2 changed files with 20 additions and 1 deletions

View File

@ -370,6 +370,25 @@ TEST_F(OfflineCompilerTests, givenDebugOptionThenInternalOptionShouldContainKern
EXPECT_THAT(internalOptions, ::testing::HasSubstr("-cl-kernel-debug-enable"));
}
TEST_F(OfflineCompilerTests, givenDashGInBiggerOptionStringWhenInitializingThenInternalOptionsShouldNotContainKernelDebugEnable) {
std::vector<std::string> argv = {
"ocloc",
"-options",
"-gNotRealDashGOption",
"-file",
"test_files/copybuffer.cl",
"-device",
gEnvironment->devicePrefix.c_str()};
auto mockOfflineCompiler = std::unique_ptr<MockOfflineCompiler>(new MockOfflineCompiler());
ASSERT_NE(nullptr, mockOfflineCompiler);
mockOfflineCompiler->initialize(argv.size(), argv);
std::string internalOptions = mockOfflineCompiler->internalOptions;
EXPECT_THAT(internalOptions, ::testing::Not(::testing::HasSubstr("-cl-kernel-debug-enable")));
}
TEST_F(OfflineCompilerTests, givenVariousClStdValuesWhenCompilingSourceThenCorrectExtensionsArePassed) {
std::string clStdOptionValues[] = {"", "-cl-std=CL1.2", "-cl-std=CL2.0", "-cl-std=CL3.0"};

View File

@ -449,7 +449,7 @@ int OfflineCompiler::initialize(size_t numArgs, const std::vector<std::string> &
return retVal;
}
if (options.find(CompilerOptions::generateDebugInfo.str()) != std::string::npos) {
if (CompilerOptions::contains(options, CompilerOptions::generateDebugInfo.str())) {
if (hwInfo.platform.eRenderCoreFamily >= IGFX_GEN9_CORE) {
internalOptions = CompilerOptions::concatenate(internalOptions, CompilerOptions::debugKernelEnable);
}