mirror of
https://github.com/intel/compute-runtime.git
synced 2026-01-08 14:02:58 +08:00
Add functionality to exclude specific product from HW_TEST_F
Change-Id: I4707e8d8b28375e180e9229791d605d4fc11ad42 Signed-off-by: Mateusz Jablonski <mateusz.jablonski@intel.com>
This commit is contained in:
committed by
sys_ocldev
parent
429487fad0
commit
233e3d762b
@@ -11,16 +11,36 @@
|
||||
|
||||
#include <type_traits>
|
||||
|
||||
using ExcludeTest = ::testing::Test;
|
||||
template <uint32_t prohibitedValue>
|
||||
struct ExcludeTest : ::testing::Test {
|
||||
void SetUp() override {
|
||||
EXPECT_NE(prohibitedValue, ::productFamily);
|
||||
}
|
||||
void TearDown() override {
|
||||
EXPECT_NE(prohibitedValue, ::productFamily);
|
||||
}
|
||||
};
|
||||
|
||||
HWCMDTEST_F(IGFX_GEN8_CORE, ExcludeTest, whenBdwExcludedDontRunOnBdw) {
|
||||
using ExcludeTestBdw = ExcludeTest<IGFX_BROADWELL>;
|
||||
HWCMDTEST_F(IGFX_GEN8_CORE, ExcludeTestBdw, givenHwCmdTestWhenBdwExcludedDontRunOnBdw) {
|
||||
EXPECT_NE(IGFX_BROADWELL, ::productFamily);
|
||||
}
|
||||
HWTEST_F(ExcludeTestBdw, givenHwTestWhenBdwExcludedDontRunOnBdw) {
|
||||
EXPECT_NE(IGFX_BROADWELL, ::productFamily);
|
||||
}
|
||||
|
||||
HWCMDTEST_F(IGFX_GEN8_CORE, ExcludeTest, whenSklExcludedDontRunOnSkl) {
|
||||
using ExcludeTestSkl = ExcludeTest<IGFX_SKYLAKE>;
|
||||
HWCMDTEST_F(IGFX_GEN8_CORE, ExcludeTestSkl, givenHwCmdTestWhenSklExcludedDontRunOnSkl) {
|
||||
EXPECT_NE(IGFX_SKYLAKE, ::productFamily);
|
||||
}
|
||||
HWTEST_F(ExcludeTestSkl, givenHwTestWhenSklExcludedDontRunOnSkl) {
|
||||
EXPECT_NE(IGFX_SKYLAKE, ::productFamily);
|
||||
}
|
||||
|
||||
HWCMDTEST_F(IGFX_GEN8_CORE, ExcludeTest, whenCnlExcludedDontRunOnCnl) {
|
||||
using ExcludeTestCnl = ExcludeTest<IGFX_CANNONLAKE>;
|
||||
HWCMDTEST_F(IGFX_GEN8_CORE, ExcludeTestCnl, givenHwCmdTestWhenCnlExcludedDontRunOnCnl) {
|
||||
EXPECT_NE(IGFX_CANNONLAKE, ::productFamily);
|
||||
}
|
||||
HWTEST_F(ExcludeTestCnl, givenHwTestWhenCnlExcludedDontRunOnCnl) {
|
||||
EXPECT_NE(IGFX_CANNONLAKE, ::productFamily);
|
||||
}
|
||||
|
||||
@@ -7,6 +7,9 @@
|
||||
|
||||
#include "test.h"
|
||||
|
||||
HWCMDTEST_EXCLUDE_FAMILY(ExcludeTest, whenBdwExcludedDontRunOnBdw, IGFX_BROADWELL);
|
||||
HWCMDTEST_EXCLUDE_FAMILY(ExcludeTest, whenSklExcludedDontRunOnSkl, IGFX_SKYLAKE);
|
||||
HWCMDTEST_EXCLUDE_FAMILY(ExcludeTest, whenCnlExcludedDontRunOnCnl, IGFX_CANNONLAKE);
|
||||
HWCMDTEST_EXCLUDE_FAMILY(ExcludeTestBdw, givenHwCmdTestWhenBdwExcludedDontRunOnBdw, IGFX_BROADWELL);
|
||||
HWCMDTEST_EXCLUDE_FAMILY(ExcludeTestBdw, givenHwTestWhenBdwExcludedDontRunOnBdw, IGFX_BROADWELL);
|
||||
HWCMDTEST_EXCLUDE_FAMILY(ExcludeTestSkl, givenHwCmdTestWhenSklExcludedDontRunOnSkl, IGFX_SKYLAKE);
|
||||
HWCMDTEST_EXCLUDE_FAMILY(ExcludeTestSkl, givenHwTestWhenSklExcludedDontRunOnSkl, IGFX_SKYLAKE);
|
||||
HWCMDTEST_EXCLUDE_FAMILY(ExcludeTestCnl, givenHwCmdTestWhenCnlExcludedDontRunOnCnl, IGFX_CANNONLAKE);
|
||||
HWCMDTEST_EXCLUDE_FAMILY(ExcludeTestCnl, givenHwTestWhenCnlExcludedDontRunOnCnl, IGFX_CANNONLAKE);
|
||||
|
||||
@@ -44,6 +44,21 @@ extern GFXCORE_FAMILY renderCoreFamily;
|
||||
// Macros to provide template based testing.
|
||||
// Test can use FamilyType in the test -- equivalent to SKLFamily
|
||||
#define HWTEST_TEST_(test_case_name, test_name, parent_class, parent_id) \
|
||||
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: \
|
||||
@@ -53,21 +68,41 @@ extern GFXCORE_FAMILY renderCoreFamily;
|
||||
private: \
|
||||
template <typename FamilyType> \
|
||||
void testBodyHw(); \
|
||||
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; \
|
||||
} \
|
||||
void SetUp() override { \
|
||||
if (notExcluded()) { \
|
||||
parent_class::SetUp(); \
|
||||
} \
|
||||
} \
|
||||
void TearDown() override { \
|
||||
if (notExcluded()) { \
|
||||
parent_class::TearDown(); \
|
||||
} \
|
||||
} \
|
||||
\
|
||||
void TestBody() override { \
|
||||
switch (::renderCoreFamily) { \
|
||||
case IGFX_GEN8_CORE: \
|
||||
BDW_TYPED_TEST_BODY \
|
||||
break; \
|
||||
case IGFX_GEN9_CORE: \
|
||||
SKL_TYPED_TEST_BODY \
|
||||
break; \
|
||||
case IGFX_GEN10_CORE: \
|
||||
CNL_TYPED_TEST_BODY \
|
||||
break; \
|
||||
default: \
|
||||
ASSERT_TRUE((false && "Unknown hardware family")); \
|
||||
break; \
|
||||
if (notExcluded()) { \
|
||||
switch (::renderCoreFamily) { \
|
||||
case IGFX_GEN8_CORE: \
|
||||
BDW_TYPED_TEST_BODY \
|
||||
break; \
|
||||
case IGFX_GEN9_CORE: \
|
||||
SKL_TYPED_TEST_BODY \
|
||||
break; \
|
||||
case IGFX_GEN10_CORE: \
|
||||
CNL_TYPED_TEST_BODY \
|
||||
break; \
|
||||
default: \
|
||||
ASSERT_TRUE((false && "Unknown hardware family")); \
|
||||
break; \
|
||||
} \
|
||||
} \
|
||||
} \
|
||||
static ::testing::TestInfo *const test_info_ GTEST_ATTRIBUTE_UNUSED_; \
|
||||
|
||||
Reference in New Issue
Block a user