Move execution environment helper to shared

Signed-off-by: Zbigniew Zdanowicz <zbigniew.zdanowicz@intel.com>
This commit is contained in:
Zbigniew Zdanowicz
2021-12-23 13:48:36 +00:00
committed by Compute-Runtime-Automation
parent 38ad58bce3
commit 2047fc88f9
21 changed files with 198 additions and 102 deletions

View File

@@ -0,0 +1,25 @@
/*
* Copyright (C) 2021 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
#include "shared/source/execution_environment/execution_environment.h"
#include "shared/test/common/helpers/execution_environment_helper.h"
using namespace NEO;
struct GmmCallbacksFixture {
void SetUp() {
executionEnvironment = getExecutionEnvironmentImpl(hwInfo, 1);
executionEnvironment->incRefInternal();
}
void TearDown() {
executionEnvironment->decRefInternal();
}
ExecutionEnvironment *executionEnvironment = nullptr;
HardwareInfo *hwInfo = nullptr;
};

View File

@@ -0,0 +1,29 @@
/*
* Copyright (C) 2021 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
#include "shared/test/common/helpers/execution_environment_helper.h"
#include "shared/source/execution_environment/root_device_environment.h"
#include "shared/source/os_interface/device_factory.h"
#include "shared/test/common/helpers/debug_manager_state_restore.h"
#include "shared/test/common/mocks/mock_execution_environment.h"
namespace NEO {
ExecutionEnvironment *getExecutionEnvironmentImpl(HardwareInfo *&hwInfo, uint32_t rootDeviceEnvironments) {
ExecutionEnvironment *executionEnvironment = new MockExecutionEnvironment();
executionEnvironment->prepareRootDeviceEnvironments(rootDeviceEnvironments);
DebugManagerStateRestore restorer;
DebugManager.flags.CreateMultipleRootDevices.set(rootDeviceEnvironments);
hwInfo = nullptr;
DeviceFactory::prepareDeviceEnvironments(*executionEnvironment);
hwInfo = executionEnvironment->rootDeviceEnvironments[0]->getMutableHardwareInfo();
executionEnvironment->initializeMemoryManager();
return executionEnvironment;
}
} // namespace NEO

View File

@@ -0,0 +1,16 @@
/*
* Copyright (C) 2021 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
#pragma once
#include "shared/source/execution_environment/execution_environment.h"
#include <cstdint>
namespace NEO {
struct HardwareInfo;
ExecutionEnvironment *getExecutionEnvironmentImpl(HardwareInfo *&hwInfo, uint32_t rootDeviceEnvironments);
} // namespace NEO

View File

@@ -62,10 +62,15 @@ set(neo_libult_common_SRCS_LIB_ULT
${NEO_SHARED_TEST_DIRECTORY}/common/fixtures/aub_command_stream_receiver_fixture.h
${NEO_SHARED_TEST_DIRECTORY}/common/fixtures/device_fixture.cpp
${NEO_SHARED_TEST_DIRECTORY}/common/fixtures/device_fixture.h
${NEO_SHARED_TEST_DIRECTORY}/common/fixtures/gmm_callbacks_fixture.h
${NEO_SHARED_TEST_DIRECTORY}/common/fixtures/memory_management_fixture.cpp
${NEO_SHARED_TEST_DIRECTORY}/common/fixtures/memory_management_fixture.h
${NEO_SHARED_TEST_DIRECTORY}/common/fixtures/mock_execution_environment_gmm_fixture.cpp
${NEO_SHARED_TEST_DIRECTORY}/common/fixtures/mock_execution_environment_gmm_fixture.h
${NEO_SHARED_TEST_DIRECTORY}/common/fixtures/tbx_command_stream_fixture.cpp
${NEO_SHARED_TEST_DIRECTORY}/common/fixtures/tbx_command_stream_fixture.h
${NEO_SHARED_TEST_DIRECTORY}/common/helpers/execution_environment_helper.cpp
${NEO_SHARED_TEST_DIRECTORY}/common/helpers/execution_environment_helper.h
${NEO_SHARED_TEST_DIRECTORY}/common/helpers${BRANCH_DIR_SUFFIX}kernel_binary_helper_hash_value.cpp
${NEO_SHARED_TEST_DIRECTORY}/common/helpers/kernel_binary_helper.cpp
${NEO_SHARED_TEST_DIRECTORY}/common/helpers/kernel_binary_helper.h
@@ -74,8 +79,6 @@ set(neo_libult_common_SRCS_LIB_ULT
${NEO_SHARED_TEST_DIRECTORY}/common/helpers/memory_leak_listener.h
${NEO_SHARED_TEST_DIRECTORY}/common/helpers/memory_management.cpp
${NEO_SHARED_TEST_DIRECTORY}/common/helpers/memory_management.h
${NEO_SHARED_TEST_DIRECTORY}/common/fixtures/memory_management_fixture.cpp
${NEO_SHARED_TEST_DIRECTORY}/common/fixtures/memory_management_fixture.h
${NEO_SHARED_TEST_DIRECTORY}/common/helpers/sip_init.cpp
${NEO_SHARED_TEST_DIRECTORY}/common/helpers/test_files.cpp
${NEO_SHARED_TEST_DIRECTORY}/common/helpers/test_files.h