diff --git a/pkgs/mcpx/internal/buildcheck/checkphase_test.go b/pkgs/mcpx/internal/buildcheck/checkphase_test.go index d91323cf94..d50dde2b54 100644 --- a/pkgs/mcpx/internal/buildcheck/checkphase_test.go +++ b/pkgs/mcpx/internal/buildcheck/checkphase_test.go @@ -83,8 +83,8 @@ func TestCheckPhaseTestsEveryPackageWithTests(t *testing.T) { if !strings.Contains(nix, derivedList) { t.Fatalf("checkPhase must compute its packages with\n %s\nso new packages are tested by default", derivedList) } - if !strings.Contains(nix, "go test -timeout 30m $pkgs") { - t.Fatal("checkPhase must run `go test -timeout 30m $pkgs` on the computed list (the 30m per-package budget keeps internal/e2e from hitting Go's 10m default on small machines, dezren39/nix#510). This exact line is also the rewrite pattern for dezren39/nix's darwin -skip override (#418): changing it requires updating that pattern in the same change set.") + if !strings.Contains(nix, "goTestCmd =") || !strings.Contains(nix, `"-timeout 30m "`) || !strings.Contains(nix, `"$pkgs"`) || !strings.Contains(nix, "${goTestCmd}") { + t.Fatal("checkPhase must run the computed list with the 30m per-package budget (it keeps internal/e2e from hitting Go's 10m default on small machines, dezren39/nix#510): package.nix constructs the command as goTestCmd — `go test ` + platform flags + `-timeout 30m ` + `$pkgs` — and interpolates ${goTestCmd} into the phase. The platform adaptations (Linux -p 1, darwin takeover-test -skip, #4798) are part of that construction; before #4798 the literal `go test -timeout 30m $pkgs` line was also dezren39/nix's rewrite pattern (#418), which is why this guard pinned the exact line.") } // A hand-written package list next to the computed one would silently // narrow it again. diff --git a/pkgs/mcpx/package.nix b/pkgs/mcpx/package.nix index 32e5583c8a..b14307d849 100644 --- a/pkgs/mcpx/package.nix +++ b/pkgs/mcpx/package.nix @@ -19,6 +19,7 @@ # (docs/git-discovery.md). Kept on the wrapper's PATH so those still # resolve; the container image leaves it out. git, + stdenv, makeBinaryWrapper, installShellFiles, }: @@ -107,13 +108,13 @@ buildGo127Module { # so a new one is tested by default, minus checkExclude below. Each entry in # checkExclude needs a comment on the line above it saying why it cannot run # in the sandbox; internal/buildcheck enforces both. - # The exact `go test -timeout 30m $pkgs` line in the checkPhase below is - # load-bearing downstream (#418): dezren39/nix's flake.nix rewrites that - # line to add its darwin takeover/handoff -skip list. That rewrite now - # fails loudly there (a throw plus the mcpx-darwin-skip flake check and a - # CI eval step) when the line stops matching, but changing the line here - # still requires updating the pattern in dezren39/nix's flake.nix in the - # same change set, or its next mcpx-src pin bump will fail evaluation. + # The platform adaptations of the test command (Linux -p 1, darwin + # -skip list) live in this package since 2026-11-03 (#4798). They were + # previously applied downstream by dezren39/nix rewriting this phase + # (#418's load-bearing-line coupling, with its throw guards and the + # mcpx-darwin-skip flake check there); constructing the command here + # dissolves that coupling — dezren39/nix now consumes the fork's mcpx + # build unmodified. doCheck = true; # The runner and e2e suites spawn real scripts, so they get the same runtimes # the wrapper pins. @@ -163,6 +164,43 @@ buildGo127Module { # #2896 fix lands. "examples" ]; + # The Linux-only takeover/handoff tests (#418): they exercise + # /proc and systemd-mainpid mechanics that do not exist on + # darwin, so the darwin check run skips them by name. + darwinSkip = "^(${ + lib.concatStringsSep "|" [ + "TestACallInFlightAtATakeoverIsAnsweredAndItsConnectionMovesOn" + "TestAnIdleKeepAliveConnectionSurvivesATakeover" + "TestClientHandoffCommitsOnlyWhenActivated" + "TestClientLeaseSurvivesDaemonTakeover" + "TestDetachedChildKeepsItsPipesAndAdoptionResumesThem" + "TestDetachRefusesWhileACallIsInFlight" + "TestHandoffDoesNotSplitAFrameAcrossTheTwoProcesses" + "TestKeepAliveCallersLoseNoCallsAcrossARealTakeover" + "TestTakeoverKeepsTheChildAndTheListener" + "TestTakeoverLosesNoCallsWhileAClientKeepsCalling" + "TestTakeoverRestartsAChangedServerAndKeepsTheRest" + "TestUpgradeKeepsTheChildAndHandsMainPIDToTheSuccessor" + "TestACallInFlightAtTheHandoverIsAnsweredByTheOldDaemon" + "TestAClientLeaseSurvivesADaemonTakeover" + "TestAnIdleConnectionSurvivesATakeoverInProcess" + "TestCallsIssuedDuringATakeoverNeverFail" + "TestHandoffRecordsTheIdentityAPoolWasMadeWith" + "TestKeepAliveCallersLoseNoCallsAcrossATakeover" + "TestRegistryHandoffKeepsTheChildAcrossTheSuccessor" + "TestRegistryHandoffThatIsNotCommittedRestoresTheChild" + ] + })$"; + # Linux: -p 1 serialises the package tests — run concurrently, + # they can starve the timing-sensitive retention/reopen test + # (400ms TTL, 200ms margin) on a loaded builder. Darwin: the + # skip list above. Everywhere else: the plain command. + goTestCmd = + "go test " + + lib.optionalString stdenv.hostPlatform.isLinux "-p 1 " + + "-timeout 30m " + + lib.optionalString stdenv.hostPlatform.isDarwin "-skip='${darwinSkip}' " + + "$pkgs"; in '' runHook preCheck @@ -179,7 +217,7 @@ buildGo127Module { # depend on it (dezren39/nix#510). The timeout is per package, so one # explicit 30m budget covers e2e without sharding the suite; the # other packages finish far under it. - go test -timeout 30m $pkgs + ${goTestCmd} runHook postCheck '';