Repository navigation
fix(tools): end the CTest index file with a newline so the Windows pull request job runs the last selected guest test - #14413
Merged
oneandonlydean merged 1 commit intoNov 2, 2026
Conversation
…ll request job runs the last selected guest test
MarcZX10
reviewed
Nov 1, 2026
MarcZX10
left a comment
Contributor
There was a problem hiding this comment.
Reviewed — no blocking findings
The fix is correct: CTest reads the -I file with a getline sized to the file length, so the last index is dropped unless the file ends in a newline, and the change adds that newline with no other behaviour change.
What I ran
- Exact head
1047f3d0e5673d01ff07ea2e7eb7241c47e25daf, baseba627802e2210187d417deb64c8f2fed8e33011f. - Environment: Linux,
/usr/bin/python33.11.2, ctest 3.25.1 (/usr/bin/ctest), no build. - Precheck:
python3 tools/pr_precheck.py --repo boykopovar/AnyPS5 --pr 14413 --output-dir /dev/shm/reviewer-run/precheck/14413 - CTest behaviour, on a 12-test CTestTestfile with no build: a
-Ifile with the index list and no terminator, one with\n, and one with\r\n:
none: 100% tests passed, 0 tests failed out of 11
lf: 100% tests passed, 0 tests failed out of 12
crlf: 100% tests passed, 0 tests failed out of 12
- CTest source at Kitware commit
8e91f7aa9bdf7eb8f8b009acda1576049881bc4f,Source/CTest/cmCTestTestHandler.cxxlines 2254-2256 (FileLength,getline(buff.get(), filelen)), read withgh api.
Results
Precheck report, checks table, unedited (/dev/shm/reviewer-run/precheck/14413/report.md):
| Check | Status | Command / reason |
|---|---|---|
| build_and_compile | not_applicable | The precheck deliberately does not configure, build, or compile AnyPS5. |
| diff_check | passed | git diff --check ba627802e2210187d417deb64c8f2fed8e33011f...1047f3d0e5673d01ff07ea2e7eb7241c47e25daf |
| conventions_and_pr_template | passed | /usr/bin/python3 tools/check_conventions.py --base ba627802e2210187d417deb64c8f2fed8e33011f --head 1047f3d0e5673d01ff07ea2e7eb7241c47e25daf --title fix(tools): end the CTest index file with a newline so the Windows pull request job runs the last selected guest test --body /dev/shm/reviewer-run/precheck/14413/pr-body.md |
| changed_export_abi_audit | not_applicable | No changed source or public header under core/libs/prx. |
| python_syntax | passed | /usr/bin/python3 -m py_compile tools/build_changed_guest_tests.py |
| unit:tools/tests/test_build_changed_guest_tests.py | passed | /usr/bin/python3 -m unittest tools.tests.test_build_changed_guest_tests |
| python_test_registration | passed | /usr/bin/python3 tools/check_test_registration.py --scripts |
| live_dependency_and_mergeability_check | passed | /usr/bin/python3 /marc/AnyPS5/tools/pr_stack_check.py 14413 --repo boykopovar/AnyPS5 --output-dir /dev/shm/reviewer-run/precheck/14413/stack |
| build_dependent_cpp_tests | not_applicable | No C/C++ implementation or test files changed. |
| test_quality_heuristics | failed | /usr/bin/python3 /dev/shm/reviewer-run/precheck/14413/head-1047f3d0e567-f72de141/tools/pr_test_quality.py --root /dev/shm/reviewer-run/precheck/14413/head-1047f3d0e567-f72de141 --json tools/build_changed_guest_tests.py tools/tests/test_build_changed_guest_tests.py |
| negative_controls | passed | A pass means every candidate failed by assertion on base; a failure means at least one did not discriminate or could not run. See per-test results. |
Hosted at review time: windows in progress; macOS clang jobs queued; relinker, conventions and labels passed.
Negative control
The precheck's negative control for test_build_changed_guest_tests.py failed on base by assertion (rc 1), so the updated tests discriminate the change.
Findings
Blocking: none.
Non-blocking:
- The PR says CTest 4.3.1 selects the same tests for
\nand\r\n. I checked only ctest 3.25.1 on Linux. The Windowswrite_textpath, which emits\r\n, was not run. - The new test runs the real
ctestfrom the host PATH, so it needs ctest available wherever the unit tests run.
Sources
- CTest
-Iread, Kitware commit: https://github.com/Kitware/CMake/blob/8e91f7aa9bdf7eb8f8b009acda1576049881bc4f/Source/CTest/cmCTestTestHandler.cxx#L2252-L2258
Not verified
- ctest 4.3.1 and the Windows
\r\npath were not run. - The Windows CI job was not complete at review time.
12 tasks done
Contributor
12 tasks done
12 tasks done
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
The Windows pull request job runs the changed guest tests through
tools/build_changed_guest_tests.py(.github/workflows/build.yml:710), which writes the selected CTest indices to a file and passes it asctest -I <file>.run()writes that file as"0,0,0," + indiceswithout a line terminator (tools/build_changed_guest_tests.py:122on 26fa121). CTest reads an-Ifile withfin.getline(buff.get(), filelen)incmCTestTestHandler::SetTestsToRunInformation(Source/CTest/cmCTestTestHandler.cxx:2256), wherefilelenis the file size;istream::getline(s, n)stores at mostn - 1characters, so without a terminator the last character of the file is lost. The last selected index is then dropped, or loses its last digit and selects an unrelated test, and a selection of one single-digit index runs nothing, which--no-tests=errorturns into a failed job. Windows job 124800901029 (run 41290189739,feat/libc-numpunct-vtable) builtguest_locale_tests.exe, then ran onlyTest #72: select_tests_SelectGraphStateTestsand reported0 tests failed out of 1. The repository's other CTest index file already ends with a newline:tools/select_tests.py:389writesselect.testsas"0,0,0," + ... + "\n".run()ends the index file with"\n", sogetlinestops at the terminator and keeps every index. On Windowswrite_textwrites it as\r\n; CTest 4.3.1 selects the same tests for\nand\r\n. The selection logic, thectestcommand and its flags are unchanged.test_ctest_index_file_runs_only_resolved_testschecked only the file content, so it passed onmainalthough only one of its two selected tests ran. It is replaced bytest_ctest_index_file_runs_every_resolved_test, which registers oneunrelatedtest (cmake -E touch unrelated) and 11 selected tests namedselected [N].+, each writing aran-Nmarker withsys.executable, so the last index (12) has two digits; it drives the realctestthroughrun()and asserts that all 11 markers exist and thatunrelateddid not run. The expected index files oftest_mixed_argument_bearing_and_argumentless_tests_all_runandtest_selected_target_with_a_renamed_executable_runs_its_ctestgain the"\n".pr_overlap.py --branchfinds no shared lines with the open pull requests and none it cannot compare; fix(ci): select the tests build-wide inputs reach on the Windows pull request path #14317 and fix(ci): run every guest test when a CMake fragment under core/libs changes #14315 also changetools/build_changed_guest_tests.pyand its tests, but in other lines, and both merge cleanly with this branch. My pull request "ci(build): write ctest.log on the Windows pull request path so tests over 30 s are reported" changes the same file and its tests in other lines; a trial merge of the two branches is clean.Tested
Windows 11, WinLibs GCC 15.2.0 (CTest 4.3.1 from the same WinLibs package), Python 3.13.9; synthetic CTest files only, no title or homebrew. No C++ build is needed.
python tools/tests/test_build_changed_guest_tests.py -v(registered as thebuild_changed_guest_testsCTest test,CMakeLists.txt:196):Ran 19 tests in 2.836s,OK (skipped=1)(the symbolic link test skips without the Windows symlink privilege, as onmain).tools/build_changed_guest_tests.pyof 26fa121 fails 3 tests:test_ctest_index_file_runs_every_resolved_testwithran-10missing from the markers, and the two"\n"expectations (['0,0,0,1,2,3'] != ['0,0,0,1,2,3\n'],['0,0,0,1'] != ['0,0,0,1\n']). With the one-line change all pass.ctest -N -I <file>against a 12-testCTestTestfile.cmake:0,0,0,1lists 0 tests and0,0,0,1\nlists macOS support #1;0,0,0,2,12lists macOS support #1 and fix(build): register relinker tests with CTest #2, while0,0,0,2,12\nand0,0,0,2,12\r\nboth list fix(build): register relinker tests with CTest #2 and WIP: The Smurfs Dreams on Linux, first frames (stacked on #5) #12.python tools/check_conventions.py --base 26fa1212b8 --head HEADwith this title and description passed.sys.executableandcmake -E, and CI runs it on all three hosts.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)