about summary refs log tree commit diff
path: root/tvix/Cargo.nix
diff options
context:
space:
mode:
authorFlorian Klink <flokli@flokli.de>2024-01-16T20·00+0200
committerflokli <flokli@flokli.de>2024-01-17T07·33+0000
commit850a4bfc7b93a802518128755bdbb4aa7a5eed9c (patch)
treec1217d9f8a7aeac2e3966a0056820434be37c554 /tvix/Cargo.nix
parent62b10cac4490dd1b6b0001d12ef94560e40eecb9 (diff)
chore(third_party/crate2nix): run tests in /build/source r/7397
Cherry-pick of https://github.com/nix-community/crate2nix/pull/328. This
should fix rstest runs inside crate2nix-generated derivations.

Change-Id: I9d393768f7f764e33c5938bd8fa14bd1bb0b72e1
Reviewed-on: https://cl.tvl.fyi/c/depot/+/10650
Reviewed-by: raitobezarius <tvl@lahfa.xyz>
Tested-by: BuildkiteCI
Diffstat (limited to 'tvix/Cargo.nix')
-rw-r--r--tvix/Cargo.nix10
1 files changed, 10 insertions, 0 deletions
diff --git a/tvix/Cargo.nix b/tvix/Cargo.nix
index d6400eed3db2..45881b6b23b7 100644
--- a/tvix/Cargo.nix
+++ b/tvix/Cargo.nix
@@ -13541,6 +13541,16 @@ rec {
             # recreate a file hierarchy as when running tests with cargo
 
             # the source for test data
+            # It's necessary to locate the source in $NIX_BUILD_TOP/source/
+            # instead of $NIX_BUILD_TOP/
+            # because we compiled those test binaries in the former and not the latter.
+            # So all paths will expect source tree to be there and not in the build top directly.
+            # For example: $NIX_BUILD_TOP := /build in general, if you ask yourself.
+            # TODO(raitobezarius): I believe there could be more edge cases if `crate.sourceRoot`
+            # do exist but it's very hard to reason about them, so let's wait until the first bug report.
+            mkdir -p source/
+            cd source/
+
             ${pkgs.buildPackages.xorg.lndir}/bin/lndir ${crate.src}
 
             # build outputs