Revert commit a324c2bb58 (GoogleTest: Base on builtin command
discover_tests, 2026-03-01, v4.4.0-rc1~30^2). The `discover_tests`
implementation does not persist already-discovered tests across ctest
runs, making it much slower on projects whose test binaries take a while
just to start up and list tests. Revert to the prior implementation
pending caching support in `discover_tests`.
Fixes: #28053
Issue: #28060
It is possible to have trailing ( and maybe leading ) newlines in a test name. This causes problems with ctest
features like `tests-from-file` since they will never
be an exact match.
So now we sanitize names by removing these newlines
Google Test returns parameter values for parametrized tests in two ways:
* As part of the test name - if a name_generator has been provided in
the test this will be the generated string, otherwise gtest will just
number all tests
* In a separate field of the json (or the text output) - this seems to
be a byte representation of the input data if the input data cannot be
converted to a string.
If the cmake parameter `NO_PRETTY_VALUES` to `gtest_discover_tests` has
not been set, the auto-generated test index - i.e. if no `name_generator
has been specified - is supposed to be replaced by the value parameter
from category 2 above. However, since commit 1cdceae8e3 (GoogleTest:
Parse discovered test list from JSON output if supported, 2025-05-02,
v4.2.0-rc1~533^2~2), the logic has been broken, in that the test suffix
is always replaced even though a name_generator has been configured.
Fix this by checking if the last part of the test name is an integer and
only then replace it.
Fixes: #27846