fortify/test/sandbox/assert.nix
Ophestra 28c2685170
All checks were successful
Test / Create distribution (push) Successful in 25s
Test / Fpkg (push) Successful in 33s
Test / Fortify (push) Successful in 2m5s
Test / Data race detector (push) Successful in 2m37s
Test / Flake checks (push) Successful in 51s
test/sandbox: parse full test case
This makes declaring multiple tests much cleaner.

Signed-off-by: Ophestra <cat@gensokyo.uk>
2025-03-23 14:31:44 +09:00

32 lines
628 B
Nix

{
writeText,
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";
inherit version;
src = ../.;
vendorHash = null;
preBuild = ''
go mod init git.gensokyo.uk/security/fortify/test >& /dev/null
cp ${mainFile} main.go
'';
}