diff --git a/seaweed-block/cmd/sw-block/mini.go b/seaweed-block/cmd/sw-block/mini.go index 0b3a3f025b..073e64d8fb 100644 --- a/seaweed-block/cmd/sw-block/mini.go +++ b/seaweed-block/cmd/sw-block/mini.go @@ -39,18 +39,26 @@ type miniPorts struct { Master int // blockmaster Data, Ctrl, Status int // blockvolume NVMe int - WeedMaster, WeedFiler, WeedFG int // weed mini: master HTTP, filer HTTP, filer gRPC - WeedVolume int // weed mini: volume server HTTP + // weed mini's listeners (HTTP and gRPC of master, volume and filer), + // all set explicitly: its S3, WebDAV and admin UI are turned off. + WeedMaster, WeedMasterG, WeedVolume, WeedVolumeG, WeedFiler, WeedFG int } // shifted moves every port by n (--port-shift), for a host where a default // port is taken or to run a second mini beside the first. func (p miniPorts) shifted(n int) miniPorts { return miniPorts{Master: p.Master + n, Data: p.Data + n, Ctrl: p.Ctrl + n, Status: p.Status + n, NVMe: p.NVMe + n, - WeedMaster: p.WeedMaster + n, WeedFiler: p.WeedFiler + n, WeedFG: p.WeedFG + n, WeedVolume: p.WeedVolume + n} + WeedMaster: p.WeedMaster + n, WeedMasterG: p.WeedMasterG + n, WeedVolume: p.WeedVolume + n, WeedVolumeG: p.WeedVolumeG + n, + WeedFiler: p.WeedFiler + n, WeedFG: p.WeedFG + n} } -var defaultMiniPorts = miniPorts{Master: 9180, Data: 9201, Ctrl: 9202, Status: 9203, NVMe: 4420, WeedMaster: 9333, WeedFiler: 8888, WeedFG: 18888, WeedVolume: 8080} +// weed are weed mini's ports, as mini sets and checks them. +func (p miniPorts) weed() []int { + return []int{p.WeedMaster, p.WeedMasterG, p.WeedVolume, p.WeedVolumeG, p.WeedFiler, p.WeedFG} +} + +var defaultMiniPorts = miniPorts{Master: 9180, Data: 9201, Ctrl: 9202, Status: 9203, NVMe: 4420, + WeedMaster: 9333, WeedMasterG: 19333, WeedVolume: 9340, WeedVolumeG: 19340, WeedFiler: 8888, WeedFG: 18888} // miniStartWait bounds each child's readiness, and miniResolveWait the // layout id lookup; miniStopWait bounds a child's exit after SIGTERM. @@ -77,11 +85,16 @@ const ( func loopback(port int) string { return net.JoinHostPort("127.0.0.1", strconv.Itoa(port)) } -// miniWeedArgs is weed mini on loopback, its data under the run's dir. +// miniWeedArgs is weed mini bound to loopback only (-ip.bind; -ip alone is +// just the advertised address), its data under the run's dir, every +// listener's port explicit, and its S3, WebDAV and admin UI off. func miniWeedArgs(c miniConfig) []string { - return []string{"mini", "-dir=" + filepath.Join(c.Dir, "weed"), "-ip=127.0.0.1", - "-master.port=" + strconv.Itoa(c.Ports.WeedMaster), "-filer.port=" + strconv.Itoa(c.Ports.WeedFiler), - "-filer.port.grpc=" + strconv.Itoa(c.Ports.WeedFG), "-volume.port=" + strconv.Itoa(c.Ports.WeedVolume)} + port := func(f string, p int) string { return "-" + f + "=" + strconv.Itoa(p) } + return []string{"mini", "-dir=" + filepath.Join(c.Dir, "weed"), "-ip=127.0.0.1", "-ip.bind=127.0.0.1", + port("master.port", c.Ports.WeedMaster), port("master.port.grpc", c.Ports.WeedMasterG), + port("volume.port", c.Ports.WeedVolume), port("volume.port.grpc", c.Ports.WeedVolumeG), + port("filer.port", c.Ports.WeedFiler), port("filer.port.grpc", c.Ports.WeedFG), + "-s3=false", "-webdav=false", "-admin.ui=false"} } // miniMasterArgs is blockmaster as the standalone page runs it: with a chunk @@ -139,7 +152,7 @@ func parseSize(s string) (uint64, error) { for _, u := range units { if strings.HasSuffix(s, u.suffix) { n, err := strconv.ParseUint(strings.TrimSuffix(s, u.suffix), 10, 64) - if err != nil || n == 0 { + if err != nil || n == 0 || n > ^uint64(0)/u.mult { return 0, fmt.Errorf("invalid --size %q", s) } b := n * u.mult @@ -202,8 +215,8 @@ func (r *miniRun) start(name, bin string, args []string) (*miniChild, error) { func (r *miniRun) ready(ctx context.Context, c *miniChild, ports ...int) error { deadline := time.Now().Add(miniStartWait) for { - if c.exited() { - return fmt.Errorf("%s exited during startup: %v (see %s.log)", c.name, c.err, c.name) + if d := r.dead(); d != nil { + return fmt.Errorf("%s exited during startup: %v (see %s.log)", d.name, d.err, d.name) } up := true for _, p := range ports { @@ -228,6 +241,16 @@ func (r *miniRun) ready(ctx context.Context, c *miniChild, ports ...int) error { } } +// dead is the first child that has exited, if any. +func (r *miniRun) dead() *miniChild { + for _, c := range r.children { + if c.exited() { + return c + } + } + return nil +} + // stop ends every child still running, the last started first: SIGTERM, // a bounded wait, then SIGKILL. It is safe to call again. func (r *miniRun) stop() { @@ -329,14 +352,9 @@ func mini(ctx context.Context, cfg miniConfig, stdout, stderr io.Writer) (int, e if !chunk { fmt.Fprint(stdout, miniBanner()) } - if _, err := os.Stat(cfg.Dir); err == nil && !cfg.Reuse { - return ops.VolumeStatusExitInvalid, fmt.Errorf("%s exists: refusing to start over it (pass --reuse to start again on it, or another --dir)", cfg.Dir) - } else if err != nil && !errors.Is(err, os.ErrNotExist) { - return 1, err - } ports := []int{cfg.Ports.Master, cfg.Ports.Data, cfg.Ports.Ctrl, cfg.Ports.Status, cfg.Ports.NVMe} if chunk { - ports = append(ports, cfg.Ports.WeedMaster, cfg.Ports.WeedFiler, cfg.Ports.WeedFG, cfg.Ports.WeedVolume) + ports = append(ports, cfg.Ports.weed()...) } for _, p := range ports { l, err := net.Listen("tcp", loopback(p)) @@ -345,7 +363,30 @@ func mini(ctx context.Context, cfg miniConfig, stdout, stderr io.Writer) (int, e } l.Close() } - for _, d := range []string{cfg.Dir, filepath.Join(cfg.Dir, "master"), filepath.Join(cfg.Dir, "vol")} { + // The dir is claimed before anything is written: a fresh one by one + // exclusive mkdir, a reused one must exist; then a lock held for the run + // refuses a second mini on it. + if cfg.Reuse { + if st, err := os.Stat(cfg.Dir); err != nil || !st.IsDir() { + return ops.VolumeStatusExitInvalid, fmt.Errorf("--reuse: %s is not an existing directory", cfg.Dir) + } + } else { + if err := os.MkdirAll(filepath.Dir(filepath.Clean(cfg.Dir)), 0o755); err != nil { + return 1, err + } + if err := os.Mkdir(cfg.Dir, 0o755); err != nil { + if errors.Is(err, os.ErrExist) { + return ops.VolumeStatusExitInvalid, fmt.Errorf("%s exists: refusing to start over it (pass --reuse to start again on it, or another --dir)", cfg.Dir) + } + return 1, err + } + } + unlock, err := miniLock(cfg.Dir) + if err != nil { + return ops.VolumeStatusExitInvalid, err + } + defer unlock() + for _, d := range []string{filepath.Join(cfg.Dir, "master"), filepath.Join(cfg.Dir, "vol")} { if err := os.MkdirAll(d, 0o755); err != nil { return 1, err } @@ -364,7 +405,7 @@ func mini(ctx context.Context, cfg miniConfig, stdout, stderr io.Writer) (int, e if err != nil { return fail(err) } - if err := r.ready(ctx, c, cfg.Ports.WeedMaster, cfg.Ports.WeedFiler, cfg.Ports.WeedFG); err != nil { + if err := r.ready(ctx, c, cfg.Ports.weed()...); err != nil { return fail(err) } if err := os.WriteFile(filepath.Join(cfg.Dir, "cluster-spec.yaml"), []byte(miniClusterSpec(cfg)), 0o644); err != nil { @@ -392,10 +433,16 @@ func mini(ctx context.Context, cfg miniConfig, stdout, stderr io.Writer) (int, e layoutID = id.String() break } - if ctx.Err() != nil || time.Now().After(deadline) || mc.exited() { + if d := r.dead(); d != nil { + return fail(fmt.Errorf("%s exited while resolving %s's layout id: %v", d.name, miniVolume, d.err)) + } + if ctx.Err() != nil || time.Now().After(deadline) { return fail(fmt.Errorf("resolve %s's layout id: %v", miniVolume, err)) } - time.Sleep(time.Second) + select { + case <-ctx.Done(): + case <-time.After(time.Second): + } } } vc, err := r.start("blockvolume", volume, miniVolumeArgs(cfg, chunk, layoutID)) diff --git a/seaweed-block/cmd/sw-block/mini_lock_unix.go b/seaweed-block/cmd/sw-block/mini_lock_unix.go new file mode 100644 index 0000000000..95b5a74bea --- /dev/null +++ b/seaweed-block/cmd/sw-block/mini_lock_unix.go @@ -0,0 +1,25 @@ +//go:build !windows + +package main + +import ( + "fmt" + "os" + "path/filepath" + "syscall" +) + +// miniLock takes /.mini.lock exclusively for the life of one mini, so +// a second mini (a fresh start or a --reuse) on the same dir is refused +// before it writes anything. The lock ends with the process. +func miniLock(dir string) (func(), error) { + f, err := os.OpenFile(filepath.Join(dir, ".mini.lock"), os.O_CREATE|os.O_RDWR, 0o644) + if err != nil { + return nil, err + } + if err := syscall.Flock(int(f.Fd()), syscall.LOCK_EX|syscall.LOCK_NB); err != nil { + f.Close() + return nil, fmt.Errorf("%s is in use by another sw-block mini", dir) + } + return func() { _ = syscall.Flock(int(f.Fd()), syscall.LOCK_UN); f.Close() }, nil +} diff --git a/seaweed-block/cmd/sw-block/mini_lock_windows.go b/seaweed-block/cmd/sw-block/mini_lock_windows.go new file mode 100644 index 0000000000..68fe532ba0 --- /dev/null +++ b/seaweed-block/cmd/sw-block/mini_lock_windows.go @@ -0,0 +1,20 @@ +//go:build windows + +package main + +import ( + "fmt" + "os" + "path/filepath" +) + +// miniLock on Windows (mini is a Linux tool; this keeps the package +// building): an exclusive create of /.mini.lock, removed at the end. +func miniLock(dir string) (func(), error) { + p := filepath.Join(dir, ".mini.lock") + f, err := os.OpenFile(p, os.O_CREATE|os.O_EXCL|os.O_RDWR, 0o644) + if err != nil { + return nil, fmt.Errorf("%s is in use by another sw-block mini", dir) + } + return func() { f.Close(); _ = os.Remove(p) }, nil +} diff --git a/seaweed-block/cmd/sw-block/mini_test.go b/seaweed-block/cmd/sw-block/mini_test.go index 80543a4d9e..f9c5bb4c1e 100644 --- a/seaweed-block/cmd/sw-block/mini_test.go +++ b/seaweed-block/cmd/sw-block/mini_test.go @@ -32,13 +32,20 @@ func TestMain(m *testing.M) { func fakeMiniChild(mode string) int { name := filepath.Base(os.Args[0]) var ls []net.Listener + listen := func(addr string) bool { + l, err := net.Listen("tcp", addr) + if err != nil { + return false + } + ls = append(ls, l) + return true + } for i, a := range os.Args { - if (a == "--listen" || a == "--status-addr" || a == "--nvme-listen") && i+1 < len(os.Args) { - l, err := net.Listen("tcp", os.Args[i+1]) - if err != nil { - return 3 - } - ls = append(ls, l) + if (a == "--listen" || a == "--status-addr" || a == "--nvme-listen") && i+1 < len(os.Args) && !listen(os.Args[i+1]) { + return 3 + } + if k, v, ok := strings.Cut(a, "="); ok && strings.HasPrefix(k, "-") && strings.Contains(k, ".port") && !listen("127.0.0.1:"+v) { + return 3 } } defer func() { @@ -167,7 +174,7 @@ func TestMiniSize(t *testing.T) { t.Errorf("parseSize(%q) = %d %v, want %d", in, got, err, want) } } - for _, in := range []string{"", "0", "-1MiB", "100", "1.5GiB", "abc"} { + for _, in := range []string{"", "0", "-1MiB", "100", "1.5GiB", "abc", "17179869184GiB", "17179869185GiB", "18446744073709551615K"} { if _, err := parseSize(in); err == nil { t.Errorf("parseSize(%q) accepted", in) } @@ -187,7 +194,7 @@ func fakeBin(t *testing.T) string { t.Fatal(err) } dir := t.TempDir() - for _, n := range []string{"blockmaster", "blockvolume"} { + for _, n := range []string{"blockmaster", "blockvolume", "weed"} { if err := os.WriteFile(filepath.Join(dir, n), raw, 0o755); err != nil { t.Fatal(err) } @@ -199,7 +206,7 @@ func freePorts(t *testing.T) miniPorts { t.Helper() var ps []int var ls []net.Listener - for i := 0; i < 9; i++ { + for i := 0; i < 11; i++ { l, err := net.Listen("tcp", "127.0.0.1:0") if err != nil { t.Fatal(err) @@ -210,7 +217,8 @@ func freePorts(t *testing.T) miniPorts { for _, l := range ls { l.Close() } - return miniPorts{Master: ps[0], Data: ps[1], Ctrl: ps[2], Status: ps[3], NVMe: ps[4], WeedMaster: ps[5], WeedFiler: ps[6], WeedFG: ps[7], WeedVolume: ps[8]} + return miniPorts{Master: ps[0], Data: ps[1], Ctrl: ps[2], Status: ps[3], NVMe: ps[4], + WeedMaster: ps[5], WeedMasterG: ps[6], WeedVolume: ps[7], WeedVolumeG: ps[8], WeedFiler: ps[9], WeedFG: ps[10]} } // The refusals happen before anything starts: an existing --dir without @@ -302,10 +310,21 @@ func TestMiniInterruptStopsEveryChild(t *testing.T) { t.Setenv("PATH", t.TempDir()) t.Setenv("SWB_MINI_FAKE_CHILD", "serve") c := miniConfig{Dir: filepath.Join(t.TempDir(), "run"), Bin: fakeBin(t), NQN: "nqn.test:v1", SizeBytes: 1 << 20, Ports: freePorts(t)} - ctx, cancel := context.WithCancel(context.Background()) + ctx, cancel := context.WithTimeout(context.Background(), 60*time.Second) out := &syncBuf{} done := make(chan int, 1) go func() { code, _ := mini(ctx, c, out, io.Discard); done <- code }() + joined := false + t.Cleanup(func() { // registered before any assertion: a failure never leaks mini or its children + cancel() + if !joined { + select { + case <-done: + case <-time.After(30 * time.Second): + t.Error("mini did not stop at cleanup") + } + } + }) waitOutput(t, out, "sw-block mini: running") for _, want := range []string{"+ " + filepath.Join(c.Bin, "blockmaster") + " ", "+ " + filepath.Join(c.Bin, "blockvolume") + " ", "sudo nvme connect -t tcp -a 127.0.0.1 -s " + strconv.Itoa(c.Ports.NVMe) + " -n nqn.test:v1", "sudo nvme disconnect -n nqn.test:v1", "sw-block mini: no chunk store: snapshots unavailable", "trial setup: one host, loopback, no authentication"} { @@ -316,6 +335,7 @@ func TestMiniInterruptStopsEveryChild(t *testing.T) { cancel() select { case code := <-done: + joined = true if code != 0 { t.Fatalf("interrupted mini exited %d", code) } @@ -351,7 +371,9 @@ func TestMiniDeadChildStopsTheRest(t *testing.T) { t.Setenv("SWB_MINI_FAKE_CHILD", "die-blockvolume") c := miniConfig{Dir: filepath.Join(t.TempDir(), "run"), Bin: fakeBin(t), NQN: "n", SizeBytes: 1 << 20, Ports: freePorts(t)} out := &syncBuf{} - code, err := mini(context.Background(), c, out, io.Discard) + ctx, cancel := context.WithTimeout(context.Background(), 60*time.Second) + defer cancel() + code, err := mini(ctx, c, out, io.Discard) if code == 0 || err == nil || !strings.Contains(err.Error(), "blockvolume") { t.Fatalf("a dead blockvolume: code %d err %v; want a non-zero exit naming it", code, err) } @@ -401,3 +423,150 @@ func TestMiniPrintedCommandsParse(t *testing.T) { t.Fatal("without weed mini prints sw-block commands that need a chunk store") } } + +// wantChunkCommands is the supported configuration's three commands, pinned +// value for value; only the run's dir, the minted layout id and the ports +// (here the defaults) vary between runs. +func wantChunkCommands(dir, id string) map[string][]string { + return map[string][]string{ + "weed": {"mini", "-dir=" + filepath.Join(dir, "weed"), "-ip=127.0.0.1", "-ip.bind=127.0.0.1", + "-master.port=9333", "-master.port.grpc=19333", "-volume.port=9340", "-volume.port.grpc=19340", + "-filer.port=8888", "-filer.port.grpc=18888", "-s3=false", "-webdav=false", "-admin.ui=false"}, + "blockmaster": {"--authority-store", filepath.Join(dir, "master", "authority"), "--lifecycle-store", filepath.Join(dir, "master", "lifecycle"), + "--cluster-spec", filepath.Join(dir, "cluster-spec.yaml"), "--expected-slots-per-volume", "1", "--listen", "127.0.0.1:9180", + "--workspace-rpc", "--chunk-filer", "127.0.0.1:18888", "--chunk-path", "/swblock/chunks"}, + "blockvolume": {"--master", "127.0.0.1:9180", "--server-id", "s1", "--volume-id", "v1", "--replica-id", "r1", + "--data-addr", "127.0.0.1:9201", "--ctrl-addr", "127.0.0.1:9202", "--status-addr", "127.0.0.1:9203", + "--durable-root", filepath.Join(dir, "vol"), "--durable-impl", "walstore-chunk", "--durable-blocks", "65536", "--durable-blocksize", "4096", + "--chunk-filer", "127.0.0.1:18888", "--chunk-path", "/swblock/chunks", "--chunk-control-endpoint", "--workspace-lease", "--layout-id", id, + "--nvme-listen", "127.0.0.1:4420", "--nvme-subsysnqn", "nqn.2026-05.io.seaweedfs:v1"}, + } +} + +func sameArgs(a, b []string) bool { + if len(a) != len(b) { + return false + } + for i := range a { + if a[i] != b[i] { + return false + } + } + return true +} + +// With weed, mini's weed, blockmaster and blockvolume commands are exactly +// the pinned ones; controls: a changed value and a dropped required flag +// are seen. +func TestMiniChunkCommandsArePinned(t *testing.T) { + dir, id := "/tmp/m", "00112233445566778899aabbccddeeff" + cfg := miniConfig{Dir: dir, NQN: "nqn.2026-05.io.seaweedfs:v1", SizeBytes: 256 << 20, Ports: defaultMiniPorts} + got := map[string][]string{"weed": miniWeedArgs(cfg), "blockmaster": miniMasterArgs(cfg, true), "blockvolume": miniVolumeArgs(cfg, true, id)} + want := wantChunkCommands(dir, id) + for name, w := range want { + if !sameArgs(got[name], w) { + t.Errorf("%s with weed:\n got %q\n want %q", name, got[name], w) + } + } + slots := append([]string{}, want["blockmaster"]...) + slots[7] = "2" // --expected-slots-per-volume + if sameArgs(slots, want["blockmaster"]) { + t.Fatal("control: a changed value compares equal") + } + dropped := append([]string{}, want["weed"][:3]...) + dropped = append(dropped, want["weed"][4:]...) // without -ip.bind + if sameArgs(dropped, want["weed"]) { + t.Fatal("control: a dropped flag compares equal") + } +} + +// --port-shift moves every port, weed's included. +func TestMiniPortShiftMovesEveryPort(t *testing.T) { + a, b := defaultMiniPorts, defaultMiniPorts.shifted(1000) + all := func(p miniPorts) []int { return append([]int{p.Master, p.Data, p.Ctrl, p.Status, p.NVMe}, p.weed()...) } + pa, pb := all(a), all(b) + for i := range pa { + if pb[i] != pa[i]+1000 { + t.Fatalf("port %d not shifted: %d -> %d", i, pa[i], pb[i]) + } + } + if len(pa) != 11 { + t.Fatalf("%d ports; mini owns 11", len(pa)) + } +} + +// With weed, a busy port of weed's (here its master gRPC, one weed would +// otherwise pick by itself) is refused before anything starts. +func TestMiniRefusesABusyWeedPort(t *testing.T) { + bin := fakeBin(t) + c := miniConfig{Dir: filepath.Join(t.TempDir(), "run"), Bin: bin, Weed: filepath.Join(bin, "weed"), NQN: "n", SizeBytes: 1 << 20, Ports: freePorts(t)} + l, err := net.Listen("tcp", loopback(c.Ports.WeedMasterG)) + if err != nil { + t.Fatal(err) + } + defer l.Close() + code, err := mini(context.Background(), c, io.Discard, io.Discard) + if code == 0 || err == nil || !strings.Contains(err.Error(), strconv.Itoa(c.Ports.WeedMasterG)) { + t.Fatalf("busy weed master gRPC port: code %d err %v", code, err) + } +} + +// One mini per dir: a second start on a dir another mini holds is refused +// before it writes, fresh or with --reuse; --reuse of a dir that does not +// exist is refused too. +func TestMiniDirIsOwnedByOneMini(t *testing.T) { + t.Setenv("PATH", t.TempDir()) + bin := fakeBin(t) + dir := filepath.Join(t.TempDir(), "run") + if err := os.Mkdir(dir, 0o755); err != nil { + t.Fatal(err) + } + unlock, err := miniLock(dir) + if err != nil { + t.Fatal(err) + } + defer unlock() + c := miniConfig{Dir: dir, Bin: bin, NQN: "n", SizeBytes: 1 << 20, Ports: freePorts(t), Reuse: true} + if code, err := mini(context.Background(), c, io.Discard, io.Discard); code == 0 || err == nil || !strings.Contains(err.Error(), "in use") { + t.Fatalf("--reuse of a held dir: code %d err %v; want a refusal", code, err) + } + if entries, _ := os.ReadDir(dir); len(entries) != 1 { + t.Fatalf("the refused start wrote into the held dir: %v", entries) + } + c.Reuse = false + if code, err := mini(context.Background(), c, io.Discard, io.Discard); code == 0 || err == nil || !strings.Contains(err.Error(), "--reuse") { + t.Fatalf("fresh start on a held dir: code %d err %v; want a refusal", code, err) + } + c.Dir, c.Reuse = filepath.Join(t.TempDir(), "absent"), true + if code, err := mini(context.Background(), c, io.Discard, io.Discard); code == 0 || err == nil || !strings.Contains(err.Error(), "not an existing directory") { + t.Fatalf("--reuse of an absent dir: code %d err %v", code, err) + } +} + +// A weed that dies while mini waits for blockmaster's layout id stops the +// rest at once, not at the resolve's 60 s bound. +func TestMiniWeedDyingDuringStartupStopsTheRest(t *testing.T) { + if runtime.GOOS == "windows" { + t.Skip("signals and listening children: Linux") + } + t.Setenv("SWB_MINI_FAKE_CHILD", "die-weed") + bin := fakeBin(t) + c := miniConfig{Dir: filepath.Join(t.TempDir(), "run"), Bin: bin, Weed: filepath.Join(bin, "weed"), NQN: "n", SizeBytes: 1 << 20, Ports: freePorts(t)} + ctx, cancel := context.WithTimeout(context.Background(), 60*time.Second) + defer cancel() + out := &syncBuf{} + start := time.Now() + code, err := mini(ctx, c, out, io.Discard) + if code == 0 || err == nil || !strings.Contains(err.Error(), "weed") { + t.Fatalf("weed died during startup: code %d err %v; want a failure naming weed", code, err) + } + if took := time.Since(start); took > 20*time.Second { + t.Fatalf("the death was seen after %s; want at once", took) + } + for _, s := range stoppedRE.FindAllStringSubmatch(out.String(), -1) { + pid, _ := strconv.Atoi(s[2]) + if processAlive(pid) { + t.Fatalf("%s (pid %d) still runs", s[1], pid) + } + } +}