/* * Copyright (C) 2021-2022 Intel Corporation * * SPDX-License-Identifier: MIT * */ #pragma once #include "shared/source/helpers/hw_info.h" #include "shared/test/common/test_macros/test_excludes.h" #include "gtest/gtest.h" #include "hw_cmds.h" #include "igfxfmid.h" #include "per_product_test_selector.h" #include "test_mode.h" extern PRODUCT_FAMILY productFamily; extern GFXCORE_FAMILY renderCoreFamily; #define TO_STR2(x) #x #define TO_STR(x) TO_STR2(x) #define TEST_MAX_LENGTH 140 #define CHECK_TEST_NAME_LENGTH_WITH_MAX(test_fixture, test_name, max_length) \ static_assert((NEO::defaultTestMode != NEO::TestMode::AubTests && NEO::defaultTestMode != NEO::TestMode::AubTestsWithTbx) || (sizeof(#test_fixture) + sizeof(#test_name) <= max_length), "Test and fixture names length exceeds max allowed size: " TO_STR(max_length)); #define CHECK_TEST_NAME_LENGTH(test_fixture, test_name) \ CHECK_TEST_NAME_LENGTH_WITH_MAX(test_fixture, test_name, TEST_MAX_LENGTH) #define HWTEST_EXCLUDE_PRODUCT(test_suite_name, test_name, family) \ struct test_suite_name##test_name##_PLATFORM_EXCLUDES_EXCLUDE_##family { \ test_suite_name##test_name##_PLATFORM_EXCLUDES_EXCLUDE_##family() { \ NEO::TestExcludes::addTestExclude(#test_suite_name #test_name, family); \ } \ } test_suite_name##test_name##_PLATFORM_EXCLUDES_EXCLUDE_##family##_init; #define IS_TEST_EXCLUDED(test_suite_name, test_name) \ NEO::TestExcludes::isTestExcluded(#test_suite_name #test_name, ::productFamily, ::renderCoreFamily) #ifdef TEST_F #undef TEST_F #endif // Taken from gtest.h #define TEST_F(test_fixture, test_name) \ CHECK_TEST_NAME_LENGTH(test_fixture, test_name) \ GTEST_TEST_(test_fixture, test_name, test_fixture, \ ::testing::internal::GetTypeId()) #ifdef TEST_P #undef TEST_P #endif // Taken from gtest.h #define TEST_P(test_suite_name, test_name) \ CHECK_TEST_NAME_LENGTH(test_fixture, test_name) \ class GTEST_TEST_CLASS_NAME_(test_suite_name, test_name) \ : public test_suite_name { \ public: \ GTEST_TEST_CLASS_NAME_(test_suite_name, test_name) \ () {} \ void TestBody() override; \ \ private: \ static int AddToRegistry() { \ ::testing::UnitTest::GetInstance()->parameterized_test_registry().GetTestCasePatternHolder( \ #test_suite_name, ::testing::internal::CodeLocation(__FILE__, __LINE__)) \ ->AddTestPattern( \ #test_suite_name, \ #test_name, \ new ::testing::internal::TestMetaFactory< \ GTEST_TEST_CLASS_NAME_(test_suite_name, test_name)>()); \ return 0; \ } \ static int gtest_registering_dummy_; \ GTEST_DISALLOW_COPY_AND_ASSIGN_( \ GTEST_TEST_CLASS_NAME_(test_suite_name, test_name)); \ }; \ int GTEST_TEST_CLASS_NAME_(test_suite_name, \ test_name)::gtest_registering_dummy_ = \ GTEST_TEST_CLASS_NAME_(test_suite_name, test_name)::AddToRegistry(); \ void GTEST_TEST_CLASS_NAME_(test_suite_name, test_name)::TestBody() // Macros to provide template based testing. // Test can use FamilyType in the test -- equivalent to SKLFamily #define HWTEST_TEST_(test_suite_name, test_name, parent_class, parent_id, SetUpT_name, TearDownT_name) \ CHECK_TEST_NAME_LENGTH(test_suite_name, test_name) \ \ class GTEST_TEST_CLASS_NAME_(test_suite_name, test_name) : public parent_class { \ \ public: \ GTEST_TEST_CLASS_NAME_(test_suite_name, test_name) \ () {} \ \ private: \ template \ void testBodyHw(); \ template \ void emptyFcn() {} \ void SetUp() override { \ if (IS_TEST_EXCLUDED(test_suite_name, test_name)) { \ GTEST_SKIP(); \ } \ parent_class::SetUp(); \ FAMILY_SELECTOR(::renderCoreFamily, SetUpT_name); \ } \ void TearDown() override { \ if (!IS_TEST_EXCLUDED(test_suite_name, test_name)) { \ FAMILY_SELECTOR(::renderCoreFamily, TearDownT_name) \ parent_class::TearDown(); \ } \ } \ \ void TestBody() override { \ if (!IS_TEST_EXCLUDED(test_suite_name, test_name)) { \ FAMILY_SELECTOR(::renderCoreFamily, testBodyHw) \ } \ } \ static ::testing::TestInfo *const test_info_ GTEST_ATTRIBUTE_UNUSED_; \ GTEST_DISALLOW_COPY_AND_ASSIGN_( \ GTEST_TEST_CLASS_NAME_(test_suite_name, test_name)); \ }; \ \ ::testing::TestInfo *const GTEST_TEST_CLASS_NAME_(test_suite_name, test_name)::test_info_ = \ ::testing::internal::MakeAndRegisterTestInfo( \ #test_suite_name, #test_name, nullptr, nullptr, \ ::testing::internal::CodeLocation(__FILE__, __LINE__), (parent_id), \ ::testing::internal::SuiteApiResolver< \ parent_class>::GetSetUpCaseOrSuite(), \ ::testing::internal::SuiteApiResolver< \ parent_class>::GetTearDownCaseOrSuite(), \ new ::testing::internal::TestFactoryImpl); \ template \ void GTEST_TEST_CLASS_NAME_(test_suite_name, test_name)::testBodyHw() #define HWTEST_F(test_fixture, test_name) \ HWTEST_TEST_(test_fixture, test_name, test_fixture, \ ::testing::internal::GetTypeId(), emptyFcn, emptyFcn) // Macros to provide template based testing. // Test can use productFamily, gfxCoreFamily and FamilyType in the test #define HWTEST2_TEST_(test_suite_name, test_name, parent_class, parent_id, test_matcher) \ CHECK_TEST_NAME_LENGTH(test_suite_name, test_name) \ \ class GTEST_TEST_CLASS_NAME_(test_suite_name, test_name) : public parent_class { \ \ public: \ GTEST_TEST_CLASS_NAME_(test_suite_name, test_name) \ () {} \ \ private: \ using ContainerType = SupportedProductFamilies; \ using MatcherType = test_matcher; \ \ template \ void matchBody(); \ \ template \ void matched() { \ const GFXCORE_FAMILY gfxCoreFamily = \ static_cast(NEO::HwMapper::gfxFamily); \ using FamilyType = typename NEO::GfxFamilyMapper::GfxFamily; \ matchBody(); \ } \ \ struct MatcherFalse { \ template \ static void matched() {} \ }; \ \ template \ void checkForMatch(PRODUCT_FAMILY matchProduct); \ \ template \ bool checkMatch(PRODUCT_FAMILY matchProduct); \ \ void SetUp() override; \ void TearDown() override; \ void TestBody() override; \ \ static ::testing::TestInfo *const test_info_ GTEST_ATTRIBUTE_UNUSED_; \ GTEST_DISALLOW_COPY_AND_ASSIGN_(GTEST_TEST_CLASS_NAME_(test_suite_name, test_name)); \ }; \ \ ::testing::TestInfo *const GTEST_TEST_CLASS_NAME_(test_suite_name, test_name)::test_info_ = \ ::testing::internal::MakeAndRegisterTestInfo( \ #test_suite_name, #test_name, nullptr, nullptr, \ ::testing::internal::CodeLocation(__FILE__, __LINE__), (parent_id), \ ::testing::internal::SuiteApiResolver::GetSetUpCaseOrSuite(), \ ::testing::internal::SuiteApiResolver::GetTearDownCaseOrSuite(), \ new ::testing::internal::TestFactoryImpl); \ \ template \ void GTEST_TEST_CLASS_NAME_(test_suite_name, \ test_name)::checkForMatch(PRODUCT_FAMILY matchProduct) { \ const PRODUCT_FAMILY productFamily = At::productFamily; \ \ if (matchProduct == productFamily) { \ const bool isMatched = MatcherType::isMatched(); \ using Matcher = \ typename std::conditional::type; \ Matcher::template matched(); \ } else { \ checkForMatch(matchProduct); \ } \ } \ \ template <> \ void GTEST_TEST_CLASS_NAME_(test_suite_name, \ test_name)::checkForMatch<0u>(PRODUCT_FAMILY matchProduct) { \ const int matcherOrdinal = 0u; \ const PRODUCT_FAMILY productFamily = At::productFamily; \ \ if (matchProduct == productFamily) { \ const bool isMatched = MatcherType::isMatched(); \ using Matcher = \ typename std::conditional::type; \ Matcher::template matched(); \ } \ } \ template \ bool GTEST_TEST_CLASS_NAME_(test_suite_name, \ test_name)::checkMatch(PRODUCT_FAMILY matchProduct) { \ const PRODUCT_FAMILY productFamily = At::productFamily; \ \ if (matchProduct == productFamily) { \ const bool isMatched = MatcherType::isMatched(); \ return isMatched; \ } else { \ return checkMatch(matchProduct); \ } \ } \ \ template <> \ bool GTEST_TEST_CLASS_NAME_(test_suite_name, \ test_name)::checkMatch<0>(PRODUCT_FAMILY matchProduct) { \ const int matcherOrdinal = 0u; \ const PRODUCT_FAMILY productFamily = At::productFamily; \ \ if (matchProduct == productFamily) { \ const bool isMatched = MatcherType::isMatched(); \ return isMatched; \ } else { \ return false; \ } \ } \ \ void GTEST_TEST_CLASS_NAME_(test_suite_name, test_name)::SetUp() { \ if (IS_TEST_EXCLUDED(test_suite_name, test_name)) { \ GTEST_SKIP(); \ } \ if (checkMatch(::productFamily)) { \ parent_class::SetUp(); \ } \ } \ void GTEST_TEST_CLASS_NAME_(test_suite_name, test_name)::TearDown() { \ if (!IS_TEST_EXCLUDED(test_suite_name, test_name)) { \ if (checkMatch(::productFamily)) { \ parent_class::TearDown(); \ } \ } \ } \ void GTEST_TEST_CLASS_NAME_(test_suite_name, test_name)::TestBody() { \ if (!IS_TEST_EXCLUDED(test_suite_name, test_name)) { \ checkForMatch(::productFamily); \ } \ } \ \ template \ void GTEST_TEST_CLASS_NAME_(test_suite_name, test_name)::matchBody() #define HWTEST2_F(test_fixture, test_name, test_matcher) \ HWTEST2_TEST_(test_fixture, test_name##_##test_matcher, test_fixture, \ ::testing::internal::GetTypeId(), test_matcher) #define HWTEST_TEMPLATED_F(test_fixture, test_name) \ HWTEST_TEST_(test_fixture, test_name, test_fixture, \ ::testing::internal::GetTypeId(), SetUpT, TearDownT) // Macros to provide template based testing. // Test can use FamilyType in the test -- equivalent to SKLFamily #define HWCMDTEST_TEST_(cmdset_gen_base, test_suite_name, test_name, parent_class, parent_id) \ CHECK_TEST_NAME_LENGTH(test_suite_name, test_name) \ \ class GTEST_TEST_CLASS_NAME_(test_suite_name, test_name) : public parent_class { \ public: \ GTEST_TEST_CLASS_NAME_(test_suite_name, test_name) \ () {} \ \ private: \ template \ void testBodyHw(); \ \ template \ auto runCmdTestHwIfSupported() -> typename std::enable_if::type { \ if (!IS_TEST_EXCLUDED(test_suite_name, test_name)) { \ testBodyHw(); \ } \ } \ \ template \ auto runCmdTestHwIfSupported() -> typename std::enable_if::type { \ /* do nothing */ \ } \ \ void TestBody() override { \ FAMILY_SELECTOR(::renderCoreFamily, runCmdTestHwIfSupported) \ } \ void SetUp() override { \ if (IS_TEST_EXCLUDED(test_suite_name, test_name)) { \ GTEST_SKIP(); \ } \ CALL_IF_SUPPORTED(cmdset_gen_base, parent_class::SetUp()); \ } \ void TearDown() override { \ if (!IS_TEST_EXCLUDED(test_suite_name, test_name)) { \ CALL_IF_SUPPORTED(cmdset_gen_base, parent_class::TearDown()); \ } \ } \ static ::testing::TestInfo *const test_info_ GTEST_ATTRIBUTE_UNUSED_; \ GTEST_DISALLOW_COPY_AND_ASSIGN_( \ GTEST_TEST_CLASS_NAME_(test_suite_name, test_name)); \ }; \ \ ::testing::TestInfo *const GTEST_TEST_CLASS_NAME_(test_suite_name, test_name)::test_info_ = \ ::testing::internal::MakeAndRegisterTestInfo( \ #test_suite_name, #test_name, nullptr, nullptr, \ ::testing::internal::CodeLocation(__FILE__, __LINE__), (parent_id), \ ::testing::internal::SuiteApiResolver< \ parent_class>::GetSetUpCaseOrSuite(), \ ::testing::internal::SuiteApiResolver< \ parent_class>::GetTearDownCaseOrSuite(), \ new ::testing::internal::TestFactoryImpl); \ template \ void GTEST_TEST_CLASS_NAME_(test_suite_name, test_name)::testBodyHw() #define HWCMDTEST_F(cmdset_gen_base, test_fixture, test_name) \ HWCMDTEST_TEST_(cmdset_gen_base, test_fixture, test_name, test_fixture, \ ::testing::internal::GetTypeId()) #define CALL_IF_MATCH(match_core, match_product, expr) \ auto matchCore = match_core; \ auto matchProduct = match_product; \ if ((::renderCoreFamily == matchCore) && \ (IGFX_MAX_PRODUCT == matchProduct || ::productFamily == matchProduct)) { \ expr; \ } #define FAMILYTEST_TEST_(test_suite_name, test_name, parent_class, parent_id, match_core, match_product) \ CHECK_TEST_NAME_LENGTH(test_suite_name, test_name) \ \ class GTEST_TEST_CLASS_NAME_(test_suite_name, test_name) : public parent_class { \ public: \ GTEST_TEST_CLASS_NAME_(test_suite_name, test_name) \ () {} \ \ private: \ template \ void testBodyHw(); \ \ void TestBody() override { \ if (!IS_TEST_EXCLUDED(test_suite_name, test_name)) { \ CALL_IF_MATCH(match_core, match_product, \ testBodyHw::GfxFamily>()) \ } \ } \ void SetUp() override { \ if (IS_TEST_EXCLUDED(test_suite_name, test_name)) { \ GTEST_SKIP(); \ } \ CALL_IF_MATCH(match_core, match_product, parent_class::SetUp()) \ } \ void TearDown() override { \ if (!IS_TEST_EXCLUDED(test_suite_name, test_name)) { \ CALL_IF_MATCH(match_core, match_product, parent_class::TearDown()) \ } \ } \ static ::testing::TestInfo *const test_info_ GTEST_ATTRIBUTE_UNUSED_; \ GTEST_DISALLOW_COPY_AND_ASSIGN_( \ GTEST_TEST_CLASS_NAME_(test_suite_name, test_name)); \ }; \ \ ::testing::TestInfo *const GTEST_TEST_CLASS_NAME_(test_suite_name, test_name)::test_info_ = \ ::testing::internal::MakeAndRegisterTestInfo( \ #test_suite_name, #test_name, nullptr, nullptr, \ ::testing::internal::CodeLocation(__FILE__, __LINE__), (parent_id), \ ::testing::internal::SuiteApiResolver< \ parent_class>::GetSetUpCaseOrSuite(), \ ::testing::internal::SuiteApiResolver< \ parent_class>::GetTearDownCaseOrSuite(), \ new ::testing::internal::TestFactoryImpl); \ template \ void GTEST_TEST_CLASS_NAME_(test_suite_name, test_name)::testBodyHw() // Equivalent Hw specific macro for permuted tests // Test can use FamilyType in the test -- equivalent to SKLFamily #define HWTEST_P(test_suite_name, test_name) \ CHECK_TEST_NAME_LENGTH(test_suite_name, test_name) \ class GTEST_TEST_CLASS_NAME_(test_suite_name, test_name) : public test_suite_name { \ public: \ GTEST_TEST_CLASS_NAME_(test_suite_name, test_name) \ () {} \ template \ void testBodyHw(); \ \ void TestBody() override { \ FAMILY_SELECTOR(::renderCoreFamily, testBodyHw) \ } \ \ private: \ static int AddToRegistry() { \ ::testing::UnitTest::GetInstance()->parameterized_test_registry().GetTestCasePatternHolder( \ #test_suite_name, ::testing::internal::CodeLocation(__FILE__, __LINE__)) \ ->AddTestPattern( \ #test_suite_name, \ #test_name, \ new ::testing::internal::TestMetaFactory< \ GTEST_TEST_CLASS_NAME_(test_suite_name, test_name)>()); \ return 0; \ } \ static int gtest_registering_dummy_; \ GTEST_DISALLOW_COPY_AND_ASSIGN_( \ GTEST_TEST_CLASS_NAME_(test_suite_name, test_name)); \ }; \ int GTEST_TEST_CLASS_NAME_(test_suite_name, \ test_name)::gtest_registering_dummy_ = \ GTEST_TEST_CLASS_NAME_(test_suite_name, test_name)::AddToRegistry(); \ template \ void GTEST_TEST_CLASS_NAME_(test_suite_name, test_name)::testBodyHw() #define HWCMDTEST_P(cmdset_gen_base, test_suite_name, test_name) \ CHECK_TEST_NAME_LENGTH(test_suite_name, test_name) \ \ class GTEST_TEST_CLASS_NAME_(test_suite_name, test_name) : public test_suite_name { \ public: \ GTEST_TEST_CLASS_NAME_(test_suite_name, test_name) \ () {} \ \ template \ void testBodyHw(); \ \ template \ auto runCmdTestHwIfSupported() -> typename std::enable_if::type { \ testBodyHw(); \ } \ \ template \ auto runCmdTestHwIfSupported() -> typename std::enable_if::type { \ /* do nothing */ \ } \ \ void TestBody() override { \ if (!IS_TEST_EXCLUDED(test_suite_name, test_name)) { \ FAMILY_SELECTOR(::renderCoreFamily, runCmdTestHwIfSupported) \ } \ } \ void SetUp() override { \ if (IS_TEST_EXCLUDED(test_suite_name, test_name)) { \ GTEST_SKIP(); \ } \ CALL_IF_SUPPORTED(cmdset_gen_base, test_suite_name::SetUp()); \ } \ void TearDown() override { \ if (!IS_TEST_EXCLUDED(test_suite_name, test_name)) { \ CALL_IF_SUPPORTED(cmdset_gen_base, test_suite_name::TearDown()); \ } \ } \ \ private: \ static int AddToRegistry() { \ ::testing::UnitTest::GetInstance()->parameterized_test_registry().GetTestCasePatternHolder( \ #test_suite_name, ::testing::internal::CodeLocation(__FILE__, __LINE__)) \ ->AddTestPattern( \ #test_suite_name, \ #test_name, \ new ::testing::internal::TestMetaFactory< \ GTEST_TEST_CLASS_NAME_(test_suite_name, test_name)>()); \ return 0; \ } \ static int gtest_registering_dummy_; \ GTEST_DISALLOW_COPY_AND_ASSIGN_( \ GTEST_TEST_CLASS_NAME_(test_suite_name, test_name)); \ }; \ int GTEST_TEST_CLASS_NAME_(test_suite_name, \ test_name)::gtest_registering_dummy_ = \ GTEST_TEST_CLASS_NAME_(test_suite_name, test_name)::AddToRegistry(); \ template \ void GTEST_TEST_CLASS_NAME_(test_suite_name, test_name)::testBodyHw() // Macros to provide template based testing. // Test can use productFamily, gfxCoreFamily and FamilyType in the test #define HWTEST2_P(test_suite_name, test_name, test_matcher) \ class GTEST_TEST_CLASS_NAME_(test_suite_name, test_name) : public test_suite_name { \ \ public: \ GTEST_TEST_CLASS_NAME_(test_suite_name, test_name) \ () {} \ \ template \ void matchBody(); \ \ private: \ using ContainerType = SupportedProductFamilies; \ using MatcherType = test_matcher; \ \ template \ void matched() { \ const GFXCORE_FAMILY gfxCoreFamily = \ static_cast(NEO::HwMapper::gfxFamily); \ using FamilyType = typename NEO::GfxFamilyMapper::GfxFamily; \ matchBody(); \ } \ \ struct MatcherFalse { \ template \ static void matched() {} \ }; \ \ template \ void checkForMatch(PRODUCT_FAMILY matchProduct); \ \ template \ bool checkMatch(PRODUCT_FAMILY matchProduct); \ \ void SetUp() override; \ void TearDown() override; \ \ void TestBody() override; \ \ static int AddToRegistry() { \ ::testing::UnitTest::GetInstance() \ ->parameterized_test_registry() \ .GetTestCasePatternHolder(#test_suite_name, \ ::testing::internal::CodeLocation(__FILE__, __LINE__)) \ ->AddTestPattern(#test_suite_name, #test_name, \ new ::testing::internal::TestMetaFactory()); \ return 0; \ } \ static int gtest_registering_dummy_; \ GTEST_DISALLOW_COPY_AND_ASSIGN_(GTEST_TEST_CLASS_NAME_(test_suite_name, test_name)); \ }; \ \ template \ void GTEST_TEST_CLASS_NAME_(test_suite_name, \ test_name)::checkForMatch(PRODUCT_FAMILY matchProduct) { \ const PRODUCT_FAMILY productFamily = At::productFamily; \ \ if (matchProduct == productFamily) { \ const bool isMatched = MatcherType::isMatched(); \ using Matcher = \ typename std::conditional::type; \ Matcher::template matched(); \ } else { \ checkForMatch(matchProduct); \ } \ } \ \ template <> \ void GTEST_TEST_CLASS_NAME_(test_suite_name, \ test_name)::checkForMatch<0u>(PRODUCT_FAMILY matchProduct) { \ const int matcherOrdinal = 0u; \ const PRODUCT_FAMILY productFamily = At::productFamily; \ \ if (matchProduct == productFamily) { \ const bool isMatched = MatcherType::isMatched(); \ using Matcher = \ typename std::conditional::type; \ Matcher::template matched(); \ } \ } \ template \ bool GTEST_TEST_CLASS_NAME_(test_suite_name, \ test_name)::checkMatch(PRODUCT_FAMILY matchProduct) { \ const PRODUCT_FAMILY productFamily = At::productFamily; \ \ if (matchProduct == productFamily) { \ const bool isMatched = MatcherType::isMatched(); \ return isMatched; \ } else { \ return checkMatch(matchProduct); \ } \ } \ \ template <> \ bool GTEST_TEST_CLASS_NAME_(test_suite_name, \ test_name)::checkMatch<0>(PRODUCT_FAMILY matchProduct) { \ const int matcherOrdinal = 0u; \ const PRODUCT_FAMILY productFamily = At::productFamily; \ \ if (matchProduct == productFamily) { \ const bool isMatched = MatcherType::isMatched(); \ return isMatched; \ } else { \ return false; \ } \ } \ \ void GTEST_TEST_CLASS_NAME_(test_suite_name, test_name)::SetUp() { \ if (IS_TEST_EXCLUDED(test_suite_name, test_name)) { \ GTEST_SKIP(); \ } \ if (checkMatch(::productFamily)) { \ test_suite_name::SetUp(); \ } \ } \ void GTEST_TEST_CLASS_NAME_(test_suite_name, test_name)::TearDown() { \ if (!IS_TEST_EXCLUDED(test_suite_name, test_name)) { \ if (checkMatch(::productFamily)) { \ test_suite_name::TearDown(); \ } \ } \ } \ \ void GTEST_TEST_CLASS_NAME_(test_suite_name, test_name)::TestBody() { \ if (!IS_TEST_EXCLUDED(test_suite_name, test_name)) { \ checkForMatch(::productFamily); \ } \ } \ \ int GTEST_TEST_CLASS_NAME_(test_suite_name, test_name)::gtest_registering_dummy_ = \ GTEST_TEST_CLASS_NAME_(test_suite_name, test_name)::AddToRegistry(); \ template \ void GTEST_TEST_CLASS_NAME_(test_suite_name, test_name)::matchBody() #define FAMILYTEST_TEST_P(test_suite_name, test_name, match_core, match_product) \ CHECK_TEST_NAME_LENGTH(test_suite_name, test_name) \ class GTEST_TEST_CLASS_NAME_(test_suite_name, test_name) : public test_suite_name { \ public: \ GTEST_TEST_CLASS_NAME_(test_suite_name, test_name) \ () {} \ template \ void testBodyHw(); \ \ void TestBody() override { \ if (!IS_TEST_EXCLUDED(test_suite_name, test_name)) { \ CALL_IF_MATCH(match_core, match_product, \ testBodyHw::GfxFamily>()) \ } \ } \ void SetUp() override { \ if (IS_TEST_EXCLUDED(test_suite_name, test_name)) { \ GTEST_SKIP(); \ } \ CALL_IF_MATCH(match_core, match_product, test_suite_name::SetUp()) \ } \ void TearDown() override { \ if (!IS_TEST_EXCLUDED(test_suite_name, test_name)) { \ CALL_IF_MATCH(match_core, match_product, test_suite_name::TearDown()) \ } \ } \ \ private: \ static int AddToRegistry() { \ ::testing::UnitTest::GetInstance()->parameterized_test_registry().GetTestCasePatternHolder( \ #test_suite_name, ::testing::internal::CodeLocation(__FILE__, __LINE__)) \ ->AddTestPattern( \ #test_suite_name, \ #test_name, \ new ::testing::internal::TestMetaFactory< \ GTEST_TEST_CLASS_NAME_(test_suite_name, test_name)>()); \ return 0; \ } \ static int gtest_registering_dummy_; \ GTEST_DISALLOW_COPY_AND_ASSIGN_( \ GTEST_TEST_CLASS_NAME_(test_suite_name, test_name)); \ }; \ int GTEST_TEST_CLASS_NAME_(test_suite_name, \ test_name)::gtest_registering_dummy_ = \ GTEST_TEST_CLASS_NAME_(test_suite_name, test_name)::AddToRegistry(); \ template \ void GTEST_TEST_CLASS_NAME_(test_suite_name, test_name)::testBodyHw() #define GENTEST_F(gfx_core, test_fixture, test_name) \ FAMILYTEST_TEST_(test_fixture, test_name, test_fixture, \ ::testing::internal::GetTypeId(), \ gfx_core, IGFX_MAX_PRODUCT) #define GENTEST_P(gfx_core, test_suite_name, test_name) \ FAMILYTEST_TEST_P(test_suite_name, test_name, gfx_core, IGFX_MAX_PRODUCT) #include "per_product_test_definitions.h" #define HWTEST_TYPED_TEST(CaseName, TestName) \ CHECK_TEST_NAME_LENGTH(CaseName, TestName) \ template \ class GTEST_TEST_CLASS_NAME_(CaseName, TestName) : public CaseName { \ private: \ typedef CaseName TestFixture; \ typedef gtest_TypeParam_ TypeParam; \ template \ void testBodyHw(); \ \ void TestBody() override { \ FAMILY_SELECTOR(::renderCoreFamily, testBodyHw) \ } \ }; \ bool gtest_##CaseName##_##TestName##_registered_ GTEST_ATTRIBUTE_UNUSED_ = \ ::testing::internal::TypeParameterizedTest< \ CaseName, \ ::testing::internal::TemplateSel< \ GTEST_TEST_CLASS_NAME_(CaseName, TestName)>, \ GTEST_TYPE_PARAMS_(CaseName)>::Register("", ::testing::internal::CodeLocation(__FILE__, __LINE__), \ #CaseName, #TestName, 0); \ template \ template \ void GTEST_TEST_CLASS_NAME_(CaseName, TestName)::testBodyHw() template struct Test : public Fixture, public ::testing::Test { void SetUp() override { Fixture::SetUp(); } void TearDown() override { Fixture::TearDown(); } }; template struct SupportedProductFamilyContainer { using BaseClass = SupportedProductFamilyContainer; static const PRODUCT_FAMILY productFamily = IGFX_UNKNOWN; }; template struct SupportedProductFamilyContainer : SupportedProductFamilyContainer { using BaseClass = SupportedProductFamilyContainer; static const PRODUCT_FAMILY productFamily = p; static const std::size_t size = sizeof...(args) + 1; }; using SupportedProductFamilies = SupportedProductFamilyContainer; // Static container accessor template struct At { static const PRODUCT_FAMILY productFamily = At::productFamily; }; template struct At { static const PRODUCT_FAMILY productFamily = Container::productFamily; }; template struct IsGfxCore { template static constexpr bool isMatched() { return NEO::ToGfxCoreFamily::get() == gfxCoreFamily; } }; template struct IsNotGfxCore { template static constexpr bool isMatched() { return NEO::ToGfxCoreFamily::get() != gfxCoreFamily; } }; template struct AreNotGfxCores { template static constexpr bool isMatched() { return NEO::ToGfxCoreFamily::get() != gfxCoreFamily && NEO::ToGfxCoreFamily::get() != gfxCoreFamily2; } }; template struct IsAtMostGfxCore { template static constexpr bool isMatched() { return NEO::ToGfxCoreFamily::get() <= gfxCoreFamily; } }; template struct IsAtLeastGfxCore { template static constexpr bool isMatched() { return NEO::ToGfxCoreFamily::get() >= gfxCoreFamily; } }; template struct IsWithinGfxCore { template static constexpr bool isMatched() { return NEO::ToGfxCoreFamily::get() >= gfxCoreFamilyMin && NEO::ToGfxCoreFamily::get() <= gfxCoreFamilyMax; } }; template struct IsAnyGfxCores { template static constexpr bool isMatched() { return (... || IsGfxCore::template isMatched()); } }; template struct IsProduct { template static constexpr bool isMatched() { return productFamily == product; } }; template struct IsAtMostProduct { template static constexpr bool isMatched() { return productFamily <= productFamilyMax; } }; template struct IsAtLeastProduct { template static constexpr bool isMatched() { return productFamily >= productFamilyMin; } }; template struct IsWithinProducts { template static constexpr bool isMatched() { return productFamily >= productFamilyMin && productFamily <= productFamilyMax; } }; struct MatchAny { template static constexpr bool isMatched() { return true; } }; #include "common_matchers.h"