From 8cb130c6f04d8e3ec5416b49f0cec5d4cb2cbd33 Mon Sep 17 00:00:00 2001 From: Richie Cahill Date: Fri, 11 Sep 2026 19:27:01 -0400 Subject: [PATCH] fix(overlays): stabilize timing-sensitive tests --- overlays/test-exclusions.nix | 27 ++++++++++++++++++++------- 1 file changed, 20 insertions(+), 7 deletions(-) diff --git a/overlays/test-exclusions.nix b/overlays/test-exclusions.nix index 3fa2507..0773771 100644 --- a/overlays/test-exclusions.nix +++ b/overlays/test-exclusions.nix @@ -4,10 +4,10 @@ # nixpkgs binary cache cannot be used and upstream test suites run locally. # The jeeves builder uses /tmp/nix-builds so filesystem tests run on tmpfs # instead of ZFS with normalization=formD and utf8only=on; those tests remain -# enabled. The remaining workarounds cover UDP readiness and nested-worker -# scheduling races, plus architecture-dependent floating-point differences -# whose risk we accept for our workloads. Keep these exceptions visible until -# their causes are fixed. +# enabled. The remaining workarounds cover UDP readiness, nested-worker +# scheduling races, and mismatched timeout clocks, plus architecture-dependent +# floating-point differences whose risk we accept for our workloads. Keep these +# exceptions visible until their causes are fixed. _final: prev: { gnutls = prev.gnutls.overrideAttrs (old: { # This test uses a fixed four-second sleep instead of checking UDP @@ -19,10 +19,23 @@ _final: prev: { pythonPackagesExtensions = prev.pythonPackagesExtensions ++ [ (_pythonFinal: pythonPrev: { + backrefs = pythonPrev.backrefs.overridePythonAttrs (old: { + # regex measures its timeout in process CPU time, while this test used + # wall time and could miss the timeout when a busy builder descheduled it. + postPatch = (old.postPatch or "") + '' + substituteInPlace tests/test_bregex.py \ + --replace-fail "time.time()" "time.process_time()" + ''; + }); + pytest-xdist = pythonPrev.pytest-xdist.overridePythonAttrs (old: { - # Its acceptance tests start nested worker pools. Limit the outer pool - # so deliberately crashing inner workers do not race under heavy load. - preCheck = builtins.replaceStrings [ "--numprocesses=$NIX_BUILD_CORES" ] [ "--numprocesses=8" ] ( + # The suite exercises its own worker pools. Run the outer suite with one + # worker and allow inner workers more time on heavily loaded builders. + postPatch = (old.postPatch or "") + '' + substituteInPlace testing/test_remote.py \ + --replace-fail "WAIT_TIMEOUT = 10.0" "WAIT_TIMEOUT = 60.0" + ''; + preCheck = builtins.replaceStrings [ "--numprocesses=$NIX_BUILD_CORES" ] [ "--numprocesses=1" ] ( old.preCheck or "" ); });