mirror of
https://github.com/intel/compute-runtime.git
synced 2025-12-24 21:18:24 +08:00
CMake: don't include shared/test/unit_test when shared tests are skipped 1/n
Related-To: NEO-6524 Signed-off-by: Warchulski, Jaroslaw <jaroslaw.warchulski@intel.com>
This commit is contained in:
committed by
Compute-Runtime-Automation
parent
89264b99e5
commit
e7cca25894
@@ -4,14 +4,13 @@
|
||||
# SPDX-License-Identifier: MIT
|
||||
#
|
||||
|
||||
target_sources(${TARGET_NAME} PRIVATE
|
||||
target_sources(neo_shared_tests PRIVATE
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/compiler_cache_tests.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/compiler_interface_tests.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/compiler_options_tests.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/external_functions_tests.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/intermediate_representations_tests.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/linker_mock.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/linker_tests.cpp
|
||||
)
|
||||
|
||||
|
||||
@@ -1,97 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2019-2022 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "shared/source/compiler_interface/linker.h"
|
||||
|
||||
#include <functional>
|
||||
#include <tuple>
|
||||
|
||||
template <class BaseClass>
|
||||
struct WhiteBox;
|
||||
|
||||
template <class BaseClass>
|
||||
struct Mock;
|
||||
|
||||
template <>
|
||||
struct WhiteBox<NEO::LinkerInput> : NEO::LinkerInput {
|
||||
using BaseClass = NEO::LinkerInput;
|
||||
|
||||
using BaseClass::dataRelocations;
|
||||
using BaseClass::exportedFunctionsSegmentId;
|
||||
using BaseClass::extFuncSymbols;
|
||||
using BaseClass::extFunDependencies;
|
||||
using BaseClass::kernelDependencies;
|
||||
using BaseClass::parseRelocationForExtFuncUsage;
|
||||
using BaseClass::symbols;
|
||||
using BaseClass::textRelocations;
|
||||
using BaseClass::traits;
|
||||
using BaseClass::valid;
|
||||
};
|
||||
|
||||
template <>
|
||||
struct WhiteBox<NEO::Linker> : NEO::Linker {
|
||||
using BaseClass = NEO::Linker;
|
||||
using BaseClass::BaseClass;
|
||||
using BaseClass::patchDataSegments;
|
||||
using BaseClass::patchInstructionsSegments;
|
||||
using BaseClass::relocatedSymbols;
|
||||
using BaseClass::resolveExternalFunctions;
|
||||
};
|
||||
|
||||
template <typename MockT, typename ReturnT, typename... ArgsT>
|
||||
struct LightMockConfig {
|
||||
using MockReturnT = ReturnT;
|
||||
using OverrideT = std::function<ReturnT(MockT *, ArgsT...)>;
|
||||
|
||||
uint32_t timesCalled = 0U;
|
||||
OverrideT overrideFunc;
|
||||
};
|
||||
|
||||
template <typename ConfigT, typename ObjT, typename... ArgsT>
|
||||
typename ConfigT::MockReturnT invokeMocked(ConfigT &config, ObjT obj, ArgsT &&...args) {
|
||||
config.timesCalled += 1;
|
||||
if (config.overrideFunc) {
|
||||
return config.overrideFunc(obj, std::forward<ArgsT>(args)...);
|
||||
} else {
|
||||
return config.originalFunc(obj, std::forward<ArgsT>(args)...);
|
||||
}
|
||||
}
|
||||
|
||||
#define LIGHT_MOCK_OVERRIDE_2(NAME, MOCK_T, BASE_T, RETURN_T, ARG0_T, ARG1_T) \
|
||||
struct : LightMockConfig<MOCK_T, RETURN_T, ARG0_T, ARG1_T> { \
|
||||
OverrideT originalFunc = +[](BaseT *obj, ARG0_T arg0, ARG1_T arg1) -> RETURN_T { \
|
||||
return obj->BaseT::NAME(std::forward<ARG0_T>(arg0), std::forward<ARG1_T>(arg1)); \
|
||||
}; \
|
||||
} NAME##MockConfig; \
|
||||
\
|
||||
RETURN_T NAME(ARG0_T arg0, ARG1_T arg1) override { \
|
||||
return invokeMocked(NAME##MockConfig, this, std::forward<ARG0_T>(arg0), std::forward<ARG1_T>(arg1)); \
|
||||
}
|
||||
|
||||
#define LIGHT_MOCK_OVERRIDE_3(NAME, MOCK_T, BASE_T, RETURN_T, ARG0_T, ARG1_T, ARG2_T) \
|
||||
struct : LightMockConfig<MOCK_T, RETURN_T, ARG0_T, ARG1_T, ARG2_T> { \
|
||||
OverrideT originalFunc = +[](BaseT *obj, ARG0_T arg0, ARG1_T arg1, ARG2_T arg2) -> RETURN_T { \
|
||||
return obj->BaseT::NAME(std::forward<ARG0_T>(arg0), std::forward<ARG1_T>(arg1), std::forward<ARG2_T>(arg2)); \
|
||||
}; \
|
||||
} NAME##MockConfig; \
|
||||
\
|
||||
RETURN_T NAME(ARG0_T arg0, ARG1_T arg1, ARG2_T arg2) override { \
|
||||
return invokeMocked(NAME##MockConfig, this, std::forward<ARG0_T>(arg0), std::forward<ARG1_T>(arg1), std::forward<ARG2_T>(arg2)); \
|
||||
}
|
||||
|
||||
template <>
|
||||
struct Mock<NEO::LinkerInput> : WhiteBox<NEO::LinkerInput> {
|
||||
using ThisT = Mock<NEO::LinkerInput>;
|
||||
using BaseT = NEO::LinkerInput;
|
||||
using WhiteBoxBaseT = WhiteBox<BaseT>;
|
||||
|
||||
LIGHT_MOCK_OVERRIDE_2(decodeGlobalVariablesSymbolTable, ThisT, BaseT, bool, const void *, uint32_t);
|
||||
LIGHT_MOCK_OVERRIDE_3(decodeExportedFunctionsSymbolTable, ThisT, BaseT, bool, const void *, uint32_t, uint32_t);
|
||||
LIGHT_MOCK_OVERRIDE_3(decodeRelocationTable, ThisT, BaseT, bool, const void *, uint32_t, uint32_t);
|
||||
};
|
||||
@@ -12,18 +12,18 @@
|
||||
#include "shared/source/kernel/kernel_descriptor.h"
|
||||
#include "shared/source/memory_manager/graphics_allocation.h"
|
||||
#include "shared/source/program/program_initialization.h"
|
||||
#include "shared/test/common/compiler_interface/linker_mock.h"
|
||||
#include "shared/test/common/device_binary_format/zebin_tests.h"
|
||||
#include "shared/test/common/helpers/debug_manager_state_restore.h"
|
||||
#include "shared/test/common/helpers/default_hw_info.h"
|
||||
#include "shared/test/common/mocks/mock_device.h"
|
||||
#include "shared/test/common/mocks/mock_elf.h"
|
||||
#include "shared/test/common/mocks/mock_graphics_allocation.h"
|
||||
#include "shared/test/common/mocks/ult_device_factory.h"
|
||||
#include "shared/test/unit_test/device_binary_format/zebin_tests.h"
|
||||
#include "shared/test/unit_test/helpers/gtest_helpers.h"
|
||||
|
||||
#include "RelocationInfo.h"
|
||||
#include "gtest/gtest.h"
|
||||
#include "linker_mock.h"
|
||||
|
||||
#include <string>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user