From 850a4bfc7b93a802518128755bdbb4aa7a5eed9c Mon Sep 17 00:00:00 2001 From: Florian Klink Date: Tue, 16 Jan 2024 22:00:41 +0200 Subject: chore(third_party/crate2nix): run tests in /build/source 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 Tested-by: BuildkiteCI --- tvix/Cargo.nix | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'tvix') diff --git a/tvix/Cargo.nix b/tvix/Cargo.nix index d6400eed3d..45881b6b23 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 -- cgit 1.4.1