From 4e796d74e51225830df9b3b704bcd6b3dd6882a2 Mon Sep 17 00:00:00 2001 From: Manuel de Brito Fontes Date: Mon, 23 Nov 2026 14:50:37 -0300 Subject: [PATCH] boot: the shut down subtest boots systemd sized as spin sizes it (#658) TestTheMachineSaysHowItEnded/shut_down booted systemd in spin's 128 MiB base and never plugged, ~90 MiB to the guest. A guest left there runs its OOM killer through the boot (docs/boot-time.md, "The memory"): 28 of 40 boots did on the KVM fleet (compat 45230275709), and when it took systemd-logind the power button went unhandled and QEMU did not end. spin plugs 2048 MiB right after a workspace starts, as the probes do; the subtest now does the same, and fails on any OOM in the guest's console rather than only on the ones that cost the shutdown. With the plug, 0 of 40 (compat 45231206182). Co-Authored-By: Claude Opus 5.5 --- boot/verbs_test.go | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/boot/verbs_test.go b/boot/verbs_test.go index 7df2a2ff..d5f18ff4 100644 --- a/boot/verbs_test.go +++ b/boot/verbs_test.go @@ -31,6 +31,14 @@ func shell(t *testing.T, r *recorder, systemd bool) *guest { g := startGuest(t, s, mac, nil) g.boot(t, r.overlay(t, t.TempDir()), r.base()) if systemd { + // Sized as spin sizes a workspace right after it starts (docs/boot-time.md, "The memory"): + // systemd in the 128 MiB base alone, ~90 MiB to the guest, ran its OOM killer at 0.37 s + // and killed systemd-logind, which handles the power button, now and then (#658). + ctx, cancel := context.WithTimeout(context.Background(), time.Minute) + defer cancel() + if err := g.SetMemory(ctx, 2048); err != nil { + t.Fatal(err) + } g.await(t, regexp.MustCompile(`login: `), 60*time.Second) return g } @@ -74,6 +82,9 @@ func TestTheMachineSaysHowItEnded(t *testing.T) { case <-time.After(30 * time.Second): t.Fatalf("QEMU did not end:\n%s", tail([]byte(g.said()), 2000)) } + if strings.Contains(g.said(), "Out of memory") { + t.Errorf("the guest ran its OOM killer:\n%s", tail([]byte(g.said()), 4000)) + } end, said := g.End() t.Logf("End: %+v, %v", end, said) if !said || end != tc.want {