diff options
| author | Ophestra <cat@gensokyo.uk> | 2025-09-04 20:28:49 +0900 |
|---|---|---|
| committer | Ophestra <cat@gensokyo.uk> | 2025-09-04 20:28:49 +0900 |
| commit | e81a45e849e7a85f50da04041d0f7a28b0fcc3cc (patch) | |
| tree | 10f59d41c8a09406210f5b07f414c308acbc983b /container/init_test.go | |
| parent | 3920acf8c215a30bc3b48408cf46a3951ec04555 (diff) | |
container/dispatcher: optional stub wait4 signal association
This synchronises the wait4 return after the toplevel signal call in lowlastcap_signaled_cancel_forward_error.
Signed-off-by: Ophestra <cat@gensokyo.uk>
Diffstat (limited to 'container/init_test.go')
| -rw-r--r-- | container/init_test.go | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/container/init_test.go b/container/init_test.go index 99e2976c..cc04057a 100644 --- a/container/init_test.go +++ b/container/init_test.go @@ -2046,7 +2046,8 @@ func TestInitEntrypoint(t *testing.T) { call("resume", stub.ExpectArgs{}, true, nil), call("verbosef", stub.ExpectArgs{"%s after process start", []any{"terminated"}}, nil, nil), call("verbose", stub.ExpectArgs{[]any{"forwarding context cancellation"}}, nil, nil), - call("signal", stub.ExpectArgs{"/run/current-system/sw/bin/bash", []string{"bash", "-c", "false"}, ([]string)(nil), "/.hakurei/nonexistent", os.Interrupt}, nil, stub.UniqueError(9)), + // magicWait4Signal as ret causes wait4 stub to unblock + call("signal", stub.ExpectArgs{"/run/current-system/sw/bin/bash", []string{"bash", "-c", "false"}, ([]string)(nil), "/.hakurei/nonexistent", os.Interrupt}, magicWait4Signal, stub.UniqueError(9)), call("printf", stub.ExpectArgs{"cannot forward cancellation: %v", []any{stub.UniqueError(9)}}, nil, nil), call("resume", stub.ExpectArgs{}, false, nil), call("verbosef", stub.ExpectArgs{"initial process exited with signal %s", []any{syscall.Signal(0x4e)}}, nil, nil), @@ -2057,9 +2058,10 @@ func TestInitEntrypoint(t *testing.T) { /* wait4 */ Tracks: []stub.Expect{{Calls: []stub.Call{ - call("wait4", stub.ExpectArgs{-1, syscall.WaitStatus(0xfade01ce), 0, nil}, 0xbad, nil), + // magicWait4Signal as args[4] causes this to block until simulated signal is delivered + call("wait4", stub.ExpectArgs{-1, syscall.WaitStatus(0xfade01ce), 0, nil, magicWait4Signal}, 0xbad, nil), // this terminates the goroutine at the call, preventing it from leaking while preserving behaviour - call("wait4", stub.ExpectArgs{-1, nil, 0, nil, 0xdeadbeef}, 0, syscall.ECHILD), + call("wait4", stub.ExpectArgs{-1, nil, 0, nil, stub.PanicExit}, 0, syscall.ECHILD), }}}, }, nil}, @@ -2149,7 +2151,7 @@ func TestInitEntrypoint(t *testing.T) { /* wait4 */ Tracks: []stub.Expect{{Calls: []stub.Call{ // this terminates the goroutine at the call, preventing it from leaking while preserving behaviour - call("wait4", stub.ExpectArgs{-1, nil, 0, nil, 0xdeadbeef}, 0, syscall.ECHILD), + call("wait4", stub.ExpectArgs{-1, nil, 0, nil, stub.PanicExit}, 0, syscall.ECHILD), }}}, }, nil}, |
