@@ -357,7 +357,7 @@ TEST_F(CompilerInterfaceCachedTests, notCachedAndIgcFailed) {
357357 TranslationArgs inputArgs;
358358
359359 inputArgs.pInput = new char [128 ];
360- strcpy_s (inputArgs.pInput , 128 , " __kernel k() {}" );
360+ strcpy_s (inputArgs.pInput , 128 , " #include \" header.h \"\n __kernel k() {}" );
361361 inputArgs.InputSize = static_cast <uint32_t >(strlen (inputArgs.pInput ));
362362
363363 MockCompilerDebugVars fclDebugVars;
@@ -388,7 +388,7 @@ TEST_F(CompilerInterfaceCachedTests, wasCached) {
388388 TranslationArgs inputArgs;
389389
390390 inputArgs.pInput = new char [128 ];
391- strcpy_s (inputArgs.pInput , 128 , " __kernel k() {}" );
391+ strcpy_s (inputArgs.pInput , 128 , " #include \" header.h \"\n __kernel k() {}" );
392392 inputArgs.InputSize = static_cast <uint32_t >(strlen (inputArgs.pInput ));
393393
394394 MockCompilerDebugVars fclDebugVars;
@@ -419,7 +419,7 @@ TEST_F(CompilerInterfaceCachedTests, builtThenCached) {
419419 TranslationArgs inputArgs;
420420
421421 inputArgs.pInput = new char [128 ];
422- strcpy_s (inputArgs.pInput , 128 , " __kernel k() {}" );
422+ strcpy_s (inputArgs.pInput , 128 , " #include \" header.h \"\n __kernel k() {}" );
423423 inputArgs.InputSize = static_cast <uint32_t >(strlen (inputArgs.pInput ));
424424
425425 MockCompilerDebugVars fclDebugVars;
@@ -441,3 +441,63 @@ TEST_F(CompilerInterfaceCachedTests, builtThenCached) {
441441 gEnvironment ->fclPopDebugVars ();
442442 gEnvironment ->igcPopDebugVars ();
443443}
444+
445+ TEST_F (CompilerInterfaceCachedTests, givenKernelWithoutIncludesAndBinaryInCacheWhenCompilationRequestedThenFCLIsNotCalled) {
446+ MockContext context (pDevice, true );
447+ MockProgram program (&context, false );
448+ BinaryCacheMock cache;
449+ TranslationArgs inputArgs;
450+
451+ inputArgs.pInput = new char [128 ];
452+ strcpy_s (inputArgs.pInput , 128 , " __kernel k() {}" );
453+ inputArgs.InputSize = static_cast <uint32_t >(strlen (inputArgs.pInput ));
454+
455+ // we force both compilers to fail compilation request
456+ // at the end we expect CL_SUCCESS which means compilation ends in cache
457+ MockCompilerDebugVars fclDebugVars;
458+ fclDebugVars.fileName = gEnvironment ->fclGetMockFile ();
459+ fclDebugVars.forceBuildFailure = true ;
460+ gEnvironment ->fclPushDebugVars (fclDebugVars);
461+
462+ MockCompilerDebugVars igcDebugVars;
463+ igcDebugVars.fileName = gEnvironment ->igcGetMockFile ();
464+ igcDebugVars.forceBuildFailure = true ;
465+ gEnvironment ->igcPushDebugVars (igcDebugVars);
466+
467+ auto res = pCompilerInterface->replaceBinaryCache (&cache);
468+ cache.loadResult = true ;
469+ auto retVal = pCompilerInterface->build (program, inputArgs, true );
470+ EXPECT_EQ (CL_SUCCESS, retVal);
471+
472+ pCompilerInterface->replaceBinaryCache (res);
473+ delete[] inputArgs.pInput ;
474+
475+ gEnvironment ->fclPopDebugVars ();
476+ gEnvironment ->igcPopDebugVars ();
477+ }
478+
479+ TEST_F (CompilerInterfaceCachedTests, givenKernelWithIncludesAndBinaryInCacheWhenCompilationRequestedThenFCLIsCalled) {
480+ MockContext context (pDevice, true );
481+ MockProgram program (&context, false );
482+ BinaryCacheMock cache;
483+ TranslationArgs inputArgs;
484+
485+ inputArgs.pInput = new char [128 ];
486+ strcpy_s (inputArgs.pInput , 128 , " #include \" file.h\"\n __kernel k() {}" );
487+ inputArgs.InputSize = static_cast <uint32_t >(strlen (inputArgs.pInput ));
488+
489+ MockCompilerDebugVars fclDebugVars;
490+ fclDebugVars.fileName = gEnvironment ->fclGetMockFile ();
491+ fclDebugVars.forceBuildFailure = true ;
492+ gEnvironment ->fclPushDebugVars (fclDebugVars);
493+
494+ auto res = pCompilerInterface->replaceBinaryCache (&cache);
495+ cache.loadResult = true ;
496+ auto retVal = pCompilerInterface->build (program, inputArgs, true );
497+ EXPECT_EQ (CL_BUILD_PROGRAM_FAILURE, retVal);
498+
499+ pCompilerInterface->replaceBinaryCache (res);
500+ delete[] inputArgs.pInput ;
501+
502+ gEnvironment ->fclPopDebugVars ();
503+ }
0 commit comments