diff options
| author | Ophestra <cat@gensokyo.uk> | 2026-10-15 01:37:45 +0900 |
|---|---|---|
| committer | Ophestra <cat@gensokyo.uk> | 2026-10-15 01:37:45 +0900 |
| commit | d85efc7878c8399fd28a6cade0b08bb98903269d (patch) | |
| tree | a24490986ea6a19a601d0782ba68bfcc983abf7e | |
| parent | 0cc566892fb34cf74e24a5f78f97fc434528a5ce (diff) | |
internal/testsuite: optional startup notification
This is only really used by the sandbox test suite for seccomp
validation. Make it optional here to simplify other use cases.
Signed-off-by: Ophestra <cat@gensokyo.uk>
| -rw-r--r-- | cmd/hakurei/testsuite/sandbox/main.go | 3 | ||||
| -rw-r--r-- | internal/testsuite/testsuite.go | 16 |
2 files changed, 11 insertions, 8 deletions
diff --git a/cmd/hakurei/testsuite/sandbox/main.go b/cmd/hakurei/testsuite/sandbox/main.go index 18ebe32a..ac0cf760 100644 --- a/cmd/hakurei/testsuite/sandbox/main.go +++ b/cmd/hakurei/testsuite/sandbox/main.go @@ -293,8 +293,7 @@ func main() { if err != nil { log.Fatalf("test case %s: %v", name, err) } - }, - &tc.Hakurei, + }, true, &tc.Hakurei, ) testsuite.MustCheckFilter( diff --git a/internal/testsuite/testsuite.go b/internal/testsuite/testsuite.go index 82cc23ec..d1f3d933 100644 --- a/internal/testsuite/testsuite.go +++ b/internal/testsuite/testsuite.go @@ -478,7 +478,7 @@ func StartHakurei( dbusEnv string, processCommand func(cmd *exec.Cmd), onDone func(err error, output string), - scan bool, + scan, wait bool, c *hst.Config, ) (p hst.State, pid int, err error) { s := store.New(check.MustAbs("/tmp/hakurei.0/state")) @@ -558,10 +558,13 @@ func StartHakurei( return } - if _, err = io.ReadFull(notify, make([]byte, 8)); err != nil { - _ = notify.Close() - return - } else if err = notify.Close(); err != nil { + if wait { + if _, err = io.ReadFull(notify, make([]byte, 8)); err != nil { + _ = notify.Close() + return + } + } + if err = notify.Close(); err != nil { return } @@ -650,6 +653,7 @@ func MustStartHakurei( cred *syscall.Credential, dbusEnv string, onDone func(err error, output string), + wait bool, c *hst.Config, ) (p hst.State, pid int) { _ctx, cancel := context.WithCancel(ctx) @@ -660,7 +664,7 @@ func MustStartHakurei( nil, func(err error, output string) { defer cancel() onDone(err, output) - }, true, c, + }, true, wait, c, ) if err != nil { log.Printf("cannot start hakurei container: %v", err) |
