Report too long test name at compile time
Change-Id: Ifb2d74f37b4ab0f84f157e11849aaa350ee63811 Signed-off-by: Pawel Wilma <pawel.wilma@intel.com>
This commit is contained in:
parent
5c0c1f77f9
commit
bac5911c98
|
@ -138,6 +138,7 @@ target_include_directories(igdrcl_tests PRIVATE
|
|||
${IGDRCL_SOURCE_DIR}/unit_tests/mocks${BRANCH_DIR_SUFFIX}
|
||||
${ENGINE_NODE_DIR}
|
||||
${KHRONOS_GL_HEADERS_DIR}
|
||||
${CMAKE_CURRENT_SOURCE_DIR}
|
||||
)
|
||||
|
||||
target_link_libraries(igdrcl_tests gmock-gtest ${IGDRCL_EXTRA_LIBS})
|
||||
|
|
|
@ -44,8 +44,11 @@ if(WIN32)
|
|||
)
|
||||
endif()
|
||||
|
||||
target_include_directories(igdrcl_aub_tests PRIVATE ${CMAKE_CURRENT_SOURCE_DIR})
|
||||
|
||||
target_sources(igdrcl_aub_tests PRIVATE
|
||||
${IGDRCL_SOURCE_DIR}/runtime/gmm_helper/resource_info.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/test_mode.h
|
||||
)
|
||||
|
||||
if(WIN32)
|
||||
|
|
|
@ -5,12 +5,12 @@
|
|||
*
|
||||
*/
|
||||
|
||||
#include "unit_tests/tests_configuration.h"
|
||||
#include "test_mode.h"
|
||||
|
||||
namespace NEO {
|
||||
// max time per single test iteration
|
||||
unsigned int ultIterationMaxTime = 180;
|
||||
bool useMockGmm = false;
|
||||
const char *executionDirectorySuffix = "_aub";
|
||||
TestMode testMode = TestMode::AubTests;
|
||||
TestMode testMode = defaultTestMode;
|
||||
} // namespace NEO
|
||||
|
|
|
@ -0,0 +1,14 @@
|
|||
/*
|
||||
* Copyright (C) 2019 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "unit_tests/tests_configuration.h"
|
||||
|
||||
namespace NEO {
|
||||
constexpr TestMode defaultTestMode = TestMode::AubTests;
|
||||
} // namespace NEO
|
|
@ -11,6 +11,7 @@
|
|||
|
||||
#include "gtest/gtest.h"
|
||||
#include "igfxfmid.h"
|
||||
#include "test_mode.h"
|
||||
|
||||
#include <cstdint>
|
||||
#include <memory>
|
||||
|
@ -40,10 +41,63 @@ extern GFXCORE_FAMILY renderCoreFamily;
|
|||
#define CNL_TYPED_TEST_BODY
|
||||
#define CNL_TYPED_CMDTEST_BODY
|
||||
#endif
|
||||
#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)
|
||||
|
||||
#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<test_fixture>())
|
||||
|
||||
#ifdef TEST_P
|
||||
#undef TEST_P
|
||||
#endif
|
||||
|
||||
// Taken from gtest.h
|
||||
#define TEST_P(test_case_name, test_name) \
|
||||
CHECK_TEST_NAME_LENGTH(test_fixture, test_name) \
|
||||
class GTEST_TEST_CLASS_NAME_(test_case_name, test_name) \
|
||||
: public test_case_name { \
|
||||
public: \
|
||||
GTEST_TEST_CLASS_NAME_(test_case_name, test_name) \
|
||||
() {} \
|
||||
virtual void TestBody(); \
|
||||
\
|
||||
private: \
|
||||
static int AddToRegistry() { \
|
||||
::testing::UnitTest::GetInstance()->parameterized_test_registry().GetTestCasePatternHolder<test_case_name>( \
|
||||
#test_case_name, __FILE__, __LINE__) \
|
||||
->AddTestPattern( \
|
||||
#test_case_name, \
|
||||
#test_name, \
|
||||
new ::testing::internal::TestMetaFactory< \
|
||||
GTEST_TEST_CLASS_NAME_(test_case_name, test_name)>()); \
|
||||
return 0; \
|
||||
} \
|
||||
static int gtest_registering_dummy_; \
|
||||
GTEST_DISALLOW_COPY_AND_ASSIGN_( \
|
||||
GTEST_TEST_CLASS_NAME_(test_case_name, test_name)); \
|
||||
}; \
|
||||
int GTEST_TEST_CLASS_NAME_(test_case_name, \
|
||||
test_name)::gtest_registering_dummy_ = \
|
||||
GTEST_TEST_CLASS_NAME_(test_case_name, test_name)::AddToRegistry(); \
|
||||
void GTEST_TEST_CLASS_NAME_(test_case_name, test_name)::TestBody()
|
||||
|
||||
// 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) \
|
||||
CHECK_TEST_NAME_LENGTH(test_case_name, test_name) \
|
||||
class PLATFORM_EXCLUDES_CLASS_NAME(test_case_name, test_name) { \
|
||||
public: \
|
||||
static std::unique_ptr<std::unordered_set<uint32_t>> &getExcludes() { \
|
||||
|
@ -131,6 +185,7 @@ extern GFXCORE_FAMILY renderCoreFamily;
|
|||
// 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) \
|
||||
CHECK_TEST_NAME_LENGTH(test_case_name, test_name) \
|
||||
class PLATFORM_EXCLUDES_CLASS_NAME(test_case_name, test_name) { \
|
||||
public: \
|
||||
static std::unique_ptr<std::unordered_set<uint32_t>> &getExcludes() { \
|
||||
|
@ -219,6 +274,7 @@ extern GFXCORE_FAMILY renderCoreFamily;
|
|||
void GTEST_TEST_CLASS_NAME_(test_case_name, test_name)::testBodyHw()
|
||||
|
||||
#define HWCMDTEST_EXCLUDE_FAMILY(test_case_name, test_name, family) \
|
||||
CHECK_TEST_NAME_LENGTH(test_case_name, test_name) \
|
||||
class PLATFORM_EXCLUDES_CLASS_NAME(test_case_name, test_name) { \
|
||||
public: \
|
||||
static std::unique_ptr<std::unordered_set<uint32_t>> &getExcludes() { \
|
||||
|
@ -253,6 +309,7 @@ extern GFXCORE_FAMILY renderCoreFamily;
|
|||
}
|
||||
|
||||
#define FAMILYTEST_TEST_(test_case_name, test_name, parent_class, parent_id, match_core, match_product) \
|
||||
CHECK_TEST_NAME_LENGTH(test_case_name, test_name) \
|
||||
class GTEST_TEST_CLASS_NAME_(test_case_name, test_name) : public parent_class { \
|
||||
public: \
|
||||
GTEST_TEST_CLASS_NAME_(test_case_name, test_name) \
|
||||
|
@ -291,6 +348,7 @@ extern GFXCORE_FAMILY renderCoreFamily;
|
|||
// Equivalent Hw specific macro for permuted tests
|
||||
// Test can use FamilyType in the test -- equivalent to SKLFamily
|
||||
#define HWTEST_P(test_case_name, test_name) \
|
||||
CHECK_TEST_NAME_LENGTH(test_case_name, test_name) \
|
||||
class GTEST_TEST_CLASS_NAME_(test_case_name, test_name) : public test_case_name { \
|
||||
public: \
|
||||
GTEST_TEST_CLASS_NAME_(test_case_name, test_name) \
|
||||
|
@ -337,6 +395,7 @@ extern GFXCORE_FAMILY renderCoreFamily;
|
|||
void GTEST_TEST_CLASS_NAME_(test_case_name, test_name)::testBodyHw()
|
||||
|
||||
#define HWCMDTEST_P(cmdset_gen_base, test_case_name, test_name) \
|
||||
CHECK_TEST_NAME_LENGTH(test_case_name, test_name) \
|
||||
class GTEST_TEST_CLASS_NAME_(test_case_name, test_name) : public test_case_name { \
|
||||
public: \
|
||||
GTEST_TEST_CLASS_NAME_(test_case_name, test_name) \
|
||||
|
@ -393,6 +452,7 @@ extern GFXCORE_FAMILY renderCoreFamily;
|
|||
void GTEST_TEST_CLASS_NAME_(test_case_name, test_name)::testBodyHw()
|
||||
|
||||
#define FAMILYTEST_TEST_P(test_case_name, test_name, match_core, match_product) \
|
||||
CHECK_TEST_NAME_LENGTH(test_case_name, test_name) \
|
||||
class GTEST_TEST_CLASS_NAME_(test_case_name, test_name) : public test_case_name { \
|
||||
public: \
|
||||
GTEST_TEST_CLASS_NAME_(test_case_name, test_name) \
|
||||
|
@ -533,6 +593,7 @@ extern GFXCORE_FAMILY renderCoreFamily;
|
|||
IGFX_CANNONLAKE)
|
||||
#endif
|
||||
#define HWTEST_TYPED_TEST(CaseName, TestName) \
|
||||
CHECK_TEST_NAME_LENGTH(CaseName, TestName) \
|
||||
template <typename gtest_TypeParam_> \
|
||||
class GTEST_TEST_CLASS_NAME_(CaseName, TestName) : public CaseName<gtest_TypeParam_> { \
|
||||
private: \
|
||||
|
|
|
@ -12,6 +12,7 @@ set(IGDRCL_SRCS_linux_tests
|
|||
${IGDRCL_SOURCE_DIR}/unit_tests/os_interface/linux/allocator_helper.cpp
|
||||
${IGDRCL_SOURCE_DIR}/unit_tests/os_interface/linux/create_drm_memory_manager.cpp
|
||||
${IGDRCL_SOURCE_DIR}/unit_tests/os_interface/linux/options.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/test_mode.h
|
||||
)
|
||||
|
||||
set(IGDRCL_SRCS_linux_dll_tests
|
||||
|
@ -28,6 +29,7 @@ set(IGDRCL_SRCS_linux_dll_tests
|
|||
${IGDRCL_SOURCE_DIR}/unit_tests/aub_stream_mocks/aub_stream_interface_mock.cpp
|
||||
${IGDRCL_SOURCE_DIR}/unit_tests/libult/os_interface.cpp
|
||||
${IGDRCL_SOURCE_DIR}/unit_tests/os_interface/linux/create_drm_memory_manager.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/test_mode.h
|
||||
)
|
||||
|
||||
if(IGDRCL__LIBVA_FOUND)
|
||||
|
@ -54,6 +56,7 @@ foreach(target_name linux_tests linux_dll_tests)
|
|||
target_include_directories(igdrcl_${target_name} PRIVATE
|
||||
${IGDRCL_SOURCE_DIR}/unit_tests/gen_common${BRANCH_DIR_SUFFIX}
|
||||
${IGDRCL_SOURCE_DIR}/runtime/dll/linux/devices${BRANCH_DIR_SUFFIX}
|
||||
${CMAKE_CURRENT_SOURCE_DIR}
|
||||
)
|
||||
add_dependencies(unit_tests igdrcl_${target_name})
|
||||
endforeach()
|
||||
|
|
|
@ -5,8 +5,8 @@
|
|||
*
|
||||
*/
|
||||
|
||||
#include "unit_tests/tests_configuration.h"
|
||||
#include "test_mode.h"
|
||||
|
||||
namespace NEO {
|
||||
TestMode testMode = TestMode::NotSpecified;
|
||||
TestMode testMode = defaultTestMode;
|
||||
} // namespace NEO
|
||||
|
|
|
@ -0,0 +1,14 @@
|
|||
/*
|
||||
* Copyright (C) 2019 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "unit_tests/tests_configuration.h"
|
||||
|
||||
namespace NEO {
|
||||
constexpr TestMode defaultTestMode = TestMode::NotSpecified;
|
||||
} // namespace NEO
|
|
@ -11,12 +11,15 @@ add_executable(igdrcl_mt_tests EXCLUDE_FROM_ALL
|
|||
${IGDRCL_SOURCE_DIR}/unit_tests/libult/os_interface.cpp
|
||||
${IGDRCL_SOURCE_DIR}/unit_tests/ult_configuration.cpp
|
||||
${IGDRCL_SOURCE_DIR}/runtime/aub/aub_stream_interface.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/test_mode.h
|
||||
$<TARGET_OBJECTS:igdrcl_libult>
|
||||
$<TARGET_OBJECTS:igdrcl_libult_cs>
|
||||
$<TARGET_OBJECTS:igdrcl_libult_env>
|
||||
$<TARGET_OBJECTS:${BUILTINS_SOURCES_LIB_NAME}>
|
||||
)
|
||||
|
||||
target_include_directories(igdrcl_mt_tests PRIVATE ${CMAKE_CURRENT_SOURCE_DIR})
|
||||
|
||||
add_subdirectories()
|
||||
|
||||
#these tests fail because of data race, set '*' after fix problem
|
||||
|
|
|
@ -0,0 +1,14 @@
|
|||
/*
|
||||
* Copyright (C) 2019 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "unit_tests/tests_configuration.h"
|
||||
|
||||
namespace NEO {
|
||||
constexpr TestMode defaultTestMode = TestMode::UnitTests;
|
||||
} // namespace NEO
|
|
@ -21,6 +21,7 @@ if(WIN32)
|
|||
target_include_directories(igdrcl_tbx_tests PRIVATE
|
||||
${IGDRCL_SOURCE_DIR}/unit_tests/mocks${BRANCH_DIR_SUFFIX}
|
||||
)
|
||||
target_include_directories(igdrcl_tbx_tests PRIVATE ${CMAKE_CURRENT_SOURCE_DIR})
|
||||
target_sources(igdrcl_tbx_tests PRIVATE
|
||||
${IGDRCL_SOURCE_DIR}/runtime/dll/windows/options.cpp
|
||||
${IGDRCL_SOURCE_DIR}/unit_tests/os_interface/windows/create_wddm_memory_manager.cpp
|
||||
|
@ -28,6 +29,7 @@ if(WIN32)
|
|||
${IGDRCL_SOURCE_DIR}/unit_tests/os_interface/windows/wddm_calls.cpp
|
||||
${IGDRCL_SOURCE_DIR}/unit_tests/os_interface/windows/wddm_create.cpp
|
||||
${IGDRCL_SOURCE_DIR}/unit_tests/os_interface/windows/ult_dxgi_factory.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/test_mode.h
|
||||
)
|
||||
else()
|
||||
target_sources(igdrcl_tbx_tests PRIVATE
|
||||
|
|
|
@ -5,8 +5,8 @@
|
|||
*
|
||||
*/
|
||||
|
||||
#include "unit_tests/tests_configuration.h"
|
||||
#include "test_mode.h"
|
||||
|
||||
namespace NEO {
|
||||
TestMode testMode = TestMode::TbxTests;
|
||||
TestMode testMode = defaultTestMode;
|
||||
} // namespace NEO
|
||||
|
|
|
@ -0,0 +1,14 @@
|
|||
/*
|
||||
* Copyright (C) 2019 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "unit_tests/tests_configuration.h"
|
||||
|
||||
namespace NEO {
|
||||
constexpr TestMode defaultTestMode = TestMode::TbxTests;
|
||||
} // namespace NEO
|
|
@ -0,0 +1,14 @@
|
|||
/*
|
||||
* Copyright (C) 2019 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "unit_tests/tests_configuration.h"
|
||||
|
||||
namespace NEO {
|
||||
constexpr TestMode defaultTestMode = TestMode::UnitTests;
|
||||
} // namespace NEO
|
|
@ -5,11 +5,11 @@
|
|||
*
|
||||
*/
|
||||
|
||||
#include "unit_tests/tests_configuration.h"
|
||||
#include "test_mode.h"
|
||||
|
||||
namespace NEO {
|
||||
unsigned int ultIterationMaxTime = 45;
|
||||
bool useMockGmm = true;
|
||||
const char *executionDirectorySuffix = "";
|
||||
TestMode testMode = TestMode::UnitTests;
|
||||
TestMode testMode = defaultTestMode;
|
||||
} // namespace NEO
|
||||
|
|
|
@ -23,12 +23,14 @@ add_executable(igdrcl_windows_dll_tests
|
|||
${CMAKE_CURRENT_SOURCE_DIR}${BRANCH_DIR_SUFFIX}/get_devices_tests.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/os_interface_tests.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/wddm_create_tests.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/test_mode.h
|
||||
)
|
||||
|
||||
target_link_libraries(igdrcl_windows_dll_tests ${NEO_MOCKABLE_LIB_NAME} igdrcl_mocks gmock-gtest ${IGDRCL_EXTRA_LIBS})
|
||||
|
||||
target_include_directories(igdrcl_windows_dll_tests PRIVATE
|
||||
${IGDRCL_SOURCE_DIR}/unit_tests/gen_common${BRANCH_DIR_SUFFIX}
|
||||
${CMAKE_CURRENT_SOURCE_DIR}
|
||||
)
|
||||
|
||||
create_project_source_tree(igdrcl_windows_dll_tests ${IGDRCL_SOURCE_DIR}/runtime ${IGDRCL_SOURCE_DIR}/unit_tests)
|
||||
|
|
|
@ -0,0 +1,14 @@
|
|||
/*
|
||||
* Copyright (C) 2019 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "unit_tests/tests_configuration.h"
|
||||
|
||||
namespace NEO {
|
||||
constexpr TestMode defaultTestMode = TestMode::UnitTests;
|
||||
} // namespace NEO
|
Loading…
Reference in New Issue