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

Builds faililng due to incorrect dummy files generated for benches #203

Open
lalithsuresh opened this issue Apr 14, 2023 · 3 comments
Open
Labels
bug Something isn't working

Comments

@lalithsuresh
Copy link

lalithsuresh commented Apr 14, 2023

Cargo allows benchmarks to be created with two possible filesystem layouts:

  1. benches/<benchfile.rs>
  2. benches/<benchmark>/{main.rs, <other rust files>}.

See for example: https://github.com/vmware/database-stream-processor/tree/main/crates/dbsp/benches

Using cargo chef on such a project structure creates skeletons of type 1) for benchmark layouts of type 2), causing builds to fail with errors like:

#16 5.600 error: failed to parse manifest at `/app/crates/dbsp/Cargo.toml`
#16 5.600
#16 5.600 Caused by:
#16 5.600   cannot infer path for `ldbc-graphalytics` bench
#16 5.600   Cargo doesn't know which to use because multiple target files found at `benches/ldbc-graphalytics.rs` and `benches/ldbc-graphalytics/main.rs`.
#16 5.601 [cargo-make] ERROR - Error while executing command, exit code: 101
#16 5.601 [cargo-make] WARN - Build Failed.

In this example, benches/ldbc-graphalytics.rs is the created dummy file.

@LukeMathWalker LukeMathWalker added the bug Something isn't working label Apr 15, 2023
@LukeMathWalker
Copy link
Owner

This is related to #150 and it can be solved by using cargo-metadata for artefact detection rather than our home-grown solution.

Thanks for reporting it!

@Kobzol
Copy link
Contributor

Kobzol commented Apr 18, 2023

@LukeMathWalker Using target detection from cargo-metadata is probably useful anyway, but is this specific issue indeed a problem? cargo cook should be invoked from an empty directory containing only recipe.json. In that case, cargo chef will create the wrong benchmark file, but it should be fine for building dependencies.

The problem only happens when user code is copied over and then there are two copies of the same benchmark file, which causes conflicts. Maybe it would be enough to just delete the benches directory after cooking?

@lalithsuresh
Copy link
Author

@Kobzol that's indeed the workaround I've adopted so far (doing another pass to rm the wrong files).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants