From 3d79e4871b8db65b613761a29295b07d89f059d1 Mon Sep 17 00:00:00 2001 From: mdarocha Date: Tue, 28 Jun 2022 22:47:20 +0200 Subject: [PATCH] buildDotnetModule: set LD_LIBRARY_PATH from runtimeDeps in dotnetCheckHook Tests should execute in a similar environment to the final app --- .../dotnet/build-dotnet-module/hooks/default.nix | 7 +++++-- .../dotnet/build-dotnet-module/hooks/dotnet-check-hook.sh | 2 +- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/pkgs/build-support/dotnet/build-dotnet-module/hooks/default.nix b/pkgs/build-support/dotnet/build-dotnet-module/hooks/default.nix index 76f7eea5bfec..5f5916d08b19 100644 --- a/pkgs/build-support/dotnet/build-dotnet-module/hooks/default.nix +++ b/pkgs/build-support/dotnet/build-dotnet-module/hooks/default.nix @@ -11,6 +11,9 @@ , buildType }: +let + libraryPath = lib.makeLibraryPath runtimeDeps; +in { dotnetConfigureHook = callPackage ({ }: makeSetupHook { @@ -35,7 +38,7 @@ name = "dotnet-check-hook"; deps = [ dotnet-test-sdk ]; substitutions = { - inherit buildType; + inherit buildType libraryPath; disabledTests = lib.optionalString (disabledTests != []) (lib.concatStringsSep "&FullyQualifiedName!=" disabledTests); }; @@ -56,7 +59,7 @@ deps = [ dotnet-runtime makeWrapper ]; substitutions = { dotnetRuntime = dotnet-runtime; - runtimeDeps = lib.makeLibraryPath runtimeDeps; + runtimeDeps = libraryPath; }; } ./dotnet-fixup-hook.sh) { }; } diff --git a/pkgs/build-support/dotnet/build-dotnet-module/hooks/dotnet-check-hook.sh b/pkgs/build-support/dotnet/build-dotnet-module/hooks/dotnet-check-hook.sh index 6b3deaa52f96..bc7b1b5c3d82 100644 --- a/pkgs/build-support/dotnet/build-dotnet-module/hooks/dotnet-check-hook.sh +++ b/pkgs/build-support/dotnet/build-dotnet-module/hooks/dotnet-check-hook.sh @@ -11,7 +11,7 @@ dotnetCheckHook() { fi for project in ${testProjectFile[@]}; do - env \ + env "LD_LIBRARY_PATH=@libraryPath@" \ dotnet test "$project" \ -maxcpucount:$maxCpuFlag \ -p:ContinuousIntegrationBuild=true \