diff --git a/tools/mcp/README.md b/tools/mcp/README.md index 5ae9cc37d8..d41fc8b08f 100644 --- a/tools/mcp/README.md +++ b/tools/mcp/README.md @@ -579,9 +579,10 @@ The serial tests run after the rest, one at a time with nothing else running, on its own: the ones `sweep.json` marks `exclusive`, and the ones the history marks serial. A test that fails while others run runs again in that phase, alone, in a new app on the datadir it failed on: one that passes then counts as passed, shows as `passed alone`, and is marked serial in the history, so later sweeps run it alone from the -start, until `--forget NAME` clears the mark. A test that runs out of time is interrupted, as Ctrl-C would, so its -own cleanup closes the apps it started (on Windows its process tree is ended), and a test the runner could not run -is recorded as an error, so a run that leaves a test without a result never exits 0. +start, until `--forget NAME` clears the mark (`--forget all` clears every mark). A test that runs out of time is +interrupted, as Ctrl-C would, so its own cleanup closes the apps it started (on Windows its process tree is ended), +and a test the runner could not run is recorded as an error, so a run that leaves a test without a result never +exits 0. A passing run's folder is deleted as soon as it passes. A failed run's folder is kept, with a copy of the app's log from the job's datadir, also when the test then passes alone, so the log says why it failed beside the others; diff --git a/tools/mcp/TESTS.md b/tools/mcp/TESTS.md index ec9e1798f5..1d432a1989 100644 --- a/tools/mcp/TESTS.md +++ b/tools/mcp/TESTS.md @@ -201,7 +201,7 @@ The serial tests run after the rest, one at a time with nothing else running, on run again in that phase, alone, in a new app on the data folder it failed on, so that a failure that follows from what an earlier test left in the folder fails again, and one that follows from the load passes. A test that passes alone counts as passed, the summary lists it as `passed alone`, and the history marks it serial, so later sweeps run it alone from -the start. The mark stays until `--forget NAME` clears it. +the start. The mark stays until `--forget NAME` clears it, or `--forget all` clears every mark. A test passes when its process exits 0. A failed setup or launch, a run past its time limit (900 s unless the entry sets `timeout_s`), or an error running the test fails it, and so does a test left without a result. On macOS diff --git a/tools/mcp/run_sweep.py b/tools/mcp/run_sweep.py index cba9590eb0..68385327be 100755 --- a/tools/mcp/run_sweep.py +++ b/tools/mcp/run_sweep.py @@ -3,7 +3,7 @@ another in one app on one data folder. tools/mcp/run_sweep.py [--bin PATH] [-j N] [--only NAME ...] [--skip NAME ...] [--out DIR] [--history FILE] - [--keep] [--headless] [--wayland] [--shuffle [SEED]] [--list] [--forget NAME ...] + [--keep] [--headless] [--wayland] [--shuffle [SEED]] [--list] [--forget NAME ... | all] The tests are the test_*.py files in tools/mcp; a replay, such as smoke_test.json, is not one. sweep.json lists each test with what it needs, and a test it does not list, or an entry whose file is not a test, stops the run before @@ -25,7 +25,8 @@ The serial tests run after the rest, one at a time with nothing else running, on its own: those sweep.json marks exclusive, and those the history marks serial. A test that fails while others run runs again in that phase, alone, in a new app on the data folder it failed on, so that a failure that follows from what an earlier test left fails again and one that follows from the load passes. A test that passes alone counts as -passed, and the history marks it serial, so later sweeps run it alone from the start; --forget NAME clears the mark. +passed, and the history marks it serial, so later sweeps run it alone from the start; --forget NAME clears the mark, +and --forget all every mark. A passing run's folder is deleted as soon as it passes. A failed run's folder is kept with a copy of the app's log from its job's data folder, also when the test then passes alone; the data folder of a job one of whose tests @@ -77,6 +78,7 @@ GONE_TIMEOUT_S = 60 # how long the app's processes have to end after its stop b # must stay within MAX_PATH (260), or the copy stops and the app opens its Setup Wizard. MAX_OUT_WINDOWS = 80 SERIAL_JOB = "serial" +FORGET_ALL = "all" # --forget's name for every test's serial mark NEW_SEED = object() # --shuffle given without a seed: parse_args() picks one @@ -518,8 +520,8 @@ def parse_args(argv=None): ap.add_argument("--keep", action="store_true", help="keep every test's folder and every job's data folder, not only those of failed tests") ap.add_argument("--forget", nargs="+", metavar="NAME", - help="clear these tests' serial marks in the history, so the next sweep runs them among the " - "others, and exit") + help="clear these tests' serial marks in the history, or every test's with 'all', so the next " + "sweep runs them among the others, and exit") ap.add_argument("--headless", action="store_true", help="run each app on a private compositor instead of on the desktop (Linux)") ap.add_argument("--wayland", action="store_true", @@ -597,7 +599,8 @@ def main(argv=None, mcp_dir=MCP_DIR): problems = option_problems(a, sys.platform) manifest = load_manifest(os.path.join(mcp_dir, "sweep.json")) problems += manifest_problems(manifest, discover(mcp_dir), mcp_dir) - problems += [f"{n}: no such test" for n in (a.only or []) + a.skip + (a.forget or []) if n not in manifest] + forget = [n for n in a.forget or [] if n != FORGET_ALL] + problems += [f"{n}: no such test" for n in (a.only or []) + a.skip + forget if n not in manifest] if not (a.list or a.forget): # neither launches anything, so neither needs a display problems += session_problems(a, os.environ, sys.platform) if problems: @@ -605,7 +608,11 @@ def main(argv=None, mcp_dir=MCP_DIR): return 2 history = read_history(a.history) if a.forget: - for n in a.forget: + if FORGET_ALL in a.forget: + forget = sorted(history["serial"]) + if not forget: + print("no test has a serial mark") + for n in forget: print(f"{n}: serial mark cleared" if history["serial"].pop(n, None) else f"{n}: had no serial mark") write_history(a.history, history) return 0 diff --git a/tools/mcp/test-entries/runtime.md b/tools/mcp/test-entries/runtime.md index 37d4e207c6..b833bbd458 100644 --- a/tools/mcp/test-entries/runtime.md +++ b/tools/mcp/test-entries/runtime.md @@ -90,7 +90,7 @@ in [TESTS.md](../TESTS.md). **Strength:** Strong — the functions it covers are checked by exact value and error text, and the test refuses to run with its asserts off. It covers the attach-and-call half of `orca_mcp.py` and the seeding of a data folder, not the rest of launch, stop or run-replay. ## `test_run_sweep` -`test_run_sweep.py` · Python, 27 checks (assert-based) +`test_run_sweep.py` · Python, 28 checks (assert-based) **Tests:** The building blocks of `run_sweep.py`, without the app (`launch: none`), and its whole run, `main()`, on two stand-in sweeps: one of small scripts that launch nothing, and one whose scripts run in a stand-in app that a @@ -166,7 +166,7 @@ With no history the pool keeps the manifest's order, so `test_slow` and `test_lo | 2 | `main(["--list", ...])` | 0 | the pool lists `test_broken`, which has no time, then `test_slow`; the serial phase lists `test_load` with its mark and `test_quick` with its `why` | | 3 | `main(["--list", "--shuffle", "7", ...])`, twice, then `main(["--list", "--shuffle", ...])` | 0 | the first line is `shuffled with seed 7`, the next two are `test_broken` and `test_slow` in either order, then `test_load` and `test_quick`; the second run prints the same; without a seed the first line names the seed picked | | 4 | `main(["-j", "2", ...])`, a new `--out` | 1 | `test_load` runs once, in the serial phase, and passes. The folders of `test_slow`, `test_load` and `test_quick` are gone; `test_broken`'s folder is kept with its `test.log` and a copy of `broken.log`, and so is its job's data folder; the other jobs' data folders are gone. The history keeps `test_load`'s mark, since it passed alone | -| 5 | `main(["--forget", "test_load", ...])`, then `main(["--forget", "test_nobody", ...])` | 0, then 2 | the history has no marks and its times are as after 4; nothing runs, and the `--out` given is not made; a test `sweep.json` does not list is refused | +| 5 | `main(["--forget", "test_load", ...])`, then `main(["--forget", "test_nobody", ...])` | 0, then 2 | the history has no marks and its times are as after 4; nothing runs, and the `--out` given is not made; a test `sweep.json` does not list is refused. Then, with marks on `test_load` and `test_slow` written into the history, `main(["--forget", "all", ...])` twice: 0 both times; both marks go and the times stay, and the second says no test has a serial mark | | 6 | `main(["--list", ...])` | 0 | `test_load` is in the pool again, third, and no line names a serial mark | | 7 | `main(["-j", "2", ...])`, a new `--out` | 1 | `test_load`, after `test_broken` on its job and beside `test_slow`, fails, then passes alone: its records are `pool` 1 and `alone` 0, the folder of its failed run is kept with its `test.log` and that of its passing run is gone, and the history marks it serial again | diff --git a/tools/mcp/test_run_sweep.py b/tools/mcp/test_run_sweep.py index df2239bf7a..77e8888f87 100755 --- a/tools/mcp/test_run_sweep.py +++ b/tools/mcp/test_run_sweep.py @@ -482,6 +482,16 @@ def check_stand_in_sweep(): assert code == 2, (code, printed) ok("--forget clears a serial mark and runs nothing, and refuses a test sweep.json does not list") + marks = {"test_load": "2026-01-01", "test_slow": "2026-01-02"} + run_sweep.write_history(history, {"times": times, "serial": marks}) + code, printed = sweep(mcp_dir, "--forget", "all", *common) + h = run_sweep.read_history(history) + assert code == 0 and h == {"times": times, "serial": {}}, (code, printed, h) + assert "test_load: serial mark cleared" in printed and "test_slow: serial mark cleared" in printed, printed + code, printed = sweep(mcp_dir, "--forget", "all", *common) + assert code == 0 and "no test has a serial mark" in printed, (code, printed) + ok("--forget all clears every serial mark and keeps the times, and says when there is none") + code, printed = sweep(mcp_dir, "--list", *common) assert code == 0 and [line.split()[0] for line in printed.splitlines()][:3] == \ ["test_broken", "test_slow", "test_load"] and "serial since" not in printed, printed