You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This however doesn't work and cargo always executes runner.sh. Documentation says that I can use a cfg() expression and it shows here that I can use test value to detect if runner was executed by cargo test.
As far I understand this is either a cargo bug, or misleading documentation. If it is the former, I would like to report it. And if it is the latter I would ask for updating documentation and possibly telling me if I can achieve my objective in a different way (other than analyzing executable path name).
Steps
Create new cargo project.
Create two different scripts runner.sh and test-runner.sh in the root of new project.
Create .cargo/toml with contents as above.
Try running cargo run and cargo test and observe how the latter doesn't work.
Possible Solution(s)
No response
Notes
This happens on all stable, beta and nightly release channels.
Thanks for the report! I believe this is a duplicate of #8170, so closing in favor of that.
Cargo should probably be issuing a warning for keys that it doesn't support. It has this ability for [target.cfg().dependencies] tables, but not for [target] config tables. It should probably be calling check_cfg_attributes (and that function would need the wording fixed since it is specific to dependencies).
Problem
I have a use case where I want to have two different runners depending on run/test mode. I tried to create following configuration file:
This however doesn't work and cargo always executes
runner.sh
. Documentation says that I can use a cfg() expression and it shows here that I can usetest
value to detect if runner was executed bycargo test
.As far I understand this is either a cargo bug, or misleading documentation. If it is the former, I would like to report it. And if it is the latter I would ask for updating documentation and possibly telling me if I can achieve my objective in a different way (other than analyzing executable path name).
Steps
runner.sh
andtest-runner.sh
in the root of new project..cargo/toml
with contents as above.cargo run
andcargo test
and observe how the latter doesn't work.Possible Solution(s)
No response
Notes
This happens on all
stable
,beta
andnightly
release channels.Version
The text was updated successfully, but these errors were encountered: