Skip to content
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

Expose whether bin/lib target has tests enabled #114

Closed
RalfJung opened this issue May 10, 2020 · 9 comments · Fixed by #124
Closed

Expose whether bin/lib target has tests enabled #114

RalfJung opened this issue May 10, 2020 · 9 comments · Fixed by #124
Assignees

Comments

@RalfJung
Copy link

There currently seems to be no way to figure out if a bin/lib target has tests enabled. Would be great if that information was made available -- I think that is required to solve rust-lang/miri#700.

@ehuss
Copy link
Contributor

ehuss commented May 10, 2020

The information isn't exposed from Cargo. The additional fields need to be added to SerializedTarget.

@RalfJung
Copy link
Author

Oh I see...

Btw, the comment "Serialized as a list of strings for historical reasons" for the kind field, does this mean we can rely on that list to always contain exactly one element? It is not clear from the comment what type would be used if it wasn't for historical reasons.

@ehuss
Copy link
Contributor

ehuss commented May 11, 2020

rely on that list to always contain exactly one element?

No. The documentation that explains the fields is here.

I'm only guessing, but I think it would have been preferred for libraries to have a value of "lib", instead of the array of crate-types.

@RalfJung
Copy link
Author

Oh wow, I think Miri is getting that wrong then... we just check for "lib".

The "etc" doesn't exactly help when one wants to be sure to cover all lib crates.^^

@oli-obk
Copy link
Owner

oli-obk commented Jul 12, 2020

Uh... so is there any action that I can do about this in cargo_metadata or is it essentially resolved?

@RalfJung
Copy link
Author

It's not resolved but blocked on cargo exposing test = true/false.

@oli-obk oli-obk self-assigned this Jul 12, 2020
bors added a commit to rust-lang/cargo that referenced this issue Jul 30, 2020
Emit the `test` field in cargo metadata

This is needed so `cargo-metadata` can expose it: oli-obk/cargo_metadata#114
@oli-obk
Copy link
Owner

oli-obk commented Jul 30, 2020

The cargo PR has been merged

@RalfJung
Copy link
Author

Awesome. :D
Does this crate also need updating or is that picked up automatically somehow?

@oli-obk
Copy link
Owner

oli-obk commented Jul 31, 2020

no, we need to wait for this information to make it to a release and then add the appropriate field

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants