internal/outcome/shim: params check early
All checks were successful
Test / Create distribution (push) Successful in 35s
Test / Sandbox (push) Successful in 2m16s
Test / Hakurei (push) Successful in 3m18s
Test / Hpkg (push) Successful in 4m0s
Test / Hakurei (race detector) (push) Successful in 4m56s
Test / Sandbox (race detector) (push) Successful in 4m11s
Test / Flake checks (push) Successful in 1m29s
All checks were successful
Test / Create distribution (push) Successful in 35s
Test / Sandbox (push) Successful in 2m16s
Test / Hakurei (push) Successful in 3m18s
Test / Hpkg (push) Successful in 4m0s
Test / Hakurei (race detector) (push) Successful in 4m56s
Test / Sandbox (race detector) (push) Successful in 4m11s
Test / Flake checks (push) Successful in 1m29s
This is unreachable, but keeping it here as a failsafe until more test cases are added. Signed-off-by: Ophestra <cat@gensokyo.uk>
This commit is contained in:
@@ -147,6 +147,9 @@ func shimEntrypoint(k syscallDispatcher) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if stateParams.params.Ops == nil { // unreachable
|
||||||
|
k.fatal("invalid container params")
|
||||||
|
}
|
||||||
|
|
||||||
// shim exit outcomes
|
// shim exit outcomes
|
||||||
var cancelContainer atomic.Pointer[context.CancelFunc]
|
var cancelContainer atomic.Pointer[context.CancelFunc]
|
||||||
@@ -187,10 +190,6 @@ func shimEntrypoint(k syscallDispatcher) {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
if stateParams.params.Ops == nil {
|
|
||||||
k.fatal("invalid container params")
|
|
||||||
}
|
|
||||||
|
|
||||||
// close setup socket
|
// close setup socket
|
||||||
if err := closeSetup(); err != nil {
|
if err := closeSetup(); err != nil {
|
||||||
msg.Verbosef("cannot close setup pipe: %v", err)
|
msg.Verbosef("cannot close setup pipe: %v", err)
|
||||||
|
|||||||
@@ -106,12 +106,7 @@ func TestShimEntrypoint(t *testing.T) {
|
|||||||
Remount(fhs.AbsRoot, syscall.MS_RDONLY),
|
Remount(fhs.AbsRoot, syscall.MS_RDONLY),
|
||||||
}
|
}
|
||||||
|
|
||||||
checkSimple(t, "shimEntrypoint", []simpleTestCase{
|
templateState := outcomeState{
|
||||||
{"success", func(k *kstub) error { shimEntrypoint(k); return nil }, stub.Expect{Calls: []stub.Call{
|
|
||||||
call("getMsg", stub.ExpectArgs{}, nil, nil),
|
|
||||||
call("getLogger", stub.ExpectArgs{}, (*log.Logger)(nil), nil),
|
|
||||||
call("setDumpable", stub.ExpectArgs{uintptr(container.SUID_DUMP_DISABLE)}, nil, nil),
|
|
||||||
call("receive", stub.ExpectArgs{"HAKUREI_SHIM", outcomeState{
|
|
||||||
Shim: &shimParams{PrivPID: 0xbad, WaitDelay: 0xf, Verbose: true, Ops: []outcomeOp{
|
Shim: &shimParams{PrivPID: 0xbad, WaitDelay: 0xf, Verbose: true, Ops: []outcomeOp{
|
||||||
&spParamsOp{"xterm-256color", true},
|
&spParamsOp{"xterm-256color", true},
|
||||||
&spRuntimeOp{sessionTypeWayland},
|
&spRuntimeOp{sessionTypeWayland},
|
||||||
@@ -130,7 +125,14 @@ func TestShimEntrypoint(t *testing.T) {
|
|||||||
Mapuid: 1000,
|
Mapuid: 1000,
|
||||||
Mapgid: 100,
|
Mapgid: 100,
|
||||||
Paths: &env.Paths{TempDir: fhs.AbsTmp, RuntimePath: fhs.AbsRunUser.Append("1000")},
|
Paths: &env.Paths{TempDir: fhs.AbsTmp, RuntimePath: fhs.AbsRunUser.Append("1000")},
|
||||||
}, nil}, nil, nil),
|
}
|
||||||
|
|
||||||
|
checkSimple(t, "shimEntrypoint", []simpleTestCase{
|
||||||
|
{"success", func(k *kstub) error { shimEntrypoint(k); return nil }, stub.Expect{Calls: []stub.Call{
|
||||||
|
call("getMsg", stub.ExpectArgs{}, nil, nil),
|
||||||
|
call("getLogger", stub.ExpectArgs{}, (*log.Logger)(nil), nil),
|
||||||
|
call("setDumpable", stub.ExpectArgs{uintptr(container.SUID_DUMP_DISABLE)}, nil, nil),
|
||||||
|
call("receive", stub.ExpectArgs{"HAKUREI_SHIM", templateState, nil}, nil, nil),
|
||||||
call("swapVerbose", stub.ExpectArgs{true}, false, nil),
|
call("swapVerbose", stub.ExpectArgs{true}, false, nil),
|
||||||
call("verbosef", stub.ExpectArgs{"process share directory at %q, runtime directory at %q", []any{m("/tmp/hakurei.10"), m("/run/user/1000/hakurei")}}, nil, nil),
|
call("verbosef", stub.ExpectArgs{"process share directory at %q, runtime directory at %q", []any{m("/tmp/hakurei.10"), m("/run/user/1000/hakurei")}}, nil, nil),
|
||||||
call("setupContSignal", stub.ExpectArgs{0xbad}, 0, nil),
|
call("setupContSignal", stub.ExpectArgs{0xbad}, 0, nil),
|
||||||
|
|||||||
Reference in New Issue
Block a user