GoogleTest: Avoid extra call to set DISABLED test property in discovery

For very long test names, this can noticeably reduce the size of the
generated file contents when tests are disabled. This change reduces
how far beyond the flush threshold the content can grow before being
flushed.

Issue: #26431
This commit is contained in:
Craig Scott
2024-11-09 16:06:07 +11:00
committed by Brad King
parent 9a24c1e802
commit 007d7ea648

View File

@@ -214,16 +214,15 @@ function(gtest_discover_tests_impl)
endif()
string(APPEND script ")\n")
set(maybe_disabled "")
if(suite MATCHES "^DISABLED_" OR test MATCHES "^DISABLED_")
add_command(set_tests_properties
"${guarded_testname}"
PROPERTIES DISABLED TRUE
)
set(maybe_disabled DISABLED TRUE)
endif()
add_command(set_tests_properties
"${guarded_testname}"
PROPERTIES
${maybe_disabled}
WORKING_DIRECTORY "${arg_TEST_WORKING_DIR}"
SKIP_REGULAR_EXPRESSION "\\[ SKIPPED \\]"
${arg_TEST_PROPERTIES}