test(tools): run debt_split in process and commit only where tests need it #10596
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/10596"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from boykopovar/AnyPS5. Originally posted by roboterspinne on 2026-10-24T11:54:45Z.
What
tools/tests/test_debt_split.pystarteddebt_split.pyas a subprocess for each of the 15 splits made through itssplit()helper and committed the index insetUpand after every split, although only the rebase paths (rebase()andtest_resolve_refuses_an_entry_main_changed_too) andtest_resolve_needs_a_conflictdepend on a commit. The test is the fourth slowest of the relinker suite on the Windows runner: 34.18 s in therelinker (windows-latest, g++)job of #10390's Build run, where CONTRIBUTING asks each test to finish in 30 s.split()now callsdebt_split.main(["split"])in process: it changes into the fixture directory, hands the tool a sink for stdout and stderr so the tool's stream reconfiguration and output touch nothing of the test process, and restores the directory and both streams infinally. A failing split raisesSystemExit, which unittest records as an error.add/commitpair moved fromsetUpandsplit()into acommit()helper. The rebase paths call it before creating the change branch and after the split, so the rebases see the same two commits as before, andtest_resolve_needs_a_conflictcalls it once soresolvestill runs on a committed clean checkout.gitwrapper passes-c maintenance.auto=false, so the commits (23 from the wrapper and 5 thatrebase --continuemakes) skip thegit maintenance run --autochild each one spawned (44 per run onmain).test_split_again_appends_to_existing_filesstill runs one split through the command line and checks its stdout, and everyresolvestays a subprocess.debt_split.pyis unchanged, and the git commands it runs are identical before and after (strace: 24rev-parse, 21cat-file, 8ls-files, 5addin both).git merge-tree).Tested
Ubuntu 24.04 x86_64, Python 3.13, git 2.43; no title or homebrew involved.
python3 tools/tests/test_debt_split.py: 16 tests OK. Wall time of three runs, same machine:main3.07 / 2.90 / 3.02 s, this change 1.76 / 1.63 / 1.53 s. Processes started (successfulexecveunderstrace -f): 268 → 177, of whichdebt_split.pyinterpreter starts 24 → 9.ctest --test-dir build-relinker -j4(relinker-only Release build): 241/241 passed;debt_splitalone 1.78 s (2.11 s under-j4).ctest --test-dir build-relinker -R "^debt_split$":main21.36 / 19.79 / 19.86 s (three runs), this change 13.45 s (one run).debt_split.py(link rewriting off, index note dropped, title changed, blank lines dropped, BOM handling removed in two places, index not rewritten, CRLF output, continuation blanks dropped, empty debt file kept, nothing moved) fail the same tests with themaintest file and with this one; two of them are caught by neither.python3 tools/check_conventions.py --base upstream/mainwith this title and description passed.Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file.mdfiles or images added to the repository (attach them to this PR)Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-24T12:02:00Z.
Review: APPROVED
Reviewed the exact head
dad627e00c6515f82a33971fe1dc59b21996ad09. The split tests now run in-process with the fixture directory, stdout and stderr restored infinally; the one CLI split case remains a subprocess to cover command output. Commit creation remains only in the rebase/conflict cases that require a committed index, andmaintenance.auto=falseis scoped to the test's Git wrapper.I ran the focused test file against an isolated copy of the PR head: 16 tests passed in 1.22 seconds. Hosted conventions, eligibility, intake and labels pass; the relinker CTest matrix passed on Ubuntu, macOS arm64, macOS x86_64 and Windows, and the ASan job passed. The full Linux/Windows product jobs were skipped by the workflow gate. The PR's reported Windows timing and process-count measurements are author-provided; I did not reproduce those benchmarks.
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-24T12:29:25Z.
Review: APPROVED
Reviewed head
dad627e00c. The in-process split helper redirects and restores stdout/stderr and cwd in a finally block, while commit setup now remains only on the rebase/conflict paths that require committed history. The explicit CLI test still exercises the command-line path. Hosted eligibility, conventions, intake, labels, Linux/Windows/macOS relinker matrix, and relinker ASan all pass; product builds are skipped for this tools-only change. The detailed Linux and Windows unit/CTest timing and mutation results in the description are author-reported; I did not reproduce them locally.Imported from boykopovar/AnyPS5. Originally posted by THEMANnt on 2026-10-24T14:04:47Z.
Review: APPROVED
Reviewed head
dad627e00c6515f82a33971fe1dc59b21996ad09against pinned comparison basea5f13b3fd402749ee3ae57a925c6e1c543977ca9. The verified author scope changes onlytools/tests/test_debt_split.py.The
split()helper now executesdebt_split.main(["split"])in process. Its temporary sink absorbs output and stream reconfiguration, whilefinallyrestores the working directory and original streams. Split failures still reach unittest as errors. Each test retains a separate temporary repository, and explicit commits preserve the history required by rebase and clean-checkout cases. Content, link, BOM, line-ending, ordering, and conflict assertions remain. One split still checks CLI output, and every resolve invocation remains a subprocess.The controller-recorded local execution of
tools/tests/test_debt_split.pypassed 16 tests in each baseline, pristine-author, and candidate run on Windows with Python 3.11.9. Candidate tests also passed against pinned baseline production code, satisfying the tests-only compatibility control; this establishes compatibility, without establishing regression or mutation sensitivity. The recorded whitespace and repository-conventions checks passed.GitHub-reported effective checks succeeded for
relinker (windows-latest, g++),relinker (ubuntu-latest, g++), both listed macOS relinker jobs,relinker-asan,eligibility,intake,labels, andconventions.linux,windows,register-context, andwrite-watchwere skipped. The author's broader benchmarks, traces, mutation experiments, and build results remain author-reported; local verification covered the selected Python suite. No actionable findings in this focused review.