mirror of
https://github.com/intel/compute-runtime.git
synced 2026-01-03 14:55:24 +08:00
Fix for setting context flags in AubDump
Change-Id: Ia5fba17aac19fbcbfa6676557d1af0889f538b90
This commit is contained in:
@@ -13,6 +13,7 @@
|
||||
#include "runtime/helpers/basic_math.h"
|
||||
#include "unit_tests/fixtures/device_fixture.h"
|
||||
#include "unit_tests/helpers/debug_manager_state_restore.h"
|
||||
#include "unit_tests/mocks/mock_lrca_helper.h"
|
||||
#include "test.h"
|
||||
|
||||
using namespace OCLRT;
|
||||
@@ -127,15 +128,6 @@ HWTEST_F(AubHelperHwTest, GivenEnabledLocalMemoryWhenGetMemTraceForPtEntryIsCall
|
||||
EXPECT_EQ(AubMemDump::AddressSpaceValues::TraceLocal, addressSpace);
|
||||
}
|
||||
|
||||
struct MockLrcaHelper : AubMemDump::LrcaHelper {
|
||||
mutable uint32_t setContextSaveRestoreFlagsCalled = 0;
|
||||
MockLrcaHelper(uint32_t base) : AubMemDump::LrcaHelper(base) {}
|
||||
void setContextSaveRestoreFlags(uint32_t &value) const override {
|
||||
setContextSaveRestoreFlagsCalled++;
|
||||
AubMemDump::LrcaHelper::setContextSaveRestoreFlags(value);
|
||||
}
|
||||
};
|
||||
|
||||
HWTEST_F(AubHelperHwTest, giverLrcaHelperWhenContextIsInitializedThenContextFlagsAreSet) {
|
||||
const auto &csTraits = CommandStreamReceiverSimulatedCommonHw<FamilyType>::getCsTraits(EngineType::ENGINE_RCS);
|
||||
MockLrcaHelper lrcaHelper(csTraits.mmioBase);
|
||||
@@ -144,4 +136,4 @@ HWTEST_F(AubHelperHwTest, giverLrcaHelperWhenContextIsInitializedThenContextFlag
|
||||
|
||||
lrcaHelper.initialize(lrcaBase.get());
|
||||
ASSERT_NE(0u, lrcaHelper.setContextSaveRestoreFlagsCalled);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#
|
||||
# Copyright (C) 2018 Intel Corporation
|
||||
# Copyright (C) 2018-2019 Intel Corporation
|
||||
#
|
||||
# SPDX-License-Identifier: MIT
|
||||
#
|
||||
@@ -52,6 +52,7 @@ set(IGDRCL_SRCS_tests_mocks
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/mock_image.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/mock_kernel.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/mock_kernel.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/mock_lrca_helper.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/mock_memory_manager.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/mock_memory_manager.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/mock_ostime.h
|
||||
|
||||
@@ -42,10 +42,15 @@ class MockAubManager : public aub_stream::AubManager {
|
||||
MockAubManager(){};
|
||||
~MockAubManager() override {}
|
||||
|
||||
HardwareContext *createHardwareContext(uint32_t device, uint32_t engine) override { return new MockHardwareContext(device, engine); }
|
||||
HardwareContext *createHardwareContext(uint32_t device, uint32_t engine) { return createHardwareContext(device, engine, 0); }
|
||||
HardwareContext *createHardwareContext(uint32_t device, uint32_t engine, uint32_t flags) override {
|
||||
contextFlags = flags;
|
||||
return new MockHardwareContext(device, engine);
|
||||
}
|
||||
void writeMemory(uint64_t gfxAddress, const void *memory, size_t size, uint32_t memoryBanks, int hint, size_t pageSize = 65536) override { writeMemoryCalled = true; }
|
||||
|
||||
bool writeMemoryCalled = false;
|
||||
uint32_t contextFlags = 0;
|
||||
|
||||
protected:
|
||||
HardwareContext *hardwareContext = nullptr;
|
||||
|
||||
19
unit_tests/mocks/mock_lrca_helper.h
Normal file
19
unit_tests/mocks/mock_lrca_helper.h
Normal file
@@ -0,0 +1,19 @@
|
||||
/*
|
||||
* Copyright (C) 2019 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "runtime/aub_mem_dump/aub_mem_dump.h"
|
||||
|
||||
struct MockLrcaHelper : AubMemDump::LrcaHelper {
|
||||
mutable uint32_t setContextSaveRestoreFlagsCalled = 0;
|
||||
MockLrcaHelper(uint32_t base) : AubMemDump::LrcaHelper(base) {}
|
||||
void setContextSaveRestoreFlags(uint32_t &value) const override {
|
||||
setContextSaveRestoreFlagsCalled++;
|
||||
AubMemDump::LrcaHelper::setContextSaveRestoreFlags(value);
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user