container/dispatcher: remove exit stub test log
All checks were successful
Test / Create distribution (push) Successful in 34s
Test / Sandbox (push) Successful in 2m18s
Test / Hakurei (push) Successful in 3m15s
Test / Hpkg (push) Successful in 4m1s
Test / Sandbox (race detector) (push) Successful in 4m30s
Test / Hakurei (race detector) (push) Successful in 5m11s
Test / Flake checks (push) Successful in 1m30s
All checks were successful
Test / Create distribution (push) Successful in 34s
Test / Sandbox (push) Successful in 2m18s
Test / Hakurei (push) Successful in 3m15s
Test / Hpkg (push) Successful in 4m1s
Test / Sandbox (race detector) (push) Successful in 4m30s
Test / Hakurei (race detector) (push) Successful in 5m11s
Test / Flake checks (push) Successful in 1m30s
Turns out testing.T does not like being called in defer. Signed-off-by: Ophestra <cat@gensokyo.uk>
This commit is contained in:
parent
cedfceded5
commit
8db906ee64
@ -113,7 +113,7 @@ type simpleTestCase struct {
|
||||
func checkSimple(t *testing.T, fname string, testCases []simpleTestCase) {
|
||||
for _, tc := range testCases {
|
||||
t.Run(tc.name, func(t *testing.T) {
|
||||
defer handleExitStub(t, "check")
|
||||
defer handleExitStub()
|
||||
k := &kstub{t: t, want: tc.want, wg: new(sync.WaitGroup)}
|
||||
if err := tc.f(k); !errors.Is(err, tc.wantErr) {
|
||||
t.Errorf("%s: error = %v, want %v", fname, err, tc.wantErr)
|
||||
@ -141,6 +141,7 @@ func checkOpBehaviour(t *testing.T, testCases []opBehaviourTestCase) {
|
||||
t.Run("behaviour", func(t *testing.T) {
|
||||
for _, tc := range testCases {
|
||||
t.Run(tc.name, func(t *testing.T) {
|
||||
defer handleExitStub()
|
||||
state := &setupState{Params: tc.params}
|
||||
k := &kstub{t: t, want: [][]kexpect{slices.Concat(tc.early, []kexpect{{name: "\x00"}}, tc.apply)}, wg: new(sync.WaitGroup)}
|
||||
errEarly := tc.op.early(state, k)
|
||||
@ -265,10 +266,9 @@ func (k *kexpect) error(ok ...bool) error {
|
||||
return syscall.ENOTRECOVERABLE
|
||||
}
|
||||
|
||||
func handleExitStub(t *testing.T, prefix string) {
|
||||
func handleExitStub() {
|
||||
r := recover()
|
||||
if r == 0xdeadbeef {
|
||||
t.Log(prefix + " terminated on an exit stub")
|
||||
return
|
||||
}
|
||||
if r != nil {
|
||||
@ -359,7 +359,7 @@ func (k *kstub) new(f func(k syscallDispatcher)) {
|
||||
k.wg.Add(1)
|
||||
go func() {
|
||||
defer k.wg.Done()
|
||||
defer handleExitStub(k.t, "goroutine")
|
||||
defer handleExitStub()
|
||||
f(sk)
|
||||
}()
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user