diff --git a/opencl/test/unit_test/offline_compiler/offline_compiler_tests.cpp b/opencl/test/unit_test/offline_compiler/offline_compiler_tests.cpp index b62bf47341..0f6c2f0b9c 100644 --- a/opencl/test/unit_test/offline_compiler/offline_compiler_tests.cpp +++ b/opencl/test/unit_test/offline_compiler/offline_compiler_tests.cpp @@ -370,6 +370,25 @@ TEST_F(OfflineCompilerTests, givenDebugOptionThenInternalOptionShouldContainKern EXPECT_THAT(internalOptions, ::testing::HasSubstr("-cl-kernel-debug-enable")); } +TEST_F(OfflineCompilerTests, givenDashGInBiggerOptionStringWhenInitializingThenInternalOptionsShouldNotContainKernelDebugEnable) { + + std::vector argv = { + "ocloc", + "-options", + "-gNotRealDashGOption", + "-file", + "test_files/copybuffer.cl", + "-device", + gEnvironment->devicePrefix.c_str()}; + + auto mockOfflineCompiler = std::unique_ptr(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"}; diff --git a/shared/offline_compiler/source/offline_compiler.cpp b/shared/offline_compiler/source/offline_compiler.cpp index 01d5745dde..3ba7b1c779 100644 --- a/shared/offline_compiler/source/offline_compiler.cpp +++ b/shared/offline_compiler/source/offline_compiler.cpp @@ -449,7 +449,7 @@ int OfflineCompiler::initialize(size_t numArgs, const std::vector & 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); }