1 /*
2  * Copyright (C) 2018-2021 Intel Corporation
3  *
4  * SPDX-License-Identifier: MIT
5  *
6  */
7 
8 #pragma once
9 
10 #include "shared/source/built_ins/sip.h"
11 #include "shared/test/common/mocks/mock_execution_environment.h"
12 
13 #include <memory>
14 #include <vector>
15 
16 namespace NEO {
17 class MemoryAllocation;
18 
19 class MockSipKernel : public SipKernel {
20   public:
21     using SipKernel::createHeaderFilename;
22     using SipKernel::type;
23 
24     MockSipKernel(SipKernelType type, GraphicsAllocation *sipAlloc);
25     MockSipKernel();
26     ~MockSipKernel() override;
27 
28     static const char *dummyBinaryForSip;
29     static std::vector<char> getDummyGenBinary();
30 
31     GraphicsAllocation *getSipAllocation() const override;
32     const std::vector<char> &getStateSaveAreaHeader() const override;
33 
34     void createMockSipAllocation();
35 
36     std::unique_ptr<MemoryAllocation> mockSipMemoryAllocation;
37     std::vector<char> mockStateSaveAreaHeader = {'s', 's', 'a', 'h'};
38     MockExecutionEnvironment executionEnvironment;
39 };
40 
41 namespace MockSipData {
42 extern std::unique_ptr<MockSipKernel> mockSipKernel;
43 extern SipKernelType calledType;
44 extern bool called;
45 extern bool returned;
46 extern bool useMockSip;
47 
48 void clearUseFlags();
49 std::vector<char> createStateSaveAreaHeader(uint32_t version);
50 } // namespace MockSipData
51 } // namespace NEO
52