Previously, the source tree was located inline in /build during tests, this was a mistake because the crates more than often are built in /build/source as per the sourceRoot system.
This can cause issues with test binaries hardcoding /build/source/... as their choice for doing things, causing them to be confused in the test phase which is relocated without rewriting the paths inside test binaries.
We fix that by relocating ourselves in the right hierarchy.
This is a "simple" fix in the sense that more edge cases could exist but they are hard to reason about because they would be crates using custom sourceRoot, i.e. having crate.sourceRoot set and then it becomes a bit hard to reproduce the hierarchy, you need to analyze whether the path is absolute or relative,
If it's relative, you can just reuse it and reproduce that specific hierarchy. If it's absolute, you need to cut the "absolute" meaningless part, e.g. $NIX_BUILD_TOP/ and proceed like it's a relative path IMHO.
Previously, the source tree was located inline in
/build
during tests, this was a mistake because the crates more than often are built in/build/source
as per thesourceRoot
system.This can cause issues with test binaries hardcoding
/build/source/...
as their choice for doing things, causing them to be confused in the test phase which is relocated without rewriting the paths inside test binaries.We fix that by relocating ourselves in the right hierarchy.
This is a "simple" fix in the sense that more edge cases could exist but they are hard to reason about because they would be crates using custom
sourceRoot
, i.e. havingcrate.sourceRoot
set and then it becomes a bit hard to reproduce the hierarchy, you need to analyze whether the path is absolute or relative,If it's relative, you can just reuse it and reproduce that specific hierarchy. If it's absolute, you need to cut the "absolute" meaningless part, e.g.
$NIX_BUILD_TOP/
and proceed like it's a relative path IMHO.Fixes #327.