aboutsummaryrefslogtreecommitdiffhomepage
path: root/test/sandbox/assert.nix
diff options
context:
space:
mode:
authorOphestra <cat@gensokyo.uk>2025-03-23 15:00:59 +0900
committerOphestra <cat@gensokyo.uk>2025-03-23 15:00:59 +0900
commit2d379b5a3884e1b3ffbc9a8be69788810340506e (patch)
tree592f21daf82f23728f32a70c8ef873ff7e1ced53 /test/sandbox/assert.nix
parent75e0c5d4061d68dc4802285ec137e464f4e01b17 (diff)
test/sandbox: pass want file as argument
This avoids building the check program multiple times. Signed-off-by: Ophestra <cat@gensokyo.uk>
Diffstat (limited to 'test/sandbox/assert.nix')
-rw-r--r--test/sandbox/assert.nix24
1 files changed, 9 insertions, 15 deletions
diff --git a/test/sandbox/assert.nix b/test/sandbox/assert.nix
index d45e4cb9..2ab075f4 100644
--- a/test/sandbox/assert.nix
+++ b/test/sandbox/assert.nix
@@ -3,22 +3,9 @@
buildGoModule,
version,
- name,
- want,
}:
-let
- wantFile = writeText "fortify-${name}-want.json" (builtins.toJSON want);
- mainFile = writeText "main.go" ''
- package main
-
- import "os"
- import "git.gensokyo.uk/security/fortify/test/sandbox"
-
- func main() { (&sandbox.T{FS: os.DirFS("/"), PMountsPath: "/.fortify/mounts"}).MustCheckFile("${wantFile}") }
- '';
-in
buildGoModule {
- pname = "fortify-${name}-check-sandbox";
+ pname = "check-sandbox";
inherit version;
src = ../.;
@@ -26,6 +13,13 @@ buildGoModule {
preBuild = ''
go mod init git.gensokyo.uk/security/fortify/test >& /dev/null
- cp ${mainFile} main.go
+ cp ${writeText "main.go" ''
+ package main
+
+ import "os"
+ import "git.gensokyo.uk/security/fortify/test/sandbox"
+
+ func main() { (&sandbox.T{FS: os.DirFS("/"), PMountsPath: "/.fortify/mounts"}).MustCheckFile(os.Args[1]) }
+ ''} main.go
'';
}