test(tools): compare quoted and resolved paths in the patch advisor test #10667
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/10667"
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-24T16:09:18Z.
What
patch_advisor_unit(tools/tests/test_suggest_patches.py, added by #8900) builds its fixture undertempfile.TemporaryDirectory()and compares the paths it built with whattools/suggest_patches.pyprints and passes on. The tool does two things to those paths: it renders the conversion line throughcommand_line(subprocess.list2cmdlineon Windows,shlex.joinelsewhere), which wraps a path containing a space in quotes, and it hands the relinker paths that went throughPath.resolve()(args.relinker.resolve()andconfined).test_uppercase_digest_and_conversion_optionsasserted the unquotedf"--sce-module-path {self.root}", andtest_verified_match_requires_explicit_applicationandtest_additional_executable_is_hashed_and_verifiedcomparerun.call_argswith the unresolved fixture paths. Neither case shows up on GitHub's runners, so #8900 merged with the test green; on a Windows account whose name contains a space, the first test fails with a longTEMP(--sce-module-path "C:\Users\Vincent Prange neu\...\tmpXXXX") and the other two fail with the account's default 8.3 short name (C:\Users\VINCEN~1\..., whichresolve()expands to the long name). A symlinked temporary directory fails the same way.prefix="patch advisor-", so every host takes the quoting branch instead of only the hosts whose temporary path happens to contain a space, andself.rootis resolved, astools/tests/test_check_compile.pyalready does for its holder directory. The expected--sce-module-pathtext comes from the tool's owncommand_line, so the assertion follows the platform rule the tool applies. The tool is unchanged: the quoted line is what a user pastes into a shell, and the resolved paths are what the relinker gets.--patches,--module-dir Media/Modulesand--executable picker/picker.binstay as they are: neitherlist2cmdlinenorshlex.quotechanges those values. The integration testcore/relinker/relinker/tests/test_patch_advisor.pyasserts no path from the advisor's output and is not touched.pr_overlap.py --branch test/patch-advisor-quoted-pathsreports no shared lines with open pull requests.Tested
Windows 11, Python 3.13.9 (Anaconda); no build, the test mocks
subprocess.run.python tools/tests/test_suggest_patches.pyonmain(c9b75825f3) and on this branch, each with three temporary roots:TEMP/TMPon a long path with a space (C:\Users\Vincent Prange neu\...):mainfailstest_uppercase_digest_and_conversion_options('--sce-module-path C:\...\tmpXXXX' not found in ... --sce-module-path "C:\...\tmpXXXX"); this branch passes all 24 tests.TEMP/TMPon the account's default 8.3 short name (C:\Users\VINCEN~1\...):mainfailstest_verified_match_requires_explicit_applicationandtest_additional_executable_is_hashed_and_verified(Lists differ: ['C:\Users\Vincent Prange neu\...'] != ['C:\Users\VINCEN~1\...']); this branch passes all 24 tests.TEMP/TMPon a plain path without a space:mainand this branch pass all 24 tests.python tools/check_conventions.py --base upstream/mainwith this title and description passed.cteston Ubuntu, Windows and macOS runners.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-24T16:14:03Z.
Review: COMMENTED
Reviewed exact head
76008e99b9bf02bcbcbec2ed0d3c5380204cde2b. The test now exercises a path with spaces on every platform, resolves the fixture path to match the tool, and derives the displayed--sce-module-pathfragment with the samecommand_linehelper. I ranpython3 tools/tests/test_suggest_patches.pylocally (24/24 passed), conventions and diff checks pass, and the current-main merge tree is clean. Hosted Ubuntu and ASan relinker checks pass; Windows and macOS relinker jobs are still running, and product jobs are skipped by policy. No blocking issue found in the diff; I’ll recheck the remaining hosted matrix before approval.Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-24T16:19:52Z.
Review: APPROVED
Reviewed exact head
76008e99b9. The test exercises a CLI path containing spaces while checking both the quoted argument and its resolved target. Local verification passed: python3 tools/tests/test_suggest_patches.py (24/24), python3 tools/check_conventions.py --base upstream/main, and git diff --check; the merge tree against current main is clean. Hosted eligibility, conventions, intake, labels, and all four relinker platform/sanitizer jobs passed. Product builds were skipped by repository policy.Imported from boykopovar/AnyPS5. Originally posted by THEMANnt on 2026-10-24T16:45:43Z.
Review: APPROVED
Reviewed 76008e99b9bf against pinned base dca72a82dadd. No actionable findings in this focused review.
Source review
The test fixture now always contains a space and resolves its root before constructing expected paths. This aligns subprocess expectations with the advisor's resolved paths while preserving separate temporary fixtures and cleanup. The conversion-output assertion uses the same platform formatter as production; the remaining option, argument, hash, rejection and exit-code assertions are preserved. Production code is unchanged, and there are no local reviewer amendments. This checks consistent option rendering, without independently proving the formatter's quoting correctness.
Validation
tools/tests/test_suggest_patches.py: baseline, pristine PR and candidate each had 24 passed, 0 skipped; 24 total.relinker-asan, the named Ubuntu/Windows g++ and both macOS clang++ relinker jobs, pluseligibility,intake,labelsandconventions.windows,linux,register-contextandwrite-watchwere skipped; those are not passing product tests.Scope
Local validation executes the Python advisor with the relinker subprocess mocked. POSIX and the author's Python 3.13.9/8.3-path scenarios were not independently reproduced; full application behavior was not tested.