1919 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
2020 * OTHER DEALINGS IN THE SOFTWARE.
2121 */
22- #include " runtime/kernel/kernel.h"
22+
23+ #include " program_tests.h"
24+
25+ #include " elf/reader.h"
2326#include " runtime/command_stream/command_stream_receiver_hw.h"
2427#include " runtime/compiler_interface/compiler_options.h"
25- #include " unit_tests/libult/ult_command_stream_receiver.h"
26- #include " runtime/indirect_heap/indirect_heap.h"
2728#include " runtime/helpers/aligned_memory.h"
2829#include " runtime/helpers/hash.h"
2930#include " runtime/helpers/hw_helper.h"
3031#include " runtime/helpers/kernel_commands.h"
3132#include " runtime/helpers/ptr_math.h"
3233#include " runtime/helpers/string.h"
34+ #include " runtime/indirect_heap/indirect_heap.h"
35+ #include " runtime/kernel/kernel.h"
3336#include " runtime/memory_manager/graphics_allocation.h"
3437#include " runtime/memory_manager/surface.h"
3538#include " runtime/program/create.inl"
36- #include " program_tests .h"
39+ #include " unit_tests/fixtures/device_fixture .h"
3740#include " unit_tests/fixtures/program_fixture.inl"
3841#include " unit_tests/global_environment.h"
3942#include " unit_tests/helpers/debug_manager_state_restore.h"
4043#include " unit_tests/helpers/kernel_binary_helper.h"
44+ #include " unit_tests/libult/ult_command_stream_receiver.h"
4145#include " unit_tests/mocks/mock_kernel.h"
46+ #include " unit_tests/mocks/mock_program.h"
4247#include " unit_tests/program/program_from_binary.h"
4348#include " unit_tests/program/program_with_source.h"
44- #include " test.h"
45- #include " unit_tests/fixtures/device_fixture.h"
46- #include " unit_tests/mocks/mock_program.h"
49+ #include " unit_tests/utilities/base_object_utils.h"
4750#include " gtest/gtest.h"
4851#include " gmock/gmock.h"
49- #include " elf/reader .h"
52+ #include " test .h"
5053
5154#include < map>
5255#include < memory>
@@ -2888,9 +2891,6 @@ TEST_F(ProgramTests, givenCompilerInterfaceWhenCompileIsCalledThenProperIntermed
28882891 }
28892892 };
28902893
2891- struct SmallMockProgram : public Program {};
2892- using ProgramAutoPtr = std::unique_ptr<SmallMockProgram, void (*)(SmallMockProgram *)>;
2893-
28942894 auto device = castToObject<Device>(pContext->getDevice (0 ));
28952895
28962896 TranslationArgs input = {};
@@ -2908,32 +2908,27 @@ TEST_F(ProgramTests, givenCompilerInterfaceWhenCompileIsCalledThenProperIntermed
29082908 compilerMain->setDefaultCreatorFunc <OCLRT::MockFclOclDeviceCtx>(OCLRT::MockFclOclDeviceCtx::Create);
29092909
29102910 compilerInterface.useLlvmText = true ;
2911- ProgramAutoPtr programLlvmText{ new SmallMockProgram (), [](SmallMockProgram *p) { p-> release (); }} ;
2911+ auto programLlvmText = wrapReleasableObjectWithUniquePtr ( new MockProgram ()) ;
29122912 programLlvmText->setDevice (device);
29132913 compilerInterface.intermediateRepresentation = IGC::CodeType::spirV;
29142914 compilerInterface.compile (*programLlvmText, input);
29152915 EXPECT_FALSE (programLlvmText->getIsSpirV ());
29162916
29172917 compilerInterface.useLlvmText = false ;
2918- ProgramAutoPtr programSpirV{ new SmallMockProgram (), [](SmallMockProgram *p) { p-> release (); }} ;
2918+ auto programSpirV = wrapReleasableObjectWithUniquePtr ( new MockProgram ()) ;
29192919 programSpirV->setDevice (device);
29202920 compilerInterface.intermediateRepresentation = IGC::CodeType::spirV;
29212921 compilerInterface.compile (*programSpirV, input);
29222922 EXPECT_TRUE (programSpirV->getIsSpirV ());
29232923
2924- ProgramAutoPtr programLlvmBc{ new SmallMockProgram (), [](SmallMockProgram *p) { p-> release (); }} ;
2924+ auto programLlvmBc = wrapReleasableObjectWithUniquePtr ( new MockProgram ()) ;
29252925 programLlvmBc->setDevice (device);
29262926 compilerInterface.intermediateRepresentation = IGC::CodeType::llvmBc;
29272927 compilerInterface.compile (*programLlvmBc, input);
29282928 EXPECT_FALSE (programLlvmBc->getIsSpirV ());
29292929}
29302930
29312931TEST_F (ProgramTests, givenProgramWithSpirvWhenRebuildProgramIsCalledThenSpirvPathIsTaken) {
2932- struct SmallMockProgram : public Program {
2933- using Program::rebuildProgramFromIr;
2934- };
2935- using ProgramAutoPtr = std::unique_ptr<SmallMockProgram, void (*)(SmallMockProgram *)>;
2936-
29372932 auto device = castToObject<Device>(pContext->getDevice (0 ));
29382933
29392934 MockCompilerInterface compilerInterface;
@@ -2952,7 +2947,7 @@ TEST_F(ProgramTests, givenProgramWithSpirvWhenRebuildProgramIsCalledThenSpirvPat
29522947 gEnvironment ->igcPushDebugVars (debugVars);
29532948 std::unique_ptr<void , void (*)(void *)> igcDebugVarsAutoPop{&gEnvironment , [](void *) { gEnvironment ->igcPopDebugVars (); }};
29542949
2955- ProgramAutoPtr program{ new SmallMockProgram (), [](SmallMockProgram *p) { p-> release (); }} ;
2950+ auto program = wrapReleasableObjectWithUniquePtr ( new MockProgram ()) ;
29562951 program->setDevice (device);
29572952 uint32_t spirv[16 ] = {0x03022307 , 0x23471113 , 0x17192329 };
29582953 program->storeIrBinary (spirv, sizeof (spirv), true );
0 commit comments