Fix catch_discover_tests() from breaking on long test names #1658
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes #1645 by rolling back d4eec01 ; reopens #1590 .
Parsing
--list-tests
is broken, as Catch automatically line wraps the line when it gets too long, stripping any whitespace in the process. This means that it's impossible to reproduce the exact name of thetest if the test's name is long enough to line-wrap.
Furthermore, overwriting the
LABELS
property with the discovered labels breaks users who manually added custom ctest labels. However, this seems to not actually overwrite the labels due to buggy handling of our strange test names by CMake.Rolling back to using
--list-test-names-only
for now, as it does not wrap lines even on very long test names.We may be able parse the output of
--list-tags
to produce the ctest labels. However, the straightforward way of doing this is to use CMake'sget_property(TEST ...)
andset_property(TEST ... APPEND ...)
, which don't work if the test name has spaces or other special characters. Such test names may be illegal test names anyway—the documentation doesn't state whether it's allowed or disallowed for the variant ofadd_test(...)
we are using—although they appear to work.Upstream CMake issue on allowing custom strings as test names, or at least custom test descriptions: https://gitlab.kitware.com/cmake/cmake/issues/19391