From beb3918809f0743e2275f6a3f358f622cea73d6b Mon Sep 17 00:00:00 2001 From: Ophestra Date: Thu, 13 Mar 2025 20:56:32 +0900 Subject: test: run go test under regular user By default test vm commands run as root, this causes buildFHSEnv bwrap to cover some parts of /proc, making it impossible to mount proc in a mount namespace created under it. Running as a regular user gets around this issue. Signed-off-by: Ophestra --- test/default.nix | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'test/default.nix') diff --git a/test/default.nix b/test/default.nix index d803a235..bf3e007a 100644 --- a/test/default.nix +++ b/test/default.nix @@ -15,8 +15,15 @@ nixosTest { { environment.systemPackages = [ # For go tests: - self.packages.${system}.fhs - (writeShellScriptBin "fortify-src" "echo -n ${self.packages.${system}.fortify.src}") + (writeShellScriptBin "fortify-go-test" '' + set -e + WORK="$(mktemp -ud)" + cp -r "${self.packages.${system}.fortify.src}" "$WORK" + chmod -R +w "$WORK" + cd "$WORK" + ${self.packages.${system}.fhs}/bin/fortify-fhs -c \ + 'go generate ./... && go test ./... && touch /tmp/go-test-ok' + '') ]; # Run with Go race detector: -- cgit v1.3.1