7
7
8
8
#include " offline_compiler_tests.h"
9
9
10
- #include " shared/offline_compiler/source/ocloc_api.h"
11
10
#include " shared/source/compiler_interface/intermediate_representations.h"
12
11
#include " shared/source/compiler_interface/oclc_extensions.h"
13
12
#include " shared/source/debug_settings/debug_settings_manager.h"
@@ -122,7 +121,6 @@ TEST_F(MultiCommandTests, GivenOutputFileWhenBuildingMultiCommandThenSuccessIsRe
122
121
};
123
122
124
123
std::vector<std::string> singleArgs = {
125
- " -gen_file" ,
126
124
" -file" ,
127
125
" test_files/copybuffer.cl" ,
128
126
" -device" ,
@@ -156,7 +154,6 @@ TEST_F(MultiCommandTests, GivenSpecifiedOutputDirWhenBuildingMultiCommandThenSuc
156
154
};
157
155
158
156
std::vector<std::string> singleArgs = {
159
- " -gen_file" ,
160
157
" -file" ,
161
158
" test_files/copybuffer.cl" ,
162
159
" -device" ,
@@ -200,7 +197,6 @@ TEST_F(MultiCommandTests, GivenSpecifiedOutputDirWithProductConfigValueWhenBuild
200
197
};
201
198
202
199
std::vector<std::string> singleArgs = {
203
- " -gen_file" ,
204
200
" -file" ,
205
201
" test_files/copybuffer.cl" ,
206
202
" -device" ,
@@ -284,7 +280,6 @@ TEST_F(MultiCommandTests, GivenOutputFileListFlagWhenBuildingMultiCommandThenSuc
284
280
};
285
281
286
282
std::vector<std::string> singleArgs = {
287
- " -gen_file" ,
288
283
" -file" ,
289
284
" test_files/copybuffer.cl" ,
290
285
" -device" ,
@@ -684,8 +679,7 @@ TEST_F(OfflineCompilerTests, GivenArgsWhenBuildingThenBuildSucceeds) {
684
679
" -file" ,
685
680
" test_files/copybuffer.cl" ,
686
681
" -device" ,
687
- gEnvironment ->devicePrefix .c_str (),
688
- " -gen_file" };
682
+ gEnvironment ->devicePrefix .c_str ()};
689
683
690
684
pOfflineCompiler = OfflineCompiler::create (argv.size (), argv, true , retVal, oclocArgHelperWithoutInput.get ());
691
685
@@ -719,30 +713,25 @@ TEST_F(OfflineCompilerTests, GivenArgsWhenBuildingWithDeviceConfigValueThenBuild
719
713
" -file" ,
720
714
" test_files/copybuffer.cl" ,
721
715
" -device" ,
722
- configString,
723
- " -gen_file" };
716
+ configString};
724
717
725
- MockOfflineCompiler offlineCompiler{};
726
-
727
- offlineCompiler.argHelper = oclocArgHelperWithoutInput.get ();
728
- retVal = offlineCompiler.initialize (argv.size (), argv);
718
+ pOfflineCompiler = OfflineCompiler::create (argv.size (), argv, true , retVal, oclocArgHelperWithoutInput.get ());
729
719
720
+ EXPECT_NE (nullptr , pOfflineCompiler);
730
721
EXPECT_EQ (CL_SUCCESS, retVal);
731
722
732
723
testing::internal::CaptureStdout ();
733
- retVal = offlineCompiler. build ();
724
+ retVal = pOfflineCompiler-> build ();
734
725
std::string output = testing::internal::GetCapturedStdout ();
735
726
EXPECT_EQ (CL_SUCCESS, retVal);
736
-
737
- Environment testedEnv{configString, offlineCompiler.familyNameWithType };
738
- VariableBackup<Environment *> backup (&gEnvironment , &testedEnv);
739
-
740
727
EXPECT_TRUE (compilerOutputExists (" copybuffer" , " bc" ) || compilerOutputExists (" copybuffer" , " spv" ));
741
728
EXPECT_TRUE (compilerOutputExists (" copybuffer" , " gen" ));
742
729
EXPECT_TRUE (compilerOutputExists (" copybuffer" , " bin" ));
743
730
744
- std::string buildLog = offlineCompiler. getBuildLog ();
731
+ std::string buildLog = pOfflineCompiler-> getBuildLog ();
745
732
EXPECT_STREQ (buildLog.c_str (), " " );
733
+
734
+ delete pOfflineCompiler;
746
735
}
747
736
748
737
TEST_F (OfflineCompilerTests, GivenLlvmTextWhenBuildingThenBuildSucceeds) {
@@ -752,8 +741,7 @@ TEST_F(OfflineCompilerTests, GivenLlvmTextWhenBuildingThenBuildSucceeds) {
752
741
" test_files/copybuffer.cl" ,
753
742
" -device" ,
754
743
gEnvironment ->devicePrefix .c_str (),
755
- " -llvm_text" ,
756
- " -gen_file" };
744
+ " -llvm_text" };
757
745
758
746
pOfflineCompiler = OfflineCompiler::create (argv.size (), argv, true , retVal, oclocArgHelperWithoutInput.get ());
759
747
@@ -769,97 +757,6 @@ TEST_F(OfflineCompilerTests, GivenLlvmTextWhenBuildingThenBuildSucceeds) {
769
757
delete pOfflineCompiler;
770
758
}
771
759
772
- TEST_F (OfflineCompilerTests, WhenGenFileFlagIsNotProvidedThenGenFileIsNotCreated) {
773
- uint32_t numOutputs = 0u ;
774
- uint64_t *lenOutputs = nullptr ;
775
- uint8_t **dataOutputs = nullptr ;
776
- char **nameOutputs = nullptr ;
777
-
778
- bool isSpvFile = false ;
779
- bool isGenFile = false ;
780
- bool isBinFile = false ;
781
-
782
- const char *argv[] = {
783
- " ocloc" ,
784
- " -q" ,
785
- " -file" ,
786
- " test_files/copybuffer.cl" ,
787
- " -device" ,
788
- gEnvironment ->devicePrefix .c_str ()};
789
-
790
- unsigned int argc = sizeof (argv) / sizeof (const char *);
791
- int retVal = oclocInvoke (argc, argv,
792
- 0 , nullptr , nullptr , nullptr ,
793
- 0 , nullptr , nullptr , nullptr ,
794
- &numOutputs, &dataOutputs, &lenOutputs, &nameOutputs);
795
-
796
- EXPECT_EQ (retVal, CL_SUCCESS);
797
- EXPECT_EQ (numOutputs, 3u );
798
-
799
- for (unsigned int i = 0 ; i < numOutputs; i++) {
800
- std::string nameOutput (nameOutputs[i]);
801
- if (nameOutput.find (" .spv" ) != std::string::npos) {
802
- isSpvFile = true ;
803
- }
804
- if (nameOutput.find (" .gen" ) != std::string::npos) {
805
- isGenFile = true ;
806
- }
807
- if (nameOutput.find (" .bin" ) != std::string::npos) {
808
- isBinFile = true ;
809
- }
810
- }
811
-
812
- EXPECT_TRUE (isSpvFile);
813
- EXPECT_FALSE (isGenFile);
814
- EXPECT_TRUE (isBinFile);
815
- }
816
-
817
- TEST_F (OfflineCompilerTests, WhenGenFileFlagIsProvidedThenGenFileIsCreated) {
818
- uint32_t numOutputs = 0u ;
819
- uint64_t *lenOutputs = nullptr ;
820
- uint8_t **dataOutputs = nullptr ;
821
- char **nameOutputs = nullptr ;
822
-
823
- bool isSpvFile = false ;
824
- bool isGenFile = false ;
825
- bool isBinFile = false ;
826
-
827
- const char *argv[] = {
828
- " ocloc" ,
829
- " -q" ,
830
- " -gen_file" ,
831
- " -file" ,
832
- " test_files/copybuffer.cl" ,
833
- " -device" ,
834
- gEnvironment ->devicePrefix .c_str ()};
835
-
836
- unsigned int argc = sizeof (argv) / sizeof (const char *);
837
- int retVal = oclocInvoke (argc, argv,
838
- 0 , nullptr , nullptr , nullptr ,
839
- 0 , nullptr , nullptr , nullptr ,
840
- &numOutputs, &dataOutputs, &lenOutputs, &nameOutputs);
841
-
842
- EXPECT_EQ (retVal, CL_SUCCESS);
843
- EXPECT_EQ (numOutputs, 4u );
844
-
845
- for (unsigned int i = 0 ; i < numOutputs; i++) {
846
- std::string nameOutput (nameOutputs[i]);
847
- if (nameOutput.find (" .spv" ) != std::string::npos) {
848
- isSpvFile = true ;
849
- }
850
- if (nameOutput.find (" .gen" ) != std::string::npos) {
851
- isGenFile = true ;
852
- }
853
- if (nameOutput.find (" .bin" ) != std::string::npos) {
854
- isBinFile = true ;
855
- }
856
- }
857
-
858
- EXPECT_TRUE (isSpvFile);
859
- EXPECT_TRUE (isGenFile);
860
- EXPECT_TRUE (isBinFile);
861
- }
862
-
863
760
TEST_F (OfflineCompilerTests, WhenFclNotNeededThenDontLoadIt) {
864
761
std::vector<std::string> argv = {
865
762
" ocloc" ,
@@ -927,8 +824,7 @@ TEST_F(OfflineCompilerTests, GivenCppFileWhenBuildingThenBuildSucceeds) {
927
824
" test_files/copybuffer.cl" ,
928
825
" -device" ,
929
826
gEnvironment ->devicePrefix .c_str (),
930
- " -cpp_file" ,
931
- " -gen_file" };
827
+ " -cpp_file" };
932
828
933
829
pOfflineCompiler = OfflineCompiler::create (argv.size (), argv, true , retVal, oclocArgHelperWithoutInput.get ());
934
830
@@ -951,7 +847,6 @@ TEST_F(OfflineCompilerTests, GivenOutputDirWhenBuildingThenBuildSucceeds) {
951
847
" test_files/copybuffer.cl" ,
952
848
" -device" ,
953
849
gEnvironment ->devicePrefix .c_str (),
954
- " -gen_file" ,
955
850
" -out_dir" ,
956
851
" offline_compiler_test" };
957
852
@@ -1294,8 +1189,7 @@ TEST(OfflineCompilerTest, givenSpvOnlyOptionPassedWhenCmdLineParsedThenGenerateO
1294
1189
" myOutputFileName" ,
1295
1190
" -spv_only" ,
1296
1191
" -device" ,
1297
- gEnvironment ->devicePrefix .c_str (),
1298
- " -gen_file" };
1192
+ gEnvironment ->devicePrefix .c_str ()};
1299
1193
1300
1194
auto mockOfflineCompiler = std::unique_ptr<MockOfflineCompiler>(new MockOfflineCompiler ());
1301
1195
ASSERT_NE (nullptr , mockOfflineCompiler);
@@ -1504,8 +1398,7 @@ TEST(OfflineCompilerTest, givenOutputFileOptionWhenSourceIsCompiledThenOutputFil
1504
1398
" -output" ,
1505
1399
" myOutputFileName" ,
1506
1400
" -device" ,
1507
- gEnvironment ->devicePrefix .c_str (),
1508
- " -gen_file" };
1401
+ gEnvironment ->devicePrefix .c_str ()};
1509
1402
1510
1403
auto mockOfflineCompiler = std::unique_ptr<MockOfflineCompiler>(new MockOfflineCompiler ());
1511
1404
ASSERT_NE (nullptr , mockOfflineCompiler);
@@ -1538,8 +1431,7 @@ TEST(OfflineCompilerTest, givenDebugDataAvailableWhenSourceIsBuiltThenDebugDataF
1538
1431
" -output" ,
1539
1432
" myOutputFileName" ,
1540
1433
" -device" ,
1541
- gEnvironment ->devicePrefix .c_str (),
1542
- " -gen_file" };
1434
+ gEnvironment ->devicePrefix .c_str ()};
1543
1435
1544
1436
char debugData[10 ];
1545
1437
MockCompilerDebugVars igcDebugVars (gEnvironment ->igcDebugVars );
@@ -2140,8 +2032,7 @@ TEST(OclocCompile, givenSpirvInputThenDontGenerateSpirvFile) {
2140
2032
" offline_compiler_test" ,
2141
2033
" -device" ,
2142
2034
gEnvironment ->devicePrefix .c_str (),
2143
- " -spirv_input" ,
2144
- " -gen_file" };
2035
+ " -spirv_input" };
2145
2036
2146
2037
int retVal = ocloc.initialize (argv.size (), argv);
2147
2038
ASSERT_EQ (0 , retVal);
0 commit comments