mirror of
https://github.com/intel/compute-runtime.git
synced 2026-01-03 14:55:24 +08:00
Move non-ult shared files to single directory
Add SKIP_SHARED_UNIT_TESTS flag Related-To: NEO-5201 Signed-off-by: Pawel Cieslak <pawel.cieslak@intel.com>
This commit is contained in:
committed by
Compute-Runtime-Automation
parent
1a0b7dc393
commit
8a700c5187
14
shared/test/common/test_macros/CMakeLists.txt
Normal file
14
shared/test/common/test_macros/CMakeLists.txt
Normal file
@@ -0,0 +1,14 @@
|
||||
#
|
||||
# Copyright (C) 2020-2021 Intel Corporation
|
||||
#
|
||||
# SPDX-License-Identifier: MIT
|
||||
#
|
||||
|
||||
set(NEO_CORE_test_macros
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/header${BRANCH_DIR_SUFFIX}/test.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/test_checks_shared.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/test_checks_shared.h
|
||||
)
|
||||
|
||||
set_property(GLOBAL PROPERTY NEO_CORE_test_macros ${NEO_CORE_test_macros})
|
||||
1109
shared/test/common/test_macros/header/test.h
Normal file
1109
shared/test/common/test_macros/header/test.h
Normal file
File diff suppressed because it is too large
Load Diff
73
shared/test/common/test_macros/test_checks_shared.cpp
Normal file
73
shared/test/common/test_macros/test_checks_shared.cpp
Normal file
@@ -0,0 +1,73 @@
|
||||
/*
|
||||
* Copyright (C) 2020-2021 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#include "shared/test/common/test_macros/test_checks_shared.h"
|
||||
|
||||
#include "shared/source/device/device.h"
|
||||
#include "shared/source/helpers/constants.h"
|
||||
#include "shared/source/helpers/hw_helper.h"
|
||||
#include "shared/test/common/helpers/default_hw_info.h"
|
||||
|
||||
#include "test.h"
|
||||
|
||||
using namespace NEO;
|
||||
|
||||
bool TestChecks::is64Bit() {
|
||||
return ::is64bit;
|
||||
}
|
||||
|
||||
bool TestChecks::supportsBlitter(const HardwareInfo *pHardwareInfo) {
|
||||
auto engines = HwHelper::get(::renderCoreFamily).getGpgpuEngineInstances(*pHardwareInfo);
|
||||
for (const auto &engine : engines) {
|
||||
if (engine.first == aub_stream::EngineType::ENGINE_BCS) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool TestChecks::supportsImages(const HardwareInfo &hardwareInfo) {
|
||||
return hardwareInfo.capabilityTable.supportsImages;
|
||||
}
|
||||
|
||||
bool TestChecks::supportsImages(const std::unique_ptr<HardwareInfo> &pHardwareInfo) {
|
||||
return supportsImages(*pHardwareInfo);
|
||||
}
|
||||
|
||||
bool TestChecks::supportsSvm(const HardwareInfo *pHardwareInfo) {
|
||||
return pHardwareInfo->capabilityTable.ftrSvm;
|
||||
}
|
||||
bool TestChecks::supportsSvm(const std::unique_ptr<HardwareInfo> &pHardwareInfo) {
|
||||
return supportsSvm(pHardwareInfo.get());
|
||||
}
|
||||
bool TestChecks::supportsSvm(const Device *pDevice) {
|
||||
return supportsSvm(&pDevice->getHardwareInfo());
|
||||
}
|
||||
|
||||
class TestMacrosIfNotMatchTearDownCall : public ::testing::Test {
|
||||
public:
|
||||
void expectCorrectPlatform() {
|
||||
EXPECT_EQ(IGFX_SKYLAKE, defaultHwInfo->platform.eProductFamily);
|
||||
}
|
||||
void SetUp() override {
|
||||
expectCorrectPlatform();
|
||||
}
|
||||
void TearDown() override {
|
||||
expectCorrectPlatform();
|
||||
}
|
||||
};
|
||||
|
||||
HWTEST2_F(TestMacrosIfNotMatchTearDownCall, givenNotMatchPlatformWhenUseHwTest2FThenSetUpAndTearDownAreNotCalled, IsSKL) {
|
||||
expectCorrectPlatform();
|
||||
}
|
||||
class TestMacrosWithParamIfNotMatchTearDownCall : public TestMacrosIfNotMatchTearDownCall, public ::testing::WithParamInterface<int> {};
|
||||
HWTEST2_P(TestMacrosWithParamIfNotMatchTearDownCall, givenNotMatchPlatformWhenUseHwTest2PThenSetUpAndTearDownAreNotCalled, IsSKL) {
|
||||
expectCorrectPlatform();
|
||||
}
|
||||
INSTANTIATE_TEST_CASE_P(givenNotMatchPlatformWhenUseHwTest2PThenSetUpAndTearDownAreNotCalled,
|
||||
TestMacrosWithParamIfNotMatchTearDownCall,
|
||||
::testing::Values(0));
|
||||
52
shared/test/common/test_macros/test_checks_shared.h
Normal file
52
shared/test/common/test_macros/test_checks_shared.h
Normal file
@@ -0,0 +1,52 @@
|
||||
/*
|
||||
* Copyright (C) 2020-2021 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
#include "gtest/gtest.h"
|
||||
|
||||
#include <memory>
|
||||
|
||||
namespace NEO {
|
||||
class Device;
|
||||
struct HardwareInfo;
|
||||
|
||||
namespace TestChecks {
|
||||
bool is64Bit();
|
||||
bool supportsBlitter(const HardwareInfo *pHardwareInfo);
|
||||
bool supportsImages(const HardwareInfo &hardwareInfo);
|
||||
bool supportsImages(const std::unique_ptr<HardwareInfo> &pHardwareInfo);
|
||||
bool supportsSvm(const HardwareInfo *pHardwareInfo);
|
||||
bool supportsSvm(const std::unique_ptr<HardwareInfo> &pHardwareInfo);
|
||||
bool supportsSvm(const Device *pDevice);
|
||||
} // namespace TestChecks
|
||||
|
||||
} // namespace NEO
|
||||
|
||||
#define REQUIRE_32BIT_OR_SKIP() \
|
||||
if (NEO::TestChecks::is64Bit() == true) { \
|
||||
GTEST_SKIP(); \
|
||||
}
|
||||
|
||||
#define REQUIRE_64BIT_OR_SKIP() \
|
||||
if (NEO::TestChecks::is64Bit() == false) { \
|
||||
GTEST_SKIP(); \
|
||||
}
|
||||
|
||||
#define REQUIRE_SVM_OR_SKIP(param) \
|
||||
if (NEO::TestChecks::supportsSvm(param) == false) { \
|
||||
GTEST_SKIP(); \
|
||||
}
|
||||
|
||||
#define REQUIRE_BLITTER_OR_SKIP(param) \
|
||||
if (NEO::TestChecks::supportsBlitter(param) == false) { \
|
||||
GTEST_SKIP(); \
|
||||
}
|
||||
|
||||
#define REQUIRE_IMAGES_OR_SKIP(param) \
|
||||
if (NEO::TestChecks::supportsImages(param) == false) { \
|
||||
GTEST_SKIP(); \
|
||||
}
|
||||
Reference in New Issue
Block a user