From 0cbc320e57b332d2f24a044a92247079c7801661 Mon Sep 17 00:00:00 2001 From: Zbigniew Zdanowicz Date: Fri, 31 Dec 2021 13:56:03 +0000 Subject: [PATCH] Move memory fixtures to shared Signed-off-by: Zbigniew Zdanowicz --- opencl/test/unit_test/fixtures/CMakeLists.txt | 6 +--- .../unit_test/fixtures/linux/CMakeLists.txt | 15 ---------- .../unit_test/fixtures/windows/CMakeLists.txt | 15 ---------- .../memory_manager/host_ptr_manager_tests.cpp | 5 ++-- .../internal_allocation_storage_tests.cpp | 5 ++-- .../memory_manager_multi_device_tests.cpp | 5 ++-- .../memory_manager/memory_manager_tests.cpp | 6 ++-- opencl/test/unit_test/mocks/CMakeLists.txt | 3 +- .../linux/drm_memory_manager_tests.cpp | 4 +-- .../windows/device_command_stream_tests.cpp | 4 +-- .../windows/wddm_kmdaf_listener_tests.cpp | 4 +-- .../windows/wddm_memory_manager_tests.h | 4 +-- .../wddm_residency_controller_tests.cpp | 4 +-- .../utilities/tag_allocator_tests.cpp | 5 ++-- ...y_allocator_multi_device_fixture_linux.cpp | 5 ++-- .../fixtures/memory_allocator_fixture.h | 4 +-- .../memory_allocator_multi_device_fixture.h | 12 ++++---- .../fixtures/memory_manager_fixture.cpp | 4 +-- .../common}/fixtures/memory_manager_fixture.h | 2 +- ...allocator_multi_device_fixture_windows.cpp | 7 ++--- shared/test/common/libult/CMakeLists.txt | 29 ++++++++++++------- .../test/common/libult/gen12lp/CMakeLists.txt | 13 +++++---- shared/test/common/mocks/CMakeLists.txt | 4 ++- .../mocks}/windows/mock_gdi_interface.cpp | 4 +-- .../mocks}/windows/mock_gdi_interface.h | 2 +- .../os_interface/windows/wddm_fixture.h | 4 +-- .../os_interface/windows/CMakeLists.txt | 4 +-- 27 files changed, 75 insertions(+), 104 deletions(-) delete mode 100644 opencl/test/unit_test/fixtures/linux/CMakeLists.txt delete mode 100644 opencl/test/unit_test/fixtures/windows/CMakeLists.txt rename {opencl/test/unit_test => shared/test/common}/fixtures/linux/memory_allocator_multi_device_fixture_linux.cpp (87%) rename {opencl/test/unit_test => shared/test/common}/fixtures/memory_allocator_fixture.h (94%) rename {opencl/test/unit_test => shared/test/common}/fixtures/memory_allocator_multi_device_fixture.h (80%) rename {opencl/test/unit_test => shared/test/common}/fixtures/memory_manager_fixture.cpp (92%) rename {opencl/test/unit_test => shared/test/common}/fixtures/memory_manager_fixture.h (93%) rename {opencl/test/unit_test => shared/test/common}/fixtures/windows/memory_allocator_multi_device_fixture_windows.cpp (89%) rename shared/test/{unit_test/os_interface => common/mocks}/windows/mock_gdi_interface.cpp (59%) rename shared/test/{unit_test/os_interface => common/mocks}/windows/mock_gdi_interface.h (99%) diff --git a/opencl/test/unit_test/fixtures/CMakeLists.txt b/opencl/test/unit_test/fixtures/CMakeLists.txt index 34eebc6d49..18445e8a80 100644 --- a/opencl/test/unit_test/fixtures/CMakeLists.txt +++ b/opencl/test/unit_test/fixtures/CMakeLists.txt @@ -1,5 +1,5 @@ # -# Copyright (C) 2018-2021 Intel Corporation +# Copyright (C) 2018-2022 Intel Corporation # # SPDX-License-Identifier: MIT # @@ -32,10 +32,6 @@ set(IGDRCL_SRCS_tests_fixtures ${CMAKE_CURRENT_SOURCE_DIR}/kernel_data_fixture.h ${CMAKE_CURRENT_SOURCE_DIR}/kernel_work_group_info_fixture.h ${CMAKE_CURRENT_SOURCE_DIR}/media_kernel_fixture.h - ${CMAKE_CURRENT_SOURCE_DIR}/memory_allocator_fixture.h - ${CMAKE_CURRENT_SOURCE_DIR}/memory_allocator_multi_device_fixture.h - ${CMAKE_CURRENT_SOURCE_DIR}/memory_manager_fixture.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/memory_manager_fixture.h ${CMAKE_CURRENT_SOURCE_DIR}/multi_root_device_fixture.h ${CMAKE_CURRENT_SOURCE_DIR}/multi_tile_fixture.h ${CMAKE_CURRENT_SOURCE_DIR}/one_mip_level_image_fixture.h diff --git a/opencl/test/unit_test/fixtures/linux/CMakeLists.txt b/opencl/test/unit_test/fixtures/linux/CMakeLists.txt deleted file mode 100644 index be1c37ceb8..0000000000 --- a/opencl/test/unit_test/fixtures/linux/CMakeLists.txt +++ /dev/null @@ -1,15 +0,0 @@ -# -# Copyright (C) 2020 Intel Corporation -# -# SPDX-License-Identifier: MIT -# - -set(IGDRCL_SRCS_tests_fixtures_linux - ${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt - ${CMAKE_CURRENT_SOURCE_DIR}/memory_allocator_multi_device_fixture_linux.cpp -) -if(UNIX) - target_sources(igdrcl_tests PRIVATE ${IGDRCL_SRCS_tests_fixtures_linux}) -endif() -set_property(GLOBAL PROPERTY IGDRCL_SRCS_tests_fixtures_linux ${IGDRCL_SRCS_tests_fixtures_linux}) -add_subdirectories() diff --git a/opencl/test/unit_test/fixtures/windows/CMakeLists.txt b/opencl/test/unit_test/fixtures/windows/CMakeLists.txt deleted file mode 100644 index ca2d9bd740..0000000000 --- a/opencl/test/unit_test/fixtures/windows/CMakeLists.txt +++ /dev/null @@ -1,15 +0,0 @@ -# -# Copyright (C) 2020 Intel Corporation -# -# SPDX-License-Identifier: MIT -# - -set(IGDRCL_SRCS_tests_fixtures_windows - ${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt - ${CMAKE_CURRENT_SOURCE_DIR}/memory_allocator_multi_device_fixture_windows.cpp -) -if(WIN32) - target_sources(igdrcl_tests PRIVATE ${IGDRCL_SRCS_tests_fixtures_windows}) -endif() -set_property(GLOBAL PROPERTY IGDRCL_SRCS_tests_fixtures_windows ${IGDRCL_SRCS_tests_fixtures_windows}) -add_subdirectories() diff --git a/opencl/test/unit_test/memory_manager/host_ptr_manager_tests.cpp b/opencl/test/unit_test/memory_manager/host_ptr_manager_tests.cpp index 0b284dd3fe..ea156a3ed3 100644 --- a/opencl/test/unit_test/memory_manager/host_ptr_manager_tests.cpp +++ b/opencl/test/unit_test/memory_manager/host_ptr_manager_tests.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2018-2021 Intel Corporation + * Copyright (C) 2018-2022 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -10,6 +10,7 @@ #include "shared/source/helpers/constants.h" #include "shared/source/helpers/ptr_math.h" #include "shared/source/os_interface/os_context.h" +#include "shared/test/common/fixtures/memory_manager_fixture.h" #include "shared/test/common/helpers/engine_descriptor_helper.h" #include "shared/test/common/mocks/mock_allocation_properties.h" #include "shared/test/common/mocks/mock_csr.h" @@ -18,8 +19,6 @@ #include "shared/test/common/mocks/mock_memory_manager.h" #include "shared/test/common/test_macros/test.h" -#include "opencl/test/unit_test/fixtures/memory_manager_fixture.h" - using namespace NEO; struct HostPtrManagerTest : ::testing::Test { diff --git a/opencl/test/unit_test/memory_manager/internal_allocation_storage_tests.cpp b/opencl/test/unit_test/memory_manager/internal_allocation_storage_tests.cpp index 90976056f8..557f1749fc 100644 --- a/opencl/test/unit_test/memory_manager/internal_allocation_storage_tests.cpp +++ b/opencl/test/unit_test/memory_manager/internal_allocation_storage_tests.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2018-2021 Intel Corporation + * Copyright (C) 2018-2022 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -7,6 +7,7 @@ #include "shared/source/memory_manager/internal_allocation_storage.h" #include "shared/source/os_interface/os_context.h" +#include "shared/test/common/fixtures/memory_allocator_fixture.h" #include "shared/test/common/helpers/debug_manager_state_restore.h" #include "shared/test/common/libult/ult_command_stream_receiver.h" #include "shared/test/common/mocks/mock_allocation_properties.h" @@ -14,8 +15,6 @@ #include "shared/test/common/test_macros/test.h" #include "shared/test/unit_test/utilities/containers_tests_helpers.h" -#include "opencl/test/unit_test/fixtures/memory_allocator_fixture.h" - struct InternalAllocationStorageTest : public MemoryAllocatorFixture, public ::testing::Test { using MemoryAllocatorFixture::TearDown; diff --git a/opencl/test/unit_test/memory_manager/memory_manager_multi_device_tests.cpp b/opencl/test/unit_test/memory_manager/memory_manager_multi_device_tests.cpp index 87fe097698..47c6c2a92b 100644 --- a/opencl/test/unit_test/memory_manager/memory_manager_multi_device_tests.cpp +++ b/opencl/test/unit_test/memory_manager/memory_manager_multi_device_tests.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019-2021 Intel Corporation + * Copyright (C) 2019-2022 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -8,11 +8,10 @@ #include "shared/source/helpers/constants.h" #include "shared/source/memory_manager/graphics_allocation.h" #include "shared/source/memory_manager/memory_manager.h" +#include "shared/test/common/fixtures/memory_allocator_multi_device_fixture.h" #include "shared/test/common/mocks/mock_graphics_allocation.h" #include "shared/test/common/test_macros/test.h" -#include "opencl/test/unit_test/fixtures/memory_allocator_multi_device_fixture.h" - using namespace NEO; using MemoryManagerMultiDeviceTest = MemoryAllocatorMultiDeviceFixture<10>; diff --git a/opencl/test/unit_test/memory_manager/memory_manager_tests.cpp b/opencl/test/unit_test/memory_manager/memory_manager_tests.cpp index d6b91a3025..610249acaa 100644 --- a/opencl/test/unit_test/memory_manager/memory_manager_tests.cpp +++ b/opencl/test/unit_test/memory_manager/memory_manager_tests.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2018-2021 Intel Corporation + * Copyright (C) 2018-2022 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -16,6 +16,8 @@ #include "shared/source/os_interface/os_context.h" #include "shared/source/os_interface/os_interface.h" #include "shared/source/program/program_initialization.h" +#include "shared/test/common/fixtures/memory_allocator_fixture.h" +#include "shared/test/common/fixtures/memory_manager_fixture.h" #include "shared/test/common/helpers/debug_manager_state_restore.h" #include "shared/test/common/helpers/engine_descriptor_helper.h" #include "shared/test/common/helpers/execution_environment_helper.h" @@ -44,8 +46,6 @@ #include "opencl/source/program/printf_handler.h" #include "opencl/source/program/program.h" #include "opencl/test/unit_test/fixtures/cl_device_fixture.h" -#include "opencl/test/unit_test/fixtures/memory_allocator_fixture.h" -#include "opencl/test/unit_test/fixtures/memory_manager_fixture.h" #include "opencl/test/unit_test/fixtures/multi_root_device_fixture.h" #include "opencl/test/unit_test/helpers/raii_hw_helper.h" #include "opencl/test/unit_test/mocks/mock_context.h" diff --git a/opencl/test/unit_test/mocks/CMakeLists.txt b/opencl/test/unit_test/mocks/CMakeLists.txt index 37329060bf..9734b0c947 100644 --- a/opencl/test/unit_test/mocks/CMakeLists.txt +++ b/opencl/test/unit_test/mocks/CMakeLists.txt @@ -1,5 +1,5 @@ # -# Copyright (C) 2018-2021 Intel Corporation +# Copyright (C) 2018-2022 Intel Corporation # # SPDX-License-Identifier: MIT # @@ -41,7 +41,6 @@ if(WIN32) file(GLOB IGDRCL_SRC_tests_mock_wddm "${CMAKE_CURRENT_SOURCE_DIR}/mock_wddm2[0-9]\.*") list(APPEND IGDRCL_SRCS_tests_mocks ${CMAKE_CURRENT_SOURCE_DIR}/mock_d3d_objects.h - ${NEO_SHARED_TEST_DIRECTORY}/unit_test/os_interface/windows/mock_gdi_interface.cpp ${IGDRCL_SRC_tests_mock_wddm} ) else() diff --git a/opencl/test/unit_test/os_interface/linux/drm_memory_manager_tests.cpp b/opencl/test/unit_test/os_interface/linux/drm_memory_manager_tests.cpp index 64a8d2acd8..900cf12f69 100644 --- a/opencl/test/unit_test/os_interface/linux/drm_memory_manager_tests.cpp +++ b/opencl/test/unit_test/os_interface/linux/drm_memory_manager_tests.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2018-2021 Intel Corporation + * Copyright (C) 2018-2022 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -26,6 +26,7 @@ #include "shared/source/os_interface/linux/os_context_linux.h" #include "shared/source/os_interface/os_context.h" #include "shared/source/utilities/tag_allocator.h" +#include "shared/test/common/fixtures/memory_allocator_multi_device_fixture.h" #include "shared/test/common/helpers/debug_manager_state_restore.h" #include "shared/test/common/helpers/engine_descriptor_helper.h" #include "shared/test/common/helpers/ult_hw_config.h" @@ -42,7 +43,6 @@ #include "opencl/source/helpers/cl_memory_properties_helpers.h" #include "opencl/source/mem_obj/buffer.h" #include "opencl/source/mem_obj/image.h" -#include "opencl/test/unit_test/fixtures/memory_allocator_multi_device_fixture.h" #include "opencl/test/unit_test/mocks/mock_cl_device.h" #include "opencl/test/unit_test/mocks/mock_context.h" #include "opencl/test/unit_test/mocks/mock_platform.h" diff --git a/opencl/test/unit_test/os_interface/windows/device_command_stream_tests.cpp b/opencl/test/unit_test/os_interface/windows/device_command_stream_tests.cpp index 9ea6cda32b..c143b346a3 100644 --- a/opencl/test/unit_test/os_interface/windows/device_command_stream_tests.cpp +++ b/opencl/test/unit_test/os_interface/windows/device_command_stream_tests.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2018-2021 Intel Corporation + * Copyright (C) 2018-2022 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -36,12 +36,12 @@ #include "shared/test/common/mocks/mock_io_functions.h" #include "shared/test/common/mocks/mock_submissions_aggregator.h" #include "shared/test/common/mocks/mock_wddm_interface23.h" +#include "shared/test/common/mocks/windows/mock_gdi_interface.h" #include "shared/test/common/mocks/windows/mock_wddm_direct_submission.h" #include "shared/test/common/os_interface/windows/mock_wddm_memory_manager.h" #include "shared/test/common/os_interface/windows/wddm_fixture.h" #include "shared/test/common/test_macros/test.h" #include "shared/test/unit_test/fixtures/mock_aub_center_fixture.h" -#include "shared/test/unit_test/os_interface/windows/mock_gdi_interface.h" #include "opencl/test/unit_test/mocks/mock_buffer.h" diff --git a/opencl/test/unit_test/os_interface/windows/wddm_kmdaf_listener_tests.cpp b/opencl/test/unit_test/os_interface/windows/wddm_kmdaf_listener_tests.cpp index 1eeea5e4b0..a9c70f17d9 100644 --- a/opencl/test/unit_test/os_interface/windows/wddm_kmdaf_listener_tests.cpp +++ b/opencl/test/unit_test/os_interface/windows/wddm_kmdaf_listener_tests.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2018-2021 Intel Corporation + * Copyright (C) 2018-2022 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -14,8 +14,8 @@ #include "shared/source/os_interface/windows/wddm/wddm.h" #include "shared/source/os_interface/windows/wddm_allocation.h" #include "shared/test/common/mock_gdi/mock_gdi.h" +#include "shared/test/common/mocks/windows/mock_gdi_interface.h" #include "shared/test/common/test_macros/test.h" -#include "shared/test/unit_test/os_interface/windows/mock_gdi_interface.h" #include "opencl/source/platform/platform.h" #include "opencl/test/unit_test/mocks/mock_platform.h" diff --git a/opencl/test/unit_test/os_interface/windows/wddm_memory_manager_tests.h b/opencl/test/unit_test/os_interface/windows/wddm_memory_manager_tests.h index 217917f526..d220df74ef 100644 --- a/opencl/test/unit_test/os_interface/windows/wddm_memory_manager_tests.h +++ b/opencl/test/unit_test/os_interface/windows/wddm_memory_manager_tests.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2018-2021 Intel Corporation + * Copyright (C) 2018-2022 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -15,10 +15,10 @@ #include "shared/test/common/mocks/mock_gmm.h" #include "shared/test/common/mocks/mock_gmm_page_table_mngr.h" #include "shared/test/common/mocks/mock_wddm_residency_allocations_container.h" +#include "shared/test/common/mocks/windows/mock_gdi_interface.h" #include "shared/test/common/os_interface/windows/mock_wddm_memory_manager.h" #include "shared/test/common/os_interface/windows/wddm_fixture.h" #include "shared/test/common/test_macros/test.h" -#include "shared/test/unit_test/os_interface/windows/mock_gdi_interface.h" #include "opencl/test/unit_test/mocks/mock_context.h" #include "opencl/test/unit_test/mocks/mock_platform.h" diff --git a/opencl/test/unit_test/os_interface/windows/wddm_residency_controller_tests.cpp b/opencl/test/unit_test/os_interface/windows/wddm_residency_controller_tests.cpp index 830c45064e..6965e62edb 100644 --- a/opencl/test/unit_test/os_interface/windows/wddm_residency_controller_tests.cpp +++ b/opencl/test/unit_test/os_interface/windows/wddm_residency_controller_tests.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2018-2021 Intel Corporation + * Copyright (C) 2018-2022 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -22,9 +22,9 @@ #include "shared/test/common/mocks/mock_allocation_properties.h" #include "shared/test/common/mocks/mock_execution_environment.h" #include "shared/test/common/mocks/mock_wddm.h" +#include "shared/test/common/mocks/windows/mock_gdi_interface.h" #include "shared/test/common/os_interface/windows/mock_wddm_memory_manager.h" #include "shared/test/common/test_macros/test.h" -#include "shared/test/unit_test/os_interface/windows/mock_gdi_interface.h" #include "opencl/source/platform/platform.h" #include "opencl/test/unit_test/mocks/mock_platform.h" diff --git a/opencl/test/unit_test/utilities/tag_allocator_tests.cpp b/opencl/test/unit_test/utilities/tag_allocator_tests.cpp index 34889d4dd0..0d2de7c174 100644 --- a/opencl/test/unit_test/utilities/tag_allocator_tests.cpp +++ b/opencl/test/unit_test/utilities/tag_allocator_tests.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2018-2021 Intel Corporation + * Copyright (C) 2018-2022 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -7,6 +7,7 @@ #include "shared/source/helpers/timestamp_packet.h" #include "shared/source/utilities/tag_allocator.h" +#include "shared/test/common/fixtures/memory_allocator_fixture.h" #include "shared/test/common/helpers/debug_manager_state_restore.h" #include "shared/test/common/helpers/engine_descriptor_helper.h" #include "shared/test/common/libult/ult_command_stream_receiver.h" @@ -14,8 +15,6 @@ #include "shared/test/common/mocks/ult_device_factory.h" #include "shared/test/common/test_macros/test.h" -#include "opencl/test/unit_test/fixtures/memory_allocator_fixture.h" - #include "gtest/gtest.h" #include diff --git a/opencl/test/unit_test/fixtures/linux/memory_allocator_multi_device_fixture_linux.cpp b/shared/test/common/fixtures/linux/memory_allocator_multi_device_fixture_linux.cpp similarity index 87% rename from opencl/test/unit_test/fixtures/linux/memory_allocator_multi_device_fixture_linux.cpp rename to shared/test/common/fixtures/linux/memory_allocator_multi_device_fixture_linux.cpp index be70a41bc2..2a72da08fb 100644 --- a/opencl/test/unit_test/fixtures/linux/memory_allocator_multi_device_fixture_linux.cpp +++ b/shared/test/common/fixtures/linux/memory_allocator_multi_device_fixture_linux.cpp @@ -1,14 +1,13 @@ /* - * Copyright (C) 2020-2021 Intel Corporation + * Copyright (C) 2020-2022 Intel Corporation * * SPDX-License-Identifier: MIT * */ +#include "shared/test/common/fixtures/memory_allocator_multi_device_fixture.h" #include "shared/test/common/mocks/linux/mock_drm_memory_manager.h" -#include "opencl/test/unit_test/fixtures/memory_allocator_multi_device_fixture.h" - using namespace NEO; void MemoryAllocatorMultiDeviceSystemSpecificFixture::SetUp(ExecutionEnvironment &executionEnvironment) { diff --git a/opencl/test/unit_test/fixtures/memory_allocator_fixture.h b/shared/test/common/fixtures/memory_allocator_fixture.h similarity index 94% rename from opencl/test/unit_test/fixtures/memory_allocator_fixture.h rename to shared/test/common/fixtures/memory_allocator_fixture.h index 8ea3b79327..6b707f931c 100644 --- a/opencl/test/unit_test/fixtures/memory_allocator_fixture.h +++ b/shared/test/common/fixtures/memory_allocator_fixture.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2018-2021 Intel Corporation + * Copyright (C) 2018-2022 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -16,7 +16,6 @@ #include "shared/test/common/mocks/mock_device.h" #include "shared/test/common/mocks/mock_memory_manager.h" -#include "opencl/test/unit_test/mocks/mock_platform.h" using namespace NEO; class MemoryAllocatorFixture : public MemoryManagementFixture { @@ -39,7 +38,6 @@ class MemoryAllocatorFixture : public MemoryManagementFixture { void TearDown() override { device.reset(); - platformsImpl->clear(); MemoryManagementFixture::TearDown(); } diff --git a/opencl/test/unit_test/fixtures/memory_allocator_multi_device_fixture.h b/shared/test/common/fixtures/memory_allocator_multi_device_fixture.h similarity index 80% rename from opencl/test/unit_test/fixtures/memory_allocator_multi_device_fixture.h rename to shared/test/common/fixtures/memory_allocator_multi_device_fixture.h index db44f9f3f4..0e833202bb 100644 --- a/opencl/test/unit_test/fixtures/memory_allocator_multi_device_fixture.h +++ b/shared/test/common/fixtures/memory_allocator_multi_device_fixture.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019-2021 Intel Corporation + * Copyright (C) 2019-2022 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -8,12 +8,13 @@ #pragma once #include "shared/source/gmm_helper/gmm.h" +#include "shared/source/os_interface/device_factory.h" #include "shared/test/common/fixtures/memory_management_fixture.h" #include "shared/test/common/helpers/debug_manager_state_restore.h" +#include "shared/test/common/helpers/default_hw_info.h" #include "shared/test/common/helpers/ult_hw_config.h" #include "shared/test/common/helpers/variable_backup.h" - -#include "opencl/test/unit_test/mocks/mock_platform.h" +#include "shared/test/common/mocks/mock_execution_environment.h" using namespace NEO; @@ -37,8 +38,8 @@ class MemoryAllocatorMultiDeviceFixture : public MemoryManagementFixture, public ultHwConfig.useMockedPrepareDeviceEnvironmentsFunc = false; ultHwConfig.forceOsAgnosticMemoryManager = isOsAgnosticMemoryManager; - initPlatform(); - executionEnvironment = platform()->peekExecutionEnvironment(); + executionEnvironment = new MockExecutionEnvironment(defaultHwInfo.get(), true, numRootDevices); + devices = DeviceFactory::createDevices(*executionEnvironment); memoryManager = executionEnvironment->memoryManager.get(); if (!isOsAgnosticMemoryManager) { @@ -55,6 +56,7 @@ class MemoryAllocatorMultiDeviceFixture : public MemoryManagementFixture, public uint32_t getNumRootDevices() { return numRootDevices; } protected: + std::vector> devices; ExecutionEnvironment *executionEnvironment = nullptr; MemoryManager *memoryManager = nullptr; DebugManagerStateRestore restorer; diff --git a/opencl/test/unit_test/fixtures/memory_manager_fixture.cpp b/shared/test/common/fixtures/memory_manager_fixture.cpp similarity index 92% rename from opencl/test/unit_test/fixtures/memory_manager_fixture.cpp rename to shared/test/common/fixtures/memory_manager_fixture.cpp index 63c6ff21b9..0e0c77f88d 100644 --- a/opencl/test/unit_test/fixtures/memory_manager_fixture.cpp +++ b/shared/test/common/fixtures/memory_manager_fixture.cpp @@ -1,11 +1,11 @@ /* - * Copyright (C) 2018-2021 Intel Corporation + * Copyright (C) 2018-2022 Intel Corporation * * SPDX-License-Identifier: MIT * */ -#include "opencl/test/unit_test/fixtures/memory_manager_fixture.h" +#include "shared/test/common/fixtures/memory_manager_fixture.h" #include "shared/source/command_stream/preemption.h" #include "shared/source/helpers/hw_helper.h" diff --git a/opencl/test/unit_test/fixtures/memory_manager_fixture.h b/shared/test/common/fixtures/memory_manager_fixture.h similarity index 93% rename from opencl/test/unit_test/fixtures/memory_manager_fixture.h rename to shared/test/common/fixtures/memory_manager_fixture.h index 753f883867..55cc2afa85 100644 --- a/opencl/test/unit_test/fixtures/memory_manager_fixture.h +++ b/shared/test/common/fixtures/memory_manager_fixture.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2018-2021 Intel Corporation + * Copyright (C) 2018-2022 Intel Corporation * * SPDX-License-Identifier: MIT * diff --git a/opencl/test/unit_test/fixtures/windows/memory_allocator_multi_device_fixture_windows.cpp b/shared/test/common/fixtures/windows/memory_allocator_multi_device_fixture_windows.cpp similarity index 89% rename from opencl/test/unit_test/fixtures/windows/memory_allocator_multi_device_fixture_windows.cpp rename to shared/test/common/fixtures/windows/memory_allocator_multi_device_fixture_windows.cpp index 7fa050ede1..60e0ddfc21 100644 --- a/opencl/test/unit_test/fixtures/windows/memory_allocator_multi_device_fixture_windows.cpp +++ b/shared/test/common/fixtures/windows/memory_allocator_multi_device_fixture_windows.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2020-2021 Intel Corporation + * Copyright (C) 2020-2022 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -9,11 +9,10 @@ #include "shared/source/gmm_helper/resource_info.h" #include "shared/source/os_interface/os_interface.h" #include "shared/source/os_interface/windows/os_environment_win.h" +#include "shared/test/common/fixtures/memory_allocator_multi_device_fixture.h" #include "shared/test/common/mock_gdi/mock_gdi.h" #include "shared/test/common/mocks/mock_wddm.h" -#include "shared/test/unit_test/os_interface/windows/mock_gdi_interface.h" - -#include "opencl/test/unit_test/fixtures/memory_allocator_multi_device_fixture.h" +#include "shared/test/common/mocks/windows/mock_gdi_interface.h" using namespace NEO; diff --git a/shared/test/common/libult/CMakeLists.txt b/shared/test/common/libult/CMakeLists.txt index 79b2186b26..434dc36b55 100644 --- a/shared/test/common/libult/CMakeLists.txt +++ b/shared/test/common/libult/CMakeLists.txt @@ -1,5 +1,5 @@ # -# Copyright (C) 2021 Intel Corporation +# Copyright (C) 2021-2022 Intel Corporation # # SPDX-License-Identifier: MIT # @@ -63,8 +63,12 @@ set(neo_libult_common_SRCS_LIB_ULT ${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_allocator_fixture.h + ${NEO_SHARED_TEST_DIRECTORY}/common/fixtures/memory_allocator_multi_device_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/memory_manager_fixture.cpp + ${NEO_SHARED_TEST_DIRECTORY}/common/fixtures/memory_manager_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 @@ -114,14 +118,14 @@ if(TESTS_XEHP_AND_LATER) endif() get_property(NEO_SHARED_TESTS_CMD_PARSE GLOBAL PROPERTY NEO_SHARED_TESTS_CMD_PARSE) - list(APPEND neo_libult_common_SRCS_LIB_ULT ${NEO_SHARED_TESTS_CMD_PARSE} ) +set_property(GLOBAL PROPERTY neo_libult_common_SRCS_LIB_ULT ${neo_libult_common_SRCS_LIB_ULT}) -if(UNIX) - list(APPEND neo_libult_common_SRCS_ENABLE_TESTED_HW ${neo_libult_common_SRCS_ENABLE_TESTED_HW_LINUX}) -endif() +set_property(GLOBAL PROPERTY neo_libult_common_SRCS_ENABLE_TESTED_HW ${neo_libult_common_SRCS_ENABLE_TESTED_HW}) + +set_property(GLOBAL PROPERTY neo_libult_common_SRCS_ENABLE_TESTED_HW_LINUX ${neo_libult_common_SRCS_ENABLE_TESTED_HW_LINUX}) add_library(neo_libult_common OBJECT EXCLUDE_FROM_ALL ${neo_libult_common_SRCS_LIB_ULT} @@ -129,27 +133,32 @@ add_library(neo_libult_common OBJECT EXCLUDE_FROM_ALL ) set(neo_libult_common_SRCS_LIB_ULT_WIN + ${NEO_SHARED_TEST_DIRECTORY}/common/fixtures/windows/memory_allocator_multi_device_fixture_windows.cpp ${NEO_SHARED_TEST_DIRECTORY}/common/os_interface/windows/ult_dxcore_factory.cpp ${NEO_SHARED_TEST_DIRECTORY}/common/os_interface/windows/ult_dxcore_factory.h ${NEO_SHARED_TEST_DIRECTORY}/common/os_interface/windows/ult_dxgi_factory.cpp ${NEO_SHARED_TEST_DIRECTORY}/common/os_interface/windows/ult_dxgi_factory.h ) +set_property(GLOBAL PROPERTY neo_libult_common_SRCS_LIB_ULT_WIN ${neo_libult_common_SRCS_LIB_ULT_WIN}) set(neo_libult_common_SRCS_LIB_ULT_LINUX + ${NEO_SHARED_TEST_DIRECTORY}/common/fixtures/linux/memory_allocator_multi_device_fixture_linux.cpp ${NEO_SHARED_TEST_DIRECTORY}/common/os_interface/linux/device_command_stream_fixture.cpp ${NEO_SHARED_TEST_DIRECTORY}/common/os_interface/linux/device_command_stream_fixture.h ) set_property(GLOBAL PROPERTY neo_libult_common_SRCS_LIB_ULT_LINUX ${neo_libult_common_SRCS_LIB_ULT_LINUX}) -if(UNIX AND NOT DISABLE_WDDM_LINUX) - target_sources(neo_libult_common PRIVATE - ${NEO_SHARED_DIRECTORY}/os_interface/windows/wddm/wddm_create.cpp - ) -endif() if(WIN32) target_sources(neo_libult_common PRIVATE ${neo_libult_common_SRCS_LIB_ULT_WIN}) elseif(UNIX) target_sources(neo_libult_common PRIVATE ${neo_libult_common_SRCS_LIB_ULT_LINUX}) + target_sources(neo_libult_common PRIVATE ${neo_libult_common_SRCS_ENABLE_TESTED_HW_LINUX}) +endif() + +if(UNIX AND NOT DISABLE_WDDM_LINUX) + target_sources(neo_libult_common PRIVATE + ${NEO_SHARED_DIRECTORY}/os_interface/windows/wddm/wddm_create.cpp + ) endif() set(neo_libult_SRCS_LINUX diff --git a/shared/test/common/libult/gen12lp/CMakeLists.txt b/shared/test/common/libult/gen12lp/CMakeLists.txt index c4bda19de0..8b7c9eb1eb 100644 --- a/shared/test/common/libult/gen12lp/CMakeLists.txt +++ b/shared/test/common/libult/gen12lp/CMakeLists.txt @@ -1,5 +1,5 @@ # -# Copyright (C) 2021 Intel Corporation +# Copyright (C) 2021-2022 Intel Corporation # # SPDX-License-Identifier: MIT # @@ -7,9 +7,12 @@ if(TESTS_GEN12LP) add_subdirectories() - target_sources(neo_libult_common PRIVATE - ${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt - ${CMAKE_CURRENT_SOURCE_DIR}/special_ult_helper_gen12lp.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/special_ult_helper_gen12lp.h + set(neo_libult_common_SRCS_LIB_ULT_SPECIAL_HELPER + ${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt + ${CMAKE_CURRENT_SOURCE_DIR}/special_ult_helper_gen12lp.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/special_ult_helper_gen12lp.h ) + + set_property(GLOBAL PROPERTY neo_libult_common_SRCS_LIB_ULT_SPECIAL_HELPER ${neo_libult_common_SRCS_LIB_ULT_SPECIAL_HELPER}) + target_sources(neo_libult_common PRIVATE ${neo_libult_common_SRCS_LIB_ULT_SPECIAL_HELPER}) endif() diff --git a/shared/test/common/mocks/CMakeLists.txt b/shared/test/common/mocks/CMakeLists.txt index 6f52f2576a..ef915c8295 100644 --- a/shared/test/common/mocks/CMakeLists.txt +++ b/shared/test/common/mocks/CMakeLists.txt @@ -1,5 +1,5 @@ # -# Copyright (C) 2020-2021 Intel Corporation +# Copyright (C) 2020-2022 Intel Corporation # # SPDX-License-Identifier: MIT # @@ -95,6 +95,8 @@ if(WIN32) ${CMAKE_CURRENT_SOURCE_DIR}/mock_wddm_residency_allocations_container.h ${CMAKE_CURRENT_SOURCE_DIR}/mock_wddm_residency_logger.h ${CMAKE_CURRENT_SOURCE_DIR}/wddm_mock_helpers.h + ${CMAKE_CURRENT_SOURCE_DIR}/windows/mock_gdi_interface.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/windows/mock_gdi_interface.h ${CMAKE_CURRENT_SOURCE_DIR}/windows/mock_wddm_direct_submission.h ) else() diff --git a/shared/test/unit_test/os_interface/windows/mock_gdi_interface.cpp b/shared/test/common/mocks/windows/mock_gdi_interface.cpp similarity index 59% rename from shared/test/unit_test/os_interface/windows/mock_gdi_interface.cpp rename to shared/test/common/mocks/windows/mock_gdi_interface.cpp index 565aa4a513..17eac94a81 100644 --- a/shared/test/unit_test/os_interface/windows/mock_gdi_interface.cpp +++ b/shared/test/common/mocks/windows/mock_gdi_interface.cpp @@ -1,11 +1,11 @@ /* - * Copyright (C) 2020 Intel Corporation + * Copyright (C) 2020-2022 Intel Corporation * * SPDX-License-Identifier: MIT * */ -#include "shared/test/unit_test/os_interface/windows/mock_gdi_interface.h" +#include "shared/test/common/mocks/windows/mock_gdi_interface.h" namespace NEO { UINT64 MockGdi::pagingFenceReturnValue = 0x3ull; diff --git a/shared/test/unit_test/os_interface/windows/mock_gdi_interface.h b/shared/test/common/mocks/windows/mock_gdi_interface.h similarity index 99% rename from shared/test/unit_test/os_interface/windows/mock_gdi_interface.h rename to shared/test/common/mocks/windows/mock_gdi_interface.h index 47179813b7..5d56bd3bc8 100644 --- a/shared/test/unit_test/os_interface/windows/mock_gdi_interface.h +++ b/shared/test/common/mocks/windows/mock_gdi_interface.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2018-2021 Intel Corporation + * Copyright (C) 2018-2022 Intel Corporation * * SPDX-License-Identifier: MIT * diff --git a/shared/test/common/os_interface/windows/wddm_fixture.h b/shared/test/common/os_interface/windows/wddm_fixture.h index 1430456b5f..f636731d42 100644 --- a/shared/test/common/os_interface/windows/wddm_fixture.h +++ b/shared/test/common/os_interface/windows/wddm_fixture.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2018-2021 Intel Corporation + * Copyright (C) 2018-2022 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -24,10 +24,10 @@ #include "shared/test/common/mocks/mock_wddm.h" #include "shared/test/common/mocks/mock_wddm_interface20.h" #include "shared/test/common/mocks/mock_wddm_residency_allocations_container.h" +#include "shared/test/common/mocks/windows/mock_gdi_interface.h" #include "shared/test/common/mocks/windows/mock_gmm_memory_base.h" #include "shared/test/common/os_interface/windows/gdi_dll_fixture.h" #include "shared/test/common/test_macros/test.h" -#include "shared/test/unit_test/os_interface/windows/mock_gdi_interface.h" namespace NEO { struct WddmFixture : public Test { diff --git a/shared/test/unit_test/os_interface/windows/CMakeLists.txt b/shared/test/unit_test/os_interface/windows/CMakeLists.txt index 5a0f860bbd..99ee36cdc8 100644 --- a/shared/test/unit_test/os_interface/windows/CMakeLists.txt +++ b/shared/test/unit_test/os_interface/windows/CMakeLists.txt @@ -1,5 +1,5 @@ # -# Copyright (C) 2019-2021 Intel Corporation +# Copyright (C) 2019-2022 Intel Corporation # # SPDX-License-Identifier: MIT # @@ -10,8 +10,6 @@ set(NEO_CORE_OS_INTERFACE_TESTS_WINDOWS ${CMAKE_CURRENT_SOURCE_DIR}/adapter_info_tests.h ${CMAKE_CURRENT_SOURCE_DIR}/gdi_interface_tests.cpp ${CMAKE_CURRENT_SOURCE_DIR}/gmm_helper_tests_win.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/mock_gdi_interface.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/mock_gdi_interface.h ${CMAKE_CURRENT_SOURCE_DIR}/um_km_data_translator_tests.cpp ${CMAKE_CURRENT_SOURCE_DIR}/wddm_preemption_tests.cpp ${CMAKE_CURRENT_SOURCE_DIR}/wddm_special_heap_test.cpp