Skip to content

Extracting test binaries #145

Answered by ipetkov
TheNeikos asked this question in Q&A
Oct 18, 2022 · 1 comments · 1 reply
Discussion options

You must be logged in to vote

I would suggest adapting what buildPackage does for extracting the test binaries:

  1. Run the cargo test --no-run --message-format json-render-diagnostics and capture the logs (example)
  2. Use jq to filter the binaries you care about. buildPackage ignores tests and only looks for libraries or other executables but you might be able to achieve it with a filter like 'select(.reason == "compiler-artifact" and .profile.test == true) | .executable' (you may need to tweak it further to suit your needs but from a quick test it looks like it will achieve what you are looking for)
  3. The jq output will provide all the test binaries which would have been run for this test, and they can be copied/installed a…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@TheNeikos
Comment options

Answer selected by TheNeikos
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants