nix-community / crate2nix

rebuild only changed crates in CI with crate2nix and nix
https://nix-community.github.io/crate2nix/
Apache License 2.0
382 stars 89 forks source link

rstests adds a stray "/sources" to all globbed #[files] #327

Closed flokli closed 9 months ago

flokli commented 10 months ago

For Tvix, we tried to switch from test_resources to rstest, and use its #[files] feature for globbing.

rstest seems to correctly find the files and creates individual test cases as expected, however the PathBuf variable each test is then called with contains the wrong path:

Rather than

/build/src/tests/tvix_tests/eval-okay-access-strange-identifier.nix

the test is called with

/build/source/src/tests/tvix_tests/eval-okay-access-strange-identifier.nix

(note the additional /source) being added)

I'm not quite sure where this is coming from. I tried to override testPreRun and peek at the env vars being set, and couldn't find anything setting it - neither any references to sources in the emitted Cargo.nix.

The working dir is /build, and /build/source doesn't exist, and isn't referred from anywhere.

Any idea where this is coming from?

Tested with 0.13.0.

RaitoBezarius commented 10 months ago

99 % that this is the root cause: https://github.com/NixOS/nixpkgs/blob/master/pkgs/build-support/rust/build-rust-crate/configure-crate.nix#L137 but I don't have time to dig into it for now.