From dff56b0b978d68ef0923f00cd2e41db239ba32a7 Mon Sep 17 00:00:00 2001 From: Brad King Date: Thu, 3 Dec 2020 09:30:44 -0500 Subject: GoogleTest: Match the full 'DISABLED_' prefix to disable tests Test names that start in `DISABLED` not followed by an underscore are not disabled. Fixes: #21543 --- Modules/GoogleTestAddTests.cmake | 2 +- .../GoogleTest/GoogleTest-test1-stdout.txt | 46 +++++++++--------- .../GoogleTest/GoogleTest-test2-stdout.txt | 54 ++++++++++++---------- Tests/RunCMake/GoogleTest/fake_gtest.cpp | 3 ++ 4 files changed, 58 insertions(+), 47 deletions(-) diff --git a/Modules/GoogleTestAddTests.cmake b/Modules/GoogleTestAddTests.cmake index 883e1f4..0f79c9a 100644 --- a/Modules/GoogleTestAddTests.cmake +++ b/Modules/GoogleTestAddTests.cmake @@ -136,7 +136,7 @@ function(gtest_discover_tests_impl) ${TEST_XML_OUTPUT_PARAM} ${extra_args} ) - if(suite MATCHES "^DISABLED" OR test MATCHES "^DISABLED") + if(suite MATCHES "^DISABLED_" OR test MATCHES "^DISABLED_") add_command(set_tests_properties "${testname}" PROPERTIES DISABLED TRUE diff --git a/Tests/RunCMake/GoogleTest/GoogleTest-test1-stdout.txt b/Tests/RunCMake/GoogleTest/GoogleTest-test1-stdout.txt index 7fb3919..2a53c5b 100644 --- a/Tests/RunCMake/GoogleTest/GoogleTest-test1-stdout.txt +++ b/Tests/RunCMake/GoogleTest/GoogleTest-test1-stdout.txt @@ -1,31 +1,35 @@ Test project .* Start 1: TEST:basic\.case_foo!1 - 1/11 Test #1: TEST:basic\.case_foo!1 \.+ +Passed +[0-9.]+ sec + 1/13 Test #1: TEST:basic\.case_foo!1 \.+ +Passed +[0-9.]+ sec Start 2: TEST:basic\.case_bar!1 - 2/11 Test #2: TEST:basic\.case_bar!1 \.+ +Passed +[0-9.]+ sec + 2/13 Test #2: TEST:basic\.case_bar!1 \.+ +Passed +[0-9.]+ sec Start 3: TEST:basic\.disabled_case!1 - 3/11 Test #3: TEST:basic\.disabled_case!1 \.+\*+Not Run \(Disabled\) +[0-9.]+ sec - Start 4: TEST:disabled\.case!1 - 4/11 Test #4: TEST:disabled\.case!1 \.+\*+Not Run \(Disabled\) +[0-9.]+ sec - Start 5: TEST:typed/short\.case!1 - 5/11 Test #5: TEST:typed/short\.case!1 \.+ +Passed +[0-9.]+ sec - Start 6: TEST:typed/float\.case!1 - 6/11 Test #6: TEST:typed/float\.case!1 \.+ +Passed +[0-9.]+ sec - Start 7: TEST:value/test\.case/1!1 - 7/11 Test #7: TEST:value/test\.case/1!1 \.+ +Passed +[0-9.]+ sec - Start 8: TEST:value/test\.case/"foo"!1 - 8/11 Test #8: TEST:value/test\.case/"foo"!1 \.+ +Passed +[0-9.]+ sec - Start 9: TEST:param/special\.case/"semicolon;"!1 - 9/11 Test #9: TEST:param/special\.case/"semicolon;"!1 \.+ +Passed +[0-9.]+ sec - Start 10: TEST:param/special\.case/"backslash\\"!1 -10/11 Test #10: TEST:param/special\.case/"backslash\\"!1 \.+ +Passed +[0-9.]+ sec - Start 11: TEST:param/special\.case/"\$\{var\}"!1 -11/11 Test #11: TEST:param/special\.case/"\$\{var\}"!1 \.+ +Passed +[0-9.]+ sec + 3/13 Test #3: TEST:basic\.disabled_case!1 \.+\*+Not Run \(Disabled\) +[0-9.]+ sec + Start 4: TEST:basic\.DISABLEDnot_really_case!1 + 4/13 Test #4: TEST:basic\.DISABLEDnot_really_case!1 \.+ +Passed +[0-9.]+ sec + Start 5: TEST:disabled\.case!1 + 5/13 Test #5: TEST:disabled\.case!1 \.+\*+Not Run \(Disabled\) +[0-9.]+ sec + Start 6: TEST:DISABLEDnotreally\.case!1 + 6/13 Test #6: TEST:DISABLEDnotreally\.case!1 \.+ +Passed +[0-9.]+ sec + Start 7: TEST:typed/short\.case!1 + 7/13 Test #7: TEST:typed/short\.case!1 \.+ +Passed +[0-9.]+ sec + Start 8: TEST:typed/float\.case!1 + 8/13 Test #8: TEST:typed/float\.case!1 \.+ +Passed +[0-9.]+ sec + Start 9: TEST:value/test\.case/1!1 + 9/13 Test #9: TEST:value/test\.case/1!1 \.+ +Passed +[0-9.]+ sec + Start 10: TEST:value/test\.case/"foo"!1 +10/13 Test #10: TEST:value/test\.case/"foo"!1 \.+ +Passed +[0-9.]+ sec + Start 11: TEST:param/special\.case/"semicolon;"!1 +11/13 Test #11: TEST:param/special\.case/"semicolon;"!1 \.+ +Passed +[0-9.]+ sec + Start 12: TEST:param/special\.case/"backslash\\"!1 +12/13 Test #12: TEST:param/special\.case/"backslash\\"!1 \.+ +Passed +[0-9.]+ sec + Start 13: TEST:param/special\.case/"\$\{var\}"!1 +13/13 Test #13: TEST:param/special\.case/"\$\{var\}"!1 \.+ +Passed +[0-9.]+ sec -100% tests passed, 0 tests failed out of 9 +100% tests passed, 0 tests failed out of 11 Total Test time \(real\) = +[0-9.]+ sec The following tests did not run: .*3 - TEST:basic\.disabled_case!1 \(Disabled\) -.*4 - TEST:disabled\.case!1 \(Disabled\) +.*5 - TEST:disabled\.case!1 \(Disabled\) diff --git a/Tests/RunCMake/GoogleTest/GoogleTest-test2-stdout.txt b/Tests/RunCMake/GoogleTest/GoogleTest-test2-stdout.txt index 58c4d10..5b68e10 100644 --- a/Tests/RunCMake/GoogleTest/GoogleTest-test2-stdout.txt +++ b/Tests/RunCMake/GoogleTest/GoogleTest-test2-stdout.txt @@ -1,31 +1,35 @@ Test project .* - Start 12: TEST:basic\.case_foo!2 - 1/11 Test #12: TEST:basic\.case_foo!2 \.+ +Passed +[0-9.]+ sec - Start 13: TEST:basic\.case_bar!2 - 2/11 Test #13: TEST:basic\.case_bar!2 \.+ +Passed +[0-9.]+ sec - Start 14: TEST:basic\.disabled_case!2 - 3/11 Test #14: TEST:basic\.disabled_case!2 \.+\*+Not Run \(Disabled\) +[0-9.]+ sec - Start 15: TEST:disabled\.case!2 - 4/11 Test #15: TEST:disabled\.case!2 \.+\*+Not Run \(Disabled\) +[0-9.]+ sec - Start 16: TEST:typed/short\.case!2 - 5/11 Test #16: TEST:typed/short\.case!2 \.+ +Passed +[0-9.]+ sec - Start 17: TEST:typed/float\.case!2 - 6/11 Test #17: TEST:typed/float\.case!2 \.+ +Passed +[0-9.]+ sec - Start 18: TEST:value/test\.case/1!2 - 7/11 Test #18: TEST:value/test\.case/1!2 \.+ +Passed +[0-9.]+ sec - Start 19: TEST:value/test\.case/"foo"!2 - 8/11 Test #19: TEST:value/test\.case/"foo"!2 \.+ +Passed +[0-9.]+ sec - Start 20: TEST:param/special\.case/"semicolon;"!2 - 9/11 Test #20: TEST:param/special\.case/"semicolon;"!2 \.+ +Passed +[0-9.]+ sec - Start 21: TEST:param/special\.case/"backslash\\"!2 -10/11 Test #21: TEST:param/special\.case/"backslash\\"!2 \.+ +Passed +[0-9.]+ sec - Start 22: TEST:param/special\.case/"\$\{var\}"!2 -11/11 Test #22: TEST:param/special\.case/"\$\{var\}"!2 \.+ +Passed +[0-9.]+ sec + Start 14: TEST:basic\.case_foo!2 + 1/13 Test #14: TEST:basic\.case_foo!2 \.+ +Passed +[0-9.]+ sec + Start 15: TEST:basic\.case_bar!2 + 2/13 Test #15: TEST:basic\.case_bar!2 \.+ +Passed +[0-9.]+ sec + Start 16: TEST:basic\.disabled_case!2 + 3/13 Test #16: TEST:basic\.disabled_case!2 \.+\*+Not Run \(Disabled\) +[0-9.]+ sec + Start 17: TEST:basic\.DISABLEDnot_really_case!2 + 4/13 Test #17: TEST:basic\.DISABLEDnot_really_case!2 \.+ +Passed +[0-9.]+ sec + Start 18: TEST:disabled\.case!2 + 5/13 Test #18: TEST:disabled\.case!2 \.+\*+Not Run \(Disabled\) +[0-9.]+ sec + Start 19: TEST:DISABLEDnotreally\.case!2 + 6/13 Test #19: TEST:DISABLEDnotreally\.case!2 \.+ +Passed +[0-9.]+ sec + Start 20: TEST:typed/short\.case!2 + 7/13 Test #20: TEST:typed/short\.case!2 \.+ +Passed +[0-9.]+ sec + Start 21: TEST:typed/float\.case!2 + 8/13 Test #21: TEST:typed/float\.case!2 \.+ +Passed +[0-9.]+ sec + Start 22: TEST:value/test\.case/1!2 + 9/13 Test #22: TEST:value/test\.case/1!2 \.+ +Passed +[0-9.]+ sec + Start 23: TEST:value/test\.case/"foo"!2 +10/13 Test #23: TEST:value/test\.case/"foo"!2 \.+ +Passed +[0-9.]+ sec + Start 24: TEST:param/special\.case/"semicolon;"!2 +11/13 Test #24: TEST:param/special\.case/"semicolon;"!2 \.+ +Passed +[0-9.]+ sec + Start 25: TEST:param/special\.case/"backslash\\"!2 +12/13 Test #25: TEST:param/special\.case/"backslash\\"!2 \.+ +Passed +[0-9.]+ sec + Start 26: TEST:param/special\.case/"\$\{var\}"!2 +13/13 Test #26: TEST:param/special\.case/"\$\{var\}"!2 \.+ +Passed +[0-9.]+ sec -100% tests passed, 0 tests failed out of 9 +100% tests passed, 0 tests failed out of 11 Total Test time \(real\) = +[0-9.]+ sec The following tests did not run: -.*14 - TEST:basic\.disabled_case!2 \(Disabled\) -.*15 - TEST:disabled\.case!2 \(Disabled\) +.*16 - TEST:basic\.disabled_case!2 \(Disabled\) +.*18 - TEST:disabled\.case!2 \(Disabled\) diff --git a/Tests/RunCMake/GoogleTest/fake_gtest.cpp b/Tests/RunCMake/GoogleTest/fake_gtest.cpp index a8127bf..1956c37 100644 --- a/Tests/RunCMake/GoogleTest/fake_gtest.cpp +++ b/Tests/RunCMake/GoogleTest/fake_gtest.cpp @@ -12,8 +12,11 @@ int main(int argc, char** argv) std::cout << " case_foo" << std::endl; std::cout << " case_bar" << std::endl; std::cout << " DISABLED_disabled_case" << std::endl; + std::cout << " DISABLEDnot_really_case" << std::endl; std::cout << "DISABLED_disabled." << std::endl; std::cout << " case" << std::endl; + std::cout << "DISABLEDnotreally." << std::endl; + std::cout << " case" << std::endl; std::cout << "typed/0. # TypeParam = short" << std::endl; std::cout << " case" << std::endl; std::cout << "typed/1. # TypeParam = float" << std::endl; -- cgit v0.12