system/dispatcher: wrap syscall helper functions
All checks were successful
Test / Create distribution (push) Successful in 34s
Test / Sandbox (push) Successful in 2m6s
Test / Hakurei (push) Successful in 3m22s
Test / Hpkg (push) Successful in 3m49s
Test / Sandbox (race detector) (push) Successful in 5m34s
Test / Hakurei (race detector) (push) Successful in 3m12s
Test / Flake checks (push) Successful in 1m35s

This allows tests to stub all kernel behaviour, like in the container package.

Signed-off-by: Ophestra <cat@gensokyo.uk>
This commit is contained in:
2025-09-04 04:15:25 +09:00
parent 024d2ff782
commit ddfb865e2d
5 changed files with 427 additions and 88 deletions

View File

@@ -70,7 +70,7 @@ func New(ctx context.Context, uid int) (sys *I) {
if ctx == nil || uid < 0 {
panic("invalid call to New")
}
return &I{ctx: ctx, uid: uid}
return &I{ctx: ctx, uid: uid, syscallDispatcher: direct{}}
}
// An I provides deferred operating system interaction. [I] must not be copied.
@@ -86,6 +86,8 @@ type I struct {
committed bool
// the behaviour of Revert is only defined for up to one call
reverted bool
syscallDispatcher
}
func (sys *I) UID() int { return sys.uid }