Skip to content

The ultimate harness for coding agents and beyond. All your agents. All your machines. One command center. Start with code, then follow your curiosity and build across disciplines: CAD, circuits, robots, games and music.

Use validated Desktop test capacity on larger hosts (#643)

Deeeb2f0d6a40fe
diff --git a/docs/validation-and-release.md b/docs/validation-and-release.md
index 07ba6cb76..7a5396a5e 100644
--- a/docs/validation-and-release.md
+++ b/docs/validation-and-release.md
@@ -114,8 +114,8 @@ checks can run together if memory/disk allow it. Put dependent operations in sep
plans. A scoped desktop test command should name its affected files and start with
`flutter test --no-pub --concurrency=2 --timeout=60s ...`. Two workers are a starting
point, not a fixed cap for a full suite. Choose and record a worker count that fits
-the host and other running checks: eight VM workers were validated on a 16-core,
-64 GiB Mac in the [baseline repair](performance/2026-10-02-desktop-baseline-repair.md).
+the host and other running checks. The full-suite command below selects more
+workers on larger hosts; use an explicit lower count when other checks are active.
Chrome and native integration tests ignore Flutter's concurrency option.
Tests legitimately needing longer can declare that explicitly. Start a necessary
broad desktop run early, with
@@ -126,8 +126,9 @@ not permission to turn failures into success.
For Desktop VM tests, `make desktop-test` provides a bounded full-suite command.
Use `make desktop-test ARGS="test/affected_test.dart --workers 2"` for named files,
or add `--flutter /path/to/flutter` when the pinned SDK is not on `PATH`.
-It runs the selected files once, with half the host's logical CPUs capped at eight
-workers by default; lower `--workers` when memory or other running checks need it.
+It runs the selected files once. Hosts with at least 16 logical CPUs use three
+quarters of them, capped at 12 workers; smaller hosts use half their logical CPUs
+(at least one worker). Lower `--workers` when memory or other running checks need it.
Its `--timeout 900` budget includes the initial test process and any recovery.
Dependencies must already be installed. Browser files under `test/web/` and native
integration checks remain separate; this command does not validate those platforms.
diff --git a/scripts/test-desktop.py b/scripts/test-desktop.py
index 2f8b88dc7..da9f2068d 100644
--- a/scripts/test-desktop.py
+++ b/scripts/test-desktop.py
@@ -22,6 +22,14 @@ SPEC.loader.exec_module(validation)
LOADER_ERROR = "Unable to connect to flutter_tester process: WebSocketException: Invalid WebSocket upgrade request"
+def default_workers():
+ cpus = os.cpu_count() or 2
+ # Twelve workers improved the complete suite on a 16-CPU host. Leave a
+ # quarter of large hosts free; retain the existing share on smaller hosts.
+ share = cpus * 3 // 4 if cpus >= 16 else cpus // 2
+ return min(12, max(1, share))
+
+
def summarize(log, selected):
"""Fail closed on missing files/cases, hidden errors and incomplete reporters."""
suites, tests, ends, errors, counts = {}, {}, {}, {}, {}
@@ -144,7 +152,7 @@ def main(argv=None):
parser = argparse.ArgumentParser(description=__doc__)
parser.add_argument("files", nargs="*", help="desktop-relative test/foo_test.dart paths; default: every VM test")
parser.add_argument("--flutter", default="flutter", help="Flutter executable (dependencies must already be installed)")
- parser.add_argument("--workers", type=int, default=min(8, max(1, (os.cpu_count() or 2) // 2)))
+ parser.add_argument("--workers", type=int, default=default_workers())
parser.add_argument("--timeout", type=float, default=900, help="total attempt budget in seconds, including recovery (default: 900)")
parser.add_argument("--no-loader-retry", action="store_true", help="retain the first failure without recovery")
args = parser.parse_args(argv)
diff --git a/scripts/tests/test_desktop_tests.py b/scripts/tests/test_desktop_tests.py
index 1a20bd3ca..2fc7dbb0d 100644
--- a/scripts/tests/test_desktop_tests.py
+++ b/scripts/tests/test_desktop_tests.py
@@ -7,6 +7,7 @@ import subprocess
import sys
import tempfile
import unittest
+from unittest import mock
from desktop_vm_fixture import suite
@@ -16,6 +17,13 @@ driver = importlib.util.module_from_spec(spec)
spec.loader.exec_module(driver)
+class WorkerCountTests(unittest.TestCase):
+ def test_large_host_capacity_keeps_small_host_limits_and_an_upper_bound(self):
+ for cpus, expected in ((None, 1), (1, 1), (2, 1), (8, 4), (15, 7), (16, 12), (64, 12)):
+ with self.subTest(cpus=cpus), mock.patch.object(driver.os, "cpu_count", return_value=cpus):
+ self.assertEqual(driver.default_workers(), expected)
+
+
class ReporterTests(unittest.TestCase):
def setUp(self):
self.tmp = tempfile.TemporaryDirectory()