Skip to content

Commit 7ce72be

Browse files
Source level debugger support test improvement.
Change-Id: I14680cd4784396c788a4c0d5e38bfcfccc94fdfb
1 parent a2a4bcc commit 7ce72be

File tree

1 file changed

+14
-4
lines changed

1 file changed

+14
-4
lines changed

unit_tests/source_level_debugger/source_level_debugger_csr_tests.cpp

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@
1313
#include "unit_tests/mocks/mock_csr.h"
1414
#include "unit_tests/mocks/mock_device.h"
1515
#include "unit_tests/mocks/mock_graphics_allocation.h"
16+
#include "unit_tests/mocks/mock_memory_manager.h"
17+
#include "unit_tests/helpers/execution_environment_helper.h"
1618

1719
#include "test.h"
1820
#include <memory>
@@ -120,14 +122,22 @@ HWCMDTEST_F(IGFX_GEN8_CORE, CommandStreamReceiverWithActiveDebuggerTest, givenCs
120122
using STATE_BASE_ADDRESS = typename FamilyType::STATE_BASE_ADDRESS;
121123
using STATE_SIP = typename FamilyType::STATE_SIP;
122124

123-
auto device = std::unique_ptr<MockDevice>(MockDevice::createWithNewExecutionEnvironment<MockDevice>(nullptr));
125+
HardwareInfo *hwInfo = nullptr;
126+
auto executionEnvironment = getExecutionEnvironmentImpl(hwInfo);
127+
hwInfo->capabilityTable = platformDevices[0]->capabilityTable;
128+
hwInfo->capabilityTable.sourceLevelDebuggerSupported = true;
129+
130+
auto mockCsr = new MockCsrHw2<FamilyType>(*platformDevices[0], *executionEnvironment);
131+
132+
executionEnvironment->commandStreamReceivers.resize(1);
133+
executionEnvironment->commandStreamReceivers[0][0].reset(mockCsr);
134+
auto mockMemoryManager = new MockMemoryManager(*executionEnvironment);
135+
executionEnvironment->memoryManager.reset(mockMemoryManager);
124136

137+
auto device = std::unique_ptr<MockDevice>(Device::create<MockDevice>(&hwInfo[0], executionEnvironment, 0));
125138
if (device->getHardwareInfo().capabilityTable.defaultPreemptionMode == PreemptionMode::MidThread) {
126139
device->setSourceLevelDebuggerActive(true);
127140
device->allocatePreemptionAllocationIfNotPresent();
128-
auto mockCsr = new MockCsrHw2<FamilyType>(*platformDevices[0], *device->executionEnvironment);
129-
130-
device->resetCommandStreamReceiver(mockCsr);
131141

132142
mockCsr->overrideDispatchPolicy(DispatchMode::ImmediateDispatch);
133143

0 commit comments

Comments
 (0)