aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorOphestra <cat@gensokyo.uk>2025-10-21 19:49:04 +0900
committerOphestra <cat@gensokyo.uk>2025-10-21 19:49:04 +0900
commit56beae17fe7b208c144539821a3c34c395870372 (patch)
treee94fc6b2260cccceb6631c4b604781fa5ef08421
parentea978101b13a3617914f5a62c0f0e2f53967a3c0 (diff)
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 <cat@gensokyo.uk>
-rw-r--r--test/default.nix10
1 files changed, 10 insertions, 0 deletions
diff --git a/test/default.nix b/test/default.nix
index 44ec3d73..037d7dee 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"} ./...' \