test: cover leading and trailing spaces in save names #1675
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/1682"
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 R0Y00/Xbox2Windows. Originally posted by ChazY11 on 2026-11-24T17:00:28Z.
What
x2w_save::valid_namerefuses a name whose first or last character is a space(
src/startup_stubs/save_store.h, thename.front() == ' 'andname.back() == ' 'clauses). The refused-name list intests/startup_gamesave_persist.cpphas"x."for the trailing dot but no case for either space rule, so both clausescan be deleted with the fixture still green.
How I found it
Removing either clause from
save_store.hand rebuildingstartup_gamesave_persistleaves the test passing. With thethree cases added, both removals now fail:
The mutations were run against the binary the fixture actually loads (
startup_gamesave_persist.exe, targetstartup_gamesave_persist), rebuilt each time, and reverted afterwards.Change
One line: three entries appended to the
bad[]list.The existing loop then asserts the refusal through every entry point, not just the predicate:
create_container,write_blob,read_blob,delete_blobanddelete_containerall have to answerStatus::bad_namefor each name.Tested
No behaviour change: the only file touched is the test.
Notes
Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-24T17:06:05Z.
Review: COMMENTED
Review for head
6c03c3c9(comment only, no approval).Verdict: no blocking findings. Looks like a clean Tier B (tests-only) candidate.
What I checked, line by line:
tests/startup_gamesave_persist.cpp: three strings appended to the existingbad[]list. No existing entry is removed or reordered, and no assertion is changed or weakened." x","x "," double-lead") go through the same seven checks as every other refused name (valid_nameplus the six store calls), so the coverage is wider than the commit message suggests.valid_nameonly."x "is not a device name, so the stem trim cannot catch it, and the front-space clause is the only thing that refuses" x"." double-lead"is two leading spaces plus text. The case is still useful (more than one leading space).Local checks on Linux (g++ 17,
-Wall -Wextra, TMPDIR pointed at an empty private dir):startup_gamesave_persist: ok, exit 0, no warnings. The private TMPDIR was empty afterwards, so no temp files leaked.git diff --checkagainst the merge base: clean.python3 -I tests/docs_links_check.py: self-test passed, 17 Markdown files and 363 links.python3 -I tests/bidi_controls_check.py: self-test passed, 1280 files, no bidirectional controls.Mutation checks I actually ran (each on a scratch checkout of
src/startup_stubs/save_store.h, then restored):name.front() == ' 'clause: the test fails (exit 1)." x"and" double-lead"are both reported as accepted, 14 failures in total.name.back() == ' 'clause: the test fails (exit 1)."x "is reported as accepted, 7 failures.So the PR claim holds: each clause was previously deletable with the test green, and now it is not.
Limits: Linux only. I did not run the Windows build, the
runtime_proxy.cppcallers, or the full ctest suite. The test uses its own temp store, so nothing outside it was touched.AI-assisted; commands listed were executed locally.
Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-24T17:14:03Z.
Review: COMMENTED
Verification review for commit
6c03c3c9d3b94c0915c3ea4a3a4810abde60a72f:Scope & Audit
tests/startup_gamesave_persist.cpp, +1/-1): appends" x","x ", and" double-lead"tobad[], exercising bothx2w_save::valid_nameand all six store refusal paths.Checks Executed
git diff --check origin/main...HEAD: clean.python3 -I tests/docs_links_check.py: passed (17 Markdown files, 363 links).python3 -I tests/bidi_controls_check.py: passed (1,280 files, no bidirectional controls).g++ -std=c++17 -Wall -Wextra -Isrc tests/startup_gamesave_persist.cpp+ run with privateTMPDIR:startup_gamesave_persist: ok, 0 warnings, 0 leaked files.--preset dev):startup_gamesave_persistbuilt (4.56s, configure1.77s);ctest --preset dev -R '^startup_gamesave_persist$' --no-tests=error: 1/1 passed (0.58s)./O2(--preset release):startup_gamesave_persistbuilt (3.93s, configure1.70s);ctest --preset release -R '^startup_gamesave_persist$' --no-tests=error: 1/1 passed (0.65s).name.front() == ' 'insrc/startup_stubs/save_store.h: failed with exit 1 (FAIL: x,FAIL: bad container name refused, etc.).name.back() == ' 'insrc/startup_stubs/save_store.h: failed with exit 1 (FAIL: x,FAIL: bad container name refused, etc.).Verdict: 0 P1, 0 P2. Clean Tier B merge candidate.
AI-assisted; commands listed were executed locally.