New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
catch_discover_test PROPERTIES does not work with lists #2424
Comments
Yeah, the bigger "problem" (meaning, barrier to using an environment list the way you'd like, which I agree is a reasonable expectation) is that Lines 149 to 159 in 165647a
Then, through a whole series of events, that argument gets transformed into a set_tests_properties( [==[Test name]==] PROPERTIES WORKING_DIRECTORY /path/to/it
LABELS Labels ENVIRONMENT [==[VAR=value]==]) Each separate set_tests_properties( [==[Test name]==] PROPERTIES WORKING_DIRECTORY /path/to/it
LABELS Labels ENVIRONMENT [==[VAR1=val1]==] [==[VAR2=val2]==] [==[VAR3=val3]==]) I'm actually a bit surprised to learn (as you claim) that a call (effectively) like this, works: catch_discover_tests(...
PROPERTIES
ENVIRONMENT VAR1=val1
ENVIRONMENT VAR2=val2
) Since that's going to end up transformed into this: set_tests_properties( [==[Test name]==] PROPERTIES WORKING_DIRECTORY /path/to/it
LABELS Labels ENVIRONMENT [==[VAR1=val1]==] ENVIRONMENT [==[VAR2=val2]==]
ENVIRONMENT [==[VAR3=val3]==]) ...and, while ...Aaaanyway, point is, threading a "nested" list through the eye of that needle would be quite the undertaking. But at the very least, I agree, the restriction should be documented. |
As this does not work for lists of lists e.g. |
Describe the bug
When still using
ParseAndAddCatchTests
, I had code like this to set multiple environment variables for running the tests:When using
catch_discover_tests
, I tried to replace the last three lines with:But after observing some indirect errors a while later, I noticed that only the very first environment variable was actually exported.
Looking under the hood, the problem seems to be that
PROPERTIES
are stored as a list itself, so that lists as value / semicolons in values will lead to problems.My workaround currently is to add
ENVIRONMENT;
for each environment variable, resulting in:Expected behavior
catch_discover_tests(${test} PROPERTIES ENVIRONMENT "${_environment_vars_list}")
should work even if there are multiple environment variables specified. This interface would be consistent withset_tests_properties
.Alternatively, this differing behavior for
PROPERTIES
should be documented, e.g., insidedocs/cmake-integration.md
, if possible with a suggested workaround.Platform information:
The text was updated successfully, but these errors were encountered: