mirror of
https://gitlab.com/libeigen/eigen.git
synced 2025-08-10 02:39:03 +08:00
Fix usage of EIGEN_SPLIT_LARGE_TESTS=ON: some unit tests, such as indexed_view have to be split unconditionally.
This commit is contained in:
parent
f2b52f9946
commit
901c7d31f0
@ -108,7 +108,7 @@ macro(ei_add_test_internal testname testname_with_suffix)
|
|||||||
|
|
||||||
add_test(${testname_with_suffix} "${targetname}")
|
add_test(${testname_with_suffix} "${targetname}")
|
||||||
|
|
||||||
# Specify target and test labels accoirding to EIGEN_CURRENT_SUBPROJECT
|
# Specify target and test labels according to EIGEN_CURRENT_SUBPROJECT
|
||||||
get_property(current_subproject GLOBAL PROPERTY EIGEN_CURRENT_SUBPROJECT)
|
get_property(current_subproject GLOBAL PROPERTY EIGEN_CURRENT_SUBPROJECT)
|
||||||
if ((current_subproject) AND (NOT (current_subproject STREQUAL "")))
|
if ((current_subproject) AND (NOT (current_subproject STREQUAL "")))
|
||||||
set_property(TARGET ${targetname} PROPERTY LABELS "Build${current_subproject}")
|
set_property(TARGET ${targetname} PROPERTY LABELS "Build${current_subproject}")
|
||||||
@ -276,12 +276,19 @@ macro(ei_add_test testname)
|
|||||||
endif()
|
endif()
|
||||||
|
|
||||||
file(READ "${filename}" test_source)
|
file(READ "${filename}" test_source)
|
||||||
set(parts 0)
|
|
||||||
string(REGEX MATCHALL "CALL_SUBTEST_[0-9]+|EIGEN_TEST_PART_[0-9]+|EIGEN_SUFFIXES(;[0-9]+)+"
|
string(REGEX MATCHALL "CALL_SUBTEST_[0-9]+|EIGEN_TEST_PART_[0-9]+|EIGEN_SUFFIXES(;[0-9]+)+"
|
||||||
occurrences "${test_source}")
|
occurrences "${test_source}")
|
||||||
string(REGEX REPLACE "CALL_SUBTEST_|EIGEN_TEST_PART_|EIGEN_SUFFIXES" "" suffixes "${occurrences}")
|
string(REGEX REPLACE "CALL_SUBTEST_|EIGEN_TEST_PART_|EIGEN_SUFFIXES" "" suffixes "${occurrences}")
|
||||||
list(REMOVE_DUPLICATES suffixes)
|
list(REMOVE_DUPLICATES suffixes)
|
||||||
if(EIGEN_SPLIT_LARGE_TESTS AND suffixes)
|
set(explicit_suffixes "")
|
||||||
|
if( (NOT EIGEN_SPLIT_LARGE_TESTS) AND suffixes)
|
||||||
|
# Check whether we have EIGEN_TEST_PART_* statements, in which case we likely must enforce splitting.
|
||||||
|
# For instance, indexed_view activate a different c++ version for each part.
|
||||||
|
string(REGEX MATCHALL "EIGEN_TEST_PART_[0-9]+" occurrences "${test_source}")
|
||||||
|
string(REGEX REPLACE "EIGEN_TEST_PART_" "" explicit_suffixes "${occurrences}")
|
||||||
|
list(REMOVE_DUPLICATES explicit_suffixes)
|
||||||
|
endif()
|
||||||
|
if( (EIGEN_SPLIT_LARGE_TESTS AND suffixes) OR explicit_suffixes)
|
||||||
add_custom_target(${testname})
|
add_custom_target(${testname})
|
||||||
foreach(suffix ${suffixes})
|
foreach(suffix ${suffixes})
|
||||||
ei_add_test_internal(${testname} ${testname}_${suffix}
|
ei_add_test_internal(${testname} ${testname}_${suffix}
|
||||||
|
@ -4,7 +4,7 @@ if(NOT EXISTS ${CMAKE_CURRENT_BINARY_DIR}/split_test_helper.h)
|
|||||||
file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/split_test_helper.h "")
|
file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/split_test_helper.h "")
|
||||||
foreach(i RANGE 1 999)
|
foreach(i RANGE 1 999)
|
||||||
file(APPEND ${CMAKE_CURRENT_BINARY_DIR}/split_test_helper.h
|
file(APPEND ${CMAKE_CURRENT_BINARY_DIR}/split_test_helper.h
|
||||||
"#ifdef EIGEN_TEST_PART_${i}\n"
|
"#if defined(EIGEN_TEST_PART_${i}) || defined(EIGEN_TEST_PART_ALL)\n"
|
||||||
"#define CALL_SUBTEST_${i}(FUNC) CALL_SUBTEST(FUNC)\n"
|
"#define CALL_SUBTEST_${i}(FUNC) CALL_SUBTEST(FUNC)\n"
|
||||||
"#else\n"
|
"#else\n"
|
||||||
"#define CALL_SUBTEST_${i}(FUNC)\n"
|
"#define CALL_SUBTEST_${i}(FUNC)\n"
|
||||||
|
@ -4,7 +4,7 @@ if(NOT EXISTS ${CMAKE_CURRENT_BINARY_DIR}/split_test_helper.h)
|
|||||||
file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/split_test_helper.h "")
|
file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/split_test_helper.h "")
|
||||||
foreach(i RANGE 1 999)
|
foreach(i RANGE 1 999)
|
||||||
file(APPEND ${CMAKE_CURRENT_BINARY_DIR}/split_test_helper.h
|
file(APPEND ${CMAKE_CURRENT_BINARY_DIR}/split_test_helper.h
|
||||||
"#ifdef EIGEN_TEST_PART_${i}\n"
|
"#if defined(EIGEN_TEST_PART_${i}) || defined(EIGEN_TEST_PART_ALL)\n"
|
||||||
"#define CALL_SUBTEST_${i}(FUNC) CALL_SUBTEST(FUNC)\n"
|
"#define CALL_SUBTEST_${i}(FUNC) CALL_SUBTEST(FUNC)\n"
|
||||||
"#else\n"
|
"#else\n"
|
||||||
"#define CALL_SUBTEST_${i}(FUNC)\n"
|
"#define CALL_SUBTEST_${i}(FUNC)\n"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user