From 6396e1e8825d532b4b658bda660c87645d9c6912 Mon Sep 17 00:00:00 2001 From: Winter Date: Tue, 8 Apr 2025 16:14:52 -0400 Subject: [PATCH] wireguard-go: actually run tests None of the tests are in the root directory (except for the code formatting one), so they were never actually run until now. --- pkgs/by-name/wi/wireguard-go/package.nix | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/pkgs/by-name/wi/wireguard-go/package.nix b/pkgs/by-name/wi/wireguard-go/package.nix index fbc5ad5ee595..4b08fd5f5e35 100644 --- a/pkgs/by-name/wi/wireguard-go/package.nix +++ b/pkgs/by-name/wi/wireguard-go/package.nix @@ -38,6 +38,21 @@ buildGoModule ( "-w" ]; + # No tests besides the formatting one are in root. + # We can't override subPackages per-phase (and we don't + # want to needlessly build packages that have build + # constraints), so just use the upstream Makefile (that + # runs `go test ./...`) to actually run the tests. + checkPhase = '' + runHook preCheck + export GOFLAGS=''${GOFLAGS//-trimpath/} + make test + runHook postCheck + ''; + + # Tests require networking. + __darwinAllowLocalNetworking = finalAttrs.doCheck; + postInstall = '' mv $out/bin/wireguard $out/bin/wireguard-go '';