From 56beae17fe7b208c144539821a3c34c395870372 Mon Sep 17 00:00:00 2001 From: Ophestra Date: Tue, 21 Oct 2025 19:49:04 +0900 Subject: [PATCH] test: assert hst CGO_ENABLED=0 The hst package only deals with data serialisation, however since many parts of hakurei make use of C libraries in some way it can be easy to inadvertently depend on cgo. Signed-off-by: Ophestra --- test/default.nix | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/test/default.nix b/test/default.nix index 44ec3d7..037d7de 100644 --- a/test/default.nix +++ b/test/default.nix @@ -32,6 +32,16 @@ nixosTest { environment.systemPackages = [ # For go tests: (writeShellScriptBin "hakurei-test" '' + # Assert hst CGO_ENABLED=0: ${ + with pkgs; + runCommand "hakurei-hst-cgo" { nativeBuildInputs = [ go ]; } '' + cp -r ${options.environment.hakurei.package.default.src} "$out" + chmod -R +w "$out" + cp ${writeText "hst_cgo_test.go" ''package hakurei_test;import("testing";"hakurei.app/hst");func TestTemplate(t *testing.T){hst.Template()}''} "$out/hst_cgo_test.go" + (cd "$out" && HOME="$(mktemp -d)" CGO_ENABLED=0 go test .) + '' + } + cd ${self.packages.${system}.hakurei.src} ${fhs}/bin/hakurei-fhs -c \ 'go test ${if withRace then "-race" else "-count 16"} ./...' \