diff --git a/runtime/platform/extensions.cpp b/runtime/platform/extensions.cpp index c3f51818d3..551967717b 100644 --- a/runtime/platform/extensions.cpp +++ b/runtime/platform/extensions.cpp @@ -83,7 +83,7 @@ std::string convertEnabledExtensionsToCompilerInternalOptions(const char *enable while ((pos = extensionsList.find(" ", pos)) != std::string::npos) { extensionsList.replace(pos, 1, ",+"); } - extensionsList = " -cl-ext=-all,+" + extensionsList; + extensionsList = " -cl-ext=-all,+" + extensionsList + " "; return extensionsList; } diff --git a/unit_tests/platform/platform_tests.cpp b/unit_tests/platform/platform_tests.cpp index aa630b5253..db23d0bf6f 100644 --- a/unit_tests/platform/platform_tests.cpp +++ b/unit_tests/platform/platform_tests.cpp @@ -148,7 +148,7 @@ TEST_F(PlatformFailingTest, givenPlatformInitializationWhenIncorrectHwInfoThenIn delete platform; } -TEST_F(PlatformTest, getAsCompilerEnabledExtensionsString) { +TEST_F(PlatformTest, givenSupportingCl21WhenPlatformSupportsFp64ThenFillMatchingSubstringsAndMandatoryTrailingSpace) { const HardwareInfo *hwInfo; hwInfo = platformDevices[0]; std::string extensionsList = getExtensionsList(*hwInfo); @@ -165,9 +165,11 @@ TEST_F(PlatformTest, getAsCompilerEnabledExtensionsString) { if (hwInfo->capabilityTable.ftrSupportsFP64) { EXPECT_THAT(compilerExtensions, ::testing::HasSubstr(std::string("cl_khr_fp64"))); } + + EXPECT_THAT(compilerExtensions, ::testing::EndsWith(std::string(" "))); } -TEST_F(PlatformTest, getAsCompilerEnabledExtensionsStringTestNotFP64) { +TEST_F(PlatformTest, givenNotSupportingCl21WhenPlatformNotSupportFp64ThenNotFillMatchingSubstringAndFillMandatoryTrailingSpace) { HardwareInfo TesthwInfo = *platformDevices[0]; TesthwInfo.capabilityTable.ftrSupportsFP64 = false; TesthwInfo.capabilityTable.clVersionSupport = 10; @@ -180,6 +182,8 @@ TEST_F(PlatformTest, getAsCompilerEnabledExtensionsStringTestNotFP64) { EXPECT_THAT(compilerExtensions, ::testing::Not(::testing::HasSubstr(std::string("cl_khr_fp64")))); EXPECT_THAT(compilerExtensions, ::testing::Not(::testing::HasSubstr(std::string("cl_khr_subgroups")))); + + EXPECT_THAT(compilerExtensions, ::testing::EndsWith(std::string(" "))); } TEST_F(PlatformTest, testRemoveLastSpace) {