@@ -631,7 +631,7 @@ TEST(OfflineCompilerTest, givenDefaultOfflineCompilerObjectWhenNoOptionsAreChang
631631 EXPECT_FALSE (mockOfflineCompiler->inputFileSpirV );
632632}
633633
634- TEST (OfflineCompilerTest, givenIntermediatedRepresentationInputWhenBuildSourceCodeIsCalledThenProperTranslationContextIsUed ) {
634+ TEST (OfflineCompilerTest, givenIntermediatedRepresentationInputWhenBuildSourceCodeIsCalledThenProperTranslationContextIsUsed ) {
635635 MockOfflineCompiler mockOfflineCompiler;
636636 auto argv = {
637637 " ocloc" ,
@@ -676,6 +676,39 @@ TEST(OfflineCompilerTest, givenBinaryInputThenDontTruncateSourceAtFirstZero) {
676676 EXPECT_LT (0U , mockOfflineCompiler->sourceCode .size ());
677677}
678678
679+ TEST (OfflineCompilerTest, givenSpirvInputFileWhenCmdLineHasOptionsThenCorrectOptionsArePassedToCompiler) {
680+ char data[] = {1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 };
681+ MockCompilerDebugVars igcDebugVars (gEnvironment ->igcDebugVars );
682+ igcDebugVars.binaryToReturn = data;
683+ igcDebugVars.binaryToReturnSize = sizeof (data);
684+
685+ NEO::setIgcDebugVars (igcDebugVars);
686+
687+ MockOfflineCompiler mockOfflineCompiler;
688+ auto argv = {
689+ " ocloc" ,
690+ " -file" ,
691+ " test_files/emptykernel.cl" ,
692+ " -spirv_input" ,
693+ " -device" ,
694+ gEnvironment ->devicePrefix .c_str (),
695+ " -options" ,
696+ " test_options_passed" };
697+
698+ auto retVal = mockOfflineCompiler.initialize (argv.size (), argv.begin ());
699+ auto mockIgcOclDeviceCtx = new NEO::MockIgcOclDeviceCtx ();
700+ mockOfflineCompiler.igcDeviceCtx = CIF::RAII::Pack<IGC::IgcOclDeviceCtxLatest>(mockIgcOclDeviceCtx);
701+ ASSERT_EQ (CL_SUCCESS, retVal);
702+
703+ mockOfflineCompiler.inputFileSpirV = true ;
704+
705+ retVal = mockOfflineCompiler.buildSourceCode ();
706+ EXPECT_EQ (CL_SUCCESS, retVal);
707+
708+ EXPECT_STREQ (" test_options_passed" , mockOfflineCompiler.options .c_str ());
709+ NEO::setIgcDebugVars (gEnvironment ->igcDebugVars );
710+ }
711+
679712TEST (OfflineCompilerTest, givenOutputFileOptionWhenSourceIsCompiledThenOutputFileHasCorrectName) {
680713 auto argv = {
681714 " ocloc" ,
@@ -773,7 +806,7 @@ TEST(OfflineCompilerTest, givenInternalOptionsWhenCmdLineParsedThenOptionsAreApp
773806 EXPECT_THAT (internalOptions, ::testing::HasSubstr (std::string (" myInternalOptions" )));
774807}
775808
776- TEST (OfflineCompilerTest, givenInputOtpionsAndInternalOptionsFilesWhenOfflineCompilerIsInitializedThenCorrectOptionsAreSetAndRemainAfterBuild ) {
809+ TEST (OfflineCompilerTest, givenInputOptionsAndInternalOptionsFilesWhenOfflineCompilerIsInitializedThenCorrectOptionsAreSetAndRemainAfterBuild ) {
777810 auto mockOfflineCompiler = std::unique_ptr<MockOfflineCompiler>(new MockOfflineCompiler ());
778811 ASSERT_NE (nullptr , mockOfflineCompiler);
779812
0 commit comments