From 007d7ea648e862c8f4c61208f973c27ef2a89eb9 Mon Sep 17 00:00:00 2001 From: Craig Scott Date: Sat, 9 Nov 2024 16:06:07 +1100 Subject: [PATCH] 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 --- Modules/GoogleTestAddTests.cmake | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/Modules/GoogleTestAddTests.cmake b/Modules/GoogleTestAddTests.cmake index 1b6275d84a..afed307f49 100644 --- a/Modules/GoogleTestAddTests.cmake +++ b/Modules/GoogleTestAddTests.cmake @@ -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}