test/sandbox/assert: wrap printf

Signed-off-by: Ophestra <cat@gensokyo.uk>
This commit is contained in:
2025-03-02 18:37:46 +09:00
parent d8e9d71f87
commit 0d3652b793
3 changed files with 9 additions and 3 deletions

View File

@@ -111,7 +111,8 @@ overlay /.fortify/sbin/fortify overlay ro,nosuid,nodev,relatime,lowerdir=/mnt-ro
})
t.Run(tc.name+" assert", func(t *testing.T) {
sandbox.ReplaceFatal(t.Fatalf)
oldFatal := sandbox.SwapFatal(t.Fatalf)
t.Cleanup(func() { sandbox.SwapFatal(oldFatal) })
wantFile := path.Join(t.TempDir(), "want.json")
if f, err := os.OpenFile(wantFile, os.O_CREATE|os.O_WRONLY, 0400); err != nil {