sandbox: expose cancel behaviour
All checks were successful
Test / Create distribution (push) Successful in 40s
Test / Fpkg (push) Successful in 11m53s
Test / Fortify (push) Successful in 1m57s
Test / Data race detector (push) Successful in 2m33s
Test / Flake checks (push) Successful in 58s

Signed-off-by: Ophestra <cat@gensokyo.uk>
This commit is contained in:
2025-03-15 03:04:27 +09:00
parent 10a21ce3ef
commit e64e7608ca
2 changed files with 21 additions and 0 deletions

View File

@@ -18,6 +18,7 @@ import (
"git.gensokyo.uk/security/fortify/internal/fmsg"
"git.gensokyo.uk/security/fortify/internal/sandbox"
"git.gensokyo.uk/security/fortify/ldd"
"git.gensokyo.uk/security/fortify/seccomp"
check "git.gensokyo.uk/security/fortify/test/sandbox"
)
@@ -146,6 +147,16 @@ func TestContainer(t *testing.T) {
}
}
func TestContainerString(t *testing.T) {
container := sandbox.New(context.TODO(), "ldd", "/usr/bin/env")
container.Flags |= sandbox.FAllowDevel
container.Seccomp |= seccomp.FlagMultiarch
want := `argv: ["ldd" "/usr/bin/env"], flags: 0x2, seccomp: 0x2e`
if got := container.String(); got != want {
t.Errorf("String: %s, want %s", got, want)
}
}
func TestHelperInit(t *testing.T) {
if len(os.Args) != 5 || os.Args[4] != "init" {
return