Skip to content

Every agent's model. One place. Codex on DeepSeek, Claude Code on Kimi, from the menu bar.

pii: the GPU tests start pf-serve-vulkan off macOS, so they pass on Linux (#3741)

yetonec84f859dd028
diff --git a/internal/pii/main_test.go b/internal/pii/main_test.go
index 8442c48e8..c766c0a3b 100644
--- a/internal/pii/main_test.go
+++ b/internal/pii/main_test.go
@@ -8,6 +8,7 @@ import (
"io"
"os"
"path/filepath"
+ "runtime"
"strings"
"testing"
"time"
@@ -196,6 +197,19 @@ func fakeInstall(t *testing.T, mode string, vulkan bool) string {
return log
}
+// gpuInstall is fakeInstall with a GPU's pf-serve to start first:
+// macOS's own, which runs on Metal, or elsewhere pf-serve-vulkan, as a
+// computer with no Vulkan loader has none (#3741: these tests took
+// macOS's for every system, and were red on Linux). It answers the line
+// the stand-in logs as it starts there.
+func gpuInstall(t *testing.T, mode string) (log, gpuStart string) {
+ t.Helper()
+ if runtime.GOOS == "darwin" {
+ return fakeInstall(t, mode, false), "start pf-serve MTL0"
+ }
+ return fakeInstall(t, mode, true), "start pf-serve-vulkan MTL0"
+}
+
// fakeLines are the lines the stand-in logged that start with prefix.
func fakeLines(t *testing.T, log, prefix string) []string {
t.Helper()
diff --git a/internal/pii/serve_test.go b/internal/pii/serve_test.go
index eb678f6e3..e2dcbebc4 100644
--- a/internal/pii/serve_test.go
+++ b/internal/pii/serve_test.go
@@ -20,7 +20,7 @@ func person(s, e int) redact.Found { return redact.Found{Start: s, End: e, Label
// comes back to each text at that text's own offsets; a text seen before
// isn't asked about again.
func TestFindJoinsTextsAndMapsBack(t *testing.T) {
- log := fakeInstall(t, "ok", false)
+ log, _ := gpuInstall(t, "ok")
texts := []string{"hi Alice", "nothing here", "Bob, Alice and Alice"}
got, err := Find(texts)
if err != nil {
@@ -82,7 +82,7 @@ func TestWithinCutsSpansAtTheTextsEnds(t *testing.T) {
// pf-serve that dies on the GPU is started again on the CPU, which the
// request then gets its answer from, and stays there; the status says why.
func TestGPUDeathMovesToCPU(t *testing.T) {
- log := fakeInstall(t, "gpudies", false)
+ log, gpu := gpuInstall(t, "gpudies")
got, err := Find([]string{"hi Alice"})
if err != nil {
t.Fatal(err)
@@ -90,7 +90,7 @@ func TestGPUDeathMovesToCPU(t *testing.T) {
if !reflect.DeepEqual(got, [][]redact.Found{{person(3, 8)}}) {
t.Fatalf("Find = %v", got)
}
- if starts := fakeLines(t, log, "start"); !reflect.DeepEqual(starts, []string{"start pf-serve MTL0", "start pf-serve CPU"}) {
+ if starts := fakeLines(t, log, "start"); !reflect.DeepEqual(starts, []string{gpu, "start pf-serve CPU"}) {
t.Fatalf("starts = %q", starts)
}
st := Now()
@@ -295,7 +295,7 @@ func TestFailedModelHoldsRequestsBackAtOnce(t *testing.T) {
// woke an idle one ~146 times a second (#3185). The CPU one after a GPU
// death too.
func TestServeStartsWithoutResidencyHeartbeat(t *testing.T) {
- log := fakeInstall(t, "gpudies", false)
+ log, _ := gpuInstall(t, "gpudies")
if _, err := Find([]string{"hi Alice"}); err != nil {
t.Fatal(err)
}
@@ -351,7 +351,7 @@ func TestWarm(t *testing.T) {
Warm()
wait("no failure", func(s Status) bool { return strings.Contains(s.Failed, "can't load noload") })
- log := fakeInstall(t, "ok", false)
+ log, _ := gpuInstall(t, "ok")
srv.failed = "before"
Warm()
wait("not running", func(s Status) bool { return s.Running && s.Device == "MTL0" && s.Failed == "" })