aboutsummaryrefslogtreecommitdiffhomepage
path: root/test/default.nix
diff options
context:
space:
mode:
authorOphestra <cat@gensokyo.uk>2025-03-13 20:56:32 +0900
committerOphestra <cat@gensokyo.uk>2025-03-13 20:56:32 +0900
commitbeb3918809f0743e2275f6a3f358f622cea73d6b (patch)
treebd0a56756cc88f117b7e620fa3acae2a01ff136d /test/default.nix
parent2871426df2d7d19ca6921d74a5834a627b920de5 (diff)
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 <cat@gensokyo.uk>
Diffstat (limited to 'test/default.nix')
-rw-r--r--test/default.nix11
1 files changed, 9 insertions, 2 deletions
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: