about summary refs log tree commit diff
diff options
context:
space:
mode:
authorDavid McFarland <corngood@gmail.com>2024-02-26 16:08:20 -0400
committerDavid McFarland <corngood@gmail.com>2024-02-26 16:24:54 -0400
commitf9b82960ecf1ed5e1b4eba9de590cdab31204f98 (patch)
tree9be61ee0e211e8db3c48813a63f59c515d8dc9df
parentef5481eb37506ce7d73d0ce47dd293379baa81dc (diff)
dotnet-sdk: add test for single-file compilation
-rw-r--r--pkgs/development/compilers/dotnet/build-dotnet.nix25
1 files changed, 20 insertions, 5 deletions
diff --git a/pkgs/development/compilers/dotnet/build-dotnet.nix b/pkgs/development/compilers/dotnet/build-dotnet.nix
index bcdb16c633508..be2ec26c55a7d 100644
--- a/pkgs/development/compilers/dotnet/build-dotnet.nix
+++ b/pkgs/development/compilers/dotnet/build-dotnet.nix
@@ -144,14 +144,29 @@ stdenv.mkDerivation (finalAttrs: rec {
         package = finalAttrs.finalPackage;
       };
 
-      smoke-test = runCommand "dotnet-sdk-smoke-test" {
+      console = runCommand "dotnet-test-console" {
         nativeBuildInputs = [ finalAttrs.finalPackage ];
       } ''
         HOME=$(pwd)/fake-home
-        dotnet new console --no-restore
-        dotnet restore --source "$(mktemp -d)"
-        dotnet build --no-restore
-        output="$(dotnet run --no-build)"
+        dotnet new nugetconfig
+        dotnet nuget disable source nuget
+        dotnet new console -n test -o .
+        output="$(dotnet run)"
+        # yes, older SDKs omit the comma
+        [[ "$output" =~ Hello,?\ World! ]] && touch "$out"
+      '';
+
+      single-file = let build = runCommand "dotnet-test-build-single-file" {
+        nativeBuildInputs = [ finalAttrs.finalPackage ];
+      } ''
+        HOME=$(pwd)/fake-home
+        dotnet new nugetconfig
+        dotnet nuget disable source nuget
+        dotnet nuget add source ${finalAttrs.finalPackage.packages}
+        dotnet new console -n test -o .
+        dotnet publish --use-current-runtime -p:PublishSingleFile=true -o $out
+      ''; in runCommand "dotnet-test-run-single-file" {} ''
+        output="$(${build}/test)"
         # yes, older SDKs omit the comma
         [[ "$output" =~ Hello,?\ World! ]] && touch "$out"
       '';