mirror of
https://github.com/intel/compute-runtime.git
synced 2025-12-24 21:18:24 +08:00
Adding support for excluding tests per platform
Change-Id: I5c41cadd0f44d05640593673f1c00da84d428711
This commit is contained in:
committed by
sys_ocldev
parent
95df25af23
commit
311de0c644
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2017-2018 Intel Corporation
|
||||
* Copyright (C) 2017-2019 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
@@ -17,6 +17,7 @@ using namespace OCLRT;
|
||||
|
||||
class EnqueueFillImageTest : public EnqueueFillImageTestFixture,
|
||||
public ::testing::Test {
|
||||
public:
|
||||
void SetUp(void) override {
|
||||
EnqueueFillImageTestFixture::SetUp();
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2017-2018 Intel Corporation
|
||||
* Copyright (C) 2017-2019 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
@@ -394,6 +394,7 @@ INSTANTIATE_TEST_CASE_P(ParentKernelEnqueueTest,
|
||||
|
||||
class ParentKernelEnqueueFixture : public ExecutionModelSchedulerTest,
|
||||
public testing::Test {
|
||||
public:
|
||||
void SetUp() override {
|
||||
ExecutionModelSchedulerTest::SetUp();
|
||||
}
|
||||
|
||||
@@ -244,6 +244,7 @@ HWTEST_F(ParentKernelCommandStreamFixture, GivenDispatchInfoWithParentKernelWhen
|
||||
|
||||
class MockParentKernelDispatch : public ExecutionModelSchedulerTest,
|
||||
public testing::Test {
|
||||
public:
|
||||
void SetUp() override {
|
||||
ExecutionModelSchedulerTest::SetUp();
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2017-2018 Intel Corporation
|
||||
* Copyright (C) 2017-2019 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
@@ -23,6 +23,7 @@ using namespace OCLRT;
|
||||
|
||||
class ExecutionModelSchedulerFixture : public ExecutionModelSchedulerTest,
|
||||
public testing::Test {
|
||||
public:
|
||||
void SetUp() override {
|
||||
ExecutionModelSchedulerTest::SetUp();
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#
|
||||
# Copyright (C) 2017-2018 Intel Corporation
|
||||
# Copyright (C) 2017-2019 Intel Corporation
|
||||
#
|
||||
# SPDX-License-Identifier: MIT
|
||||
#
|
||||
@@ -10,6 +10,8 @@ set(IGDRCL_SRCS_tests_gen_common
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/cmd_parse_base_mi_arb.inl
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/cmd_parse_gpgpu_walker.inl
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/cmd_parse_sip.inl
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/exclude_tests/exclude_test_declare.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/exclude_tests/exclude_test_exclude.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/gen_cmd_parse.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/gen_commands_common_validation.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/matchers.h
|
||||
|
||||
25
unit_tests/gen_common/exclude_tests/exclude_test_declare.cpp
Normal file
25
unit_tests/gen_common/exclude_tests/exclude_test_declare.cpp
Normal file
@@ -0,0 +1,25 @@
|
||||
/*
|
||||
* Copyright (C) 2017-2019 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#include "hw_cmds.h"
|
||||
#include "test.h"
|
||||
|
||||
#include <type_traits>
|
||||
|
||||
using ExcludeTest = ::testing::Test;
|
||||
|
||||
HWCMDTEST_F(IGFX_GEN8_CORE, ExcludeTest, whenBdwExcludedDontRunOnBdw) {
|
||||
EXPECT_NE(IGFX_BROADWELL, ::productFamily);
|
||||
}
|
||||
|
||||
HWCMDTEST_F(IGFX_GEN8_CORE, ExcludeTest, whenSklExcludedDontRunOnSkl) {
|
||||
EXPECT_NE(IGFX_SKYLAKE, ::productFamily);
|
||||
}
|
||||
|
||||
HWCMDTEST_F(IGFX_GEN8_CORE, ExcludeTest, whenCnlExcludedDontRunOnCnl) {
|
||||
EXPECT_NE(IGFX_CANNONLAKE, ::productFamily);
|
||||
}
|
||||
12
unit_tests/gen_common/exclude_tests/exclude_test_exclude.cpp
Normal file
12
unit_tests/gen_common/exclude_tests/exclude_test_exclude.cpp
Normal file
@@ -0,0 +1,12 @@
|
||||
/*
|
||||
* Copyright (C) 2017-2019 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#include "test.h"
|
||||
|
||||
HWCMDTEST_EXCLUDE_FAMILY(ExcludeTest, whenBdwExcludedDontRunOnBdw, IGFX_BROADWELL);
|
||||
HWCMDTEST_EXCLUDE_FAMILY(ExcludeTest, whenSklExcludedDontRunOnSkl, IGFX_SKYLAKE);
|
||||
HWCMDTEST_EXCLUDE_FAMILY(ExcludeTest, whenCnlExcludedDontRunOnCnl, IGFX_CANNONLAKE);
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2017-2018 Intel Corporation
|
||||
* Copyright (C) 2017-2019 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
@@ -11,6 +11,10 @@
|
||||
#include "igfxfmid.h"
|
||||
#include "gtest/gtest.h"
|
||||
|
||||
#include <cstdint>
|
||||
#include <memory>
|
||||
#include <unordered_set>
|
||||
|
||||
extern PRODUCT_FAMILY productFamily;
|
||||
extern GFXCORE_FAMILY renderCoreFamily;
|
||||
|
||||
@@ -85,11 +89,28 @@ extern GFXCORE_FAMILY renderCoreFamily;
|
||||
HWTEST_TEST_(test_fixture, test_name, test_fixture, \
|
||||
::testing::internal::GetTypeId<test_fixture>())
|
||||
|
||||
#define PLATFORM_EXCLUDES_CLASS_NAME(test_case_name, test_name) \
|
||||
PLATFORM_EXCLUDES_##test_case_name##test_name
|
||||
|
||||
// Macros to provide template based testing.
|
||||
// Test can use FamilyType in the test -- equivalent to SKLFamily
|
||||
#define HWCMDTEST_TEST_(cmdset_gen_base, test_case_name, test_name, parent_class, parent_id) \
|
||||
class GTEST_TEST_CLASS_NAME_(test_case_name, test_name) : public parent_class { \
|
||||
class PLATFORM_EXCLUDES_CLASS_NAME(test_case_name, test_name) { \
|
||||
public: \
|
||||
static std::unique_ptr<std::unordered_set<uint32_t>> &getExcludes() { \
|
||||
static std::unique_ptr<std::unordered_set<uint32_t>> excludes; \
|
||||
return excludes; \
|
||||
} \
|
||||
static void addExclude(uint32_t product) { \
|
||||
auto &excludes = getExcludes(); \
|
||||
if (excludes == nullptr) { \
|
||||
excludes = std::make_unique<std::unordered_set<uint32_t>>(); \
|
||||
} \
|
||||
excludes->insert(product); \
|
||||
} \
|
||||
}; \
|
||||
\
|
||||
class GTEST_TEST_CLASS_NAME_(test_case_name, test_name) : public parent_class { \
|
||||
public: \
|
||||
GTEST_TEST_CLASS_NAME_(test_case_name, test_name) \
|
||||
() {} \
|
||||
@@ -100,7 +121,18 @@ extern GFXCORE_FAMILY renderCoreFamily;
|
||||
\
|
||||
template <typename FamilyType, bool ShouldBeTested = FamilyType::supportsCmdSet(cmdset_gen_base)> \
|
||||
auto runCmdTestHwIfSupported() -> typename std::enable_if<ShouldBeTested>::type { \
|
||||
testBodyHw<FamilyType>(); \
|
||||
if (notExcluded()) { \
|
||||
testBodyHw<FamilyType>(); \
|
||||
} \
|
||||
} \
|
||||
\
|
||||
bool notExcluded() const { \
|
||||
using ExcludesT = PLATFORM_EXCLUDES_CLASS_NAME(test_case_name, test_name); \
|
||||
auto &excludes = ExcludesT::getExcludes(); \
|
||||
if (excludes == nullptr) { \
|
||||
return true; \
|
||||
} \
|
||||
return excludes->count(::productFamily) == 0; \
|
||||
} \
|
||||
\
|
||||
template <typename FamilyType, bool ShouldBeTested = FamilyType::supportsCmdSet(cmdset_gen_base)> \
|
||||
@@ -124,6 +156,16 @@ extern GFXCORE_FAMILY renderCoreFamily;
|
||||
break; \
|
||||
} \
|
||||
} \
|
||||
void SetUp() override { \
|
||||
if (notExcluded()) { \
|
||||
parent_class::SetUp(); \
|
||||
} \
|
||||
} \
|
||||
void TearDown() override { \
|
||||
if (notExcluded()) { \
|
||||
parent_class::TearDown(); \
|
||||
} \
|
||||
} \
|
||||
static ::testing::TestInfo *const test_info_ GTEST_ATTRIBUTE_UNUSED_; \
|
||||
GTEST_DISALLOW_COPY_AND_ASSIGN_( \
|
||||
GTEST_TEST_CLASS_NAME_(test_case_name, test_name)); \
|
||||
@@ -140,6 +182,28 @@ extern GFXCORE_FAMILY renderCoreFamily;
|
||||
template <typename FamilyType> \
|
||||
void GTEST_TEST_CLASS_NAME_(test_case_name, test_name)::testBodyHw()
|
||||
|
||||
#define HWCMDTEST_EXCLUDE_FAMILY(test_case_name, test_name, family) \
|
||||
class PLATFORM_EXCLUDES_CLASS_NAME(test_case_name, test_name) { \
|
||||
public: \
|
||||
static std::unique_ptr<std::unordered_set<uint32_t>> &getExcludes() { \
|
||||
static std::unique_ptr<std::unordered_set<uint32_t>> excludes; \
|
||||
return excludes; \
|
||||
} \
|
||||
static void addExclude(uint32_t product) { \
|
||||
auto &excludes = getExcludes(); \
|
||||
if (excludes == nullptr) { \
|
||||
excludes = std::make_unique<std::unordered_set<uint32_t>>(); \
|
||||
} \
|
||||
excludes->insert(product); \
|
||||
} \
|
||||
}; \
|
||||
\
|
||||
struct test_case_name##test_name##_PLATFORM_EXCLUDES_EXCLUDE_##family { \
|
||||
test_case_name##test_name##_PLATFORM_EXCLUDES_EXCLUDE_##family() { \
|
||||
PLATFORM_EXCLUDES_CLASS_NAME(test_case_name, test_name)::addExclude(family); \
|
||||
} \
|
||||
} test_case_name##test_name##_PLATFORM_EXCLUDES_EXCLUDE_##family##_init;
|
||||
|
||||
#define HWCMDTEST_F(cmdset_gen_base, test_fixture, test_name) \
|
||||
HWCMDTEST_TEST_(cmdset_gen_base, test_fixture, test_name, test_fixture, \
|
||||
::testing::internal::GetTypeId<test_fixture>())
|
||||
|
||||
@@ -31,6 +31,7 @@ class ThreadGroupPreemptionTests : public DevicePreemptionTests {
|
||||
};
|
||||
|
||||
class MidThreadPreemptionTests : public DevicePreemptionTests {
|
||||
public:
|
||||
void SetUp() override {
|
||||
dbgRestore.reset(new DebugManagerStateRestore());
|
||||
DebugManager.flags.ForcePreemptionMode.set(static_cast<int32_t>(PreemptionMode::MidThread));
|
||||
|
||||
Reference in New Issue
Block a user