ci: fail when a test executable is built that no test runs #1257
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/1257"
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 Dextroid17 on 2026-10-07T20:02:20Z.
What
A test executable can be declared with
add_test_executableand never registered withadd_test. It is then built and never run, and becausectestreports a full pass over the tests it knows about, nothing in CI says so. This is the same class as #1040 and theagc_command_testsmode that #1006 registered.Measured on
main, these are built and never run:agc_driver_mesh_testsagc_driver_recorder_testsguest_formatting_testsvideo_out_flip_testsagc_driver_bda_device_testsThat is 5 of 362. Whether each is deliberate I cannot tell from the tree —
add_testis called insideif()blocks in several libraries, so some of these may be registered only under an option that is off. The check records them by name, so the job stays green and only a new one fails.The Windows job has a sixth:
windows_exception_tests, a MINGW-only test executable that noadd_testregisters. It is the same class as the five above and is recorded beside them.The Windows job also builds one thing under the test output directory that is not a test executable:
libhost_thread_local_test_library, a support library whoseRUNTIME_OUTPUT_DIRECTORYis set to the test directory. On Linux its output is a library artifact (core/libs/libhost_thread_local_test_library.so) and never lands there, which is why only the Windows run listed it. The check now reads the rule Ninja prints beside each target and takes onlyCXX_EXECUTABLE_LINKER__…, which is what CMake links an executable with on both platforms; a shared library is linked withCXX_SHARED_LIBRARY_LINKER__….tools/check_test_registration.pycompares what CMake builds (the test executables in the build graph, filtered to the test output directory thatadd_test_executablesets) against what ctest runs (theadd_testcalls in the generatedCTestTestfile.cmakefiles). Those files are written at configure time, so the check does not depend on the build having finished and cannot confuse "never registered" with "not built yet".That distinction is the whole point: my first version read
ctest --show-only=json-v1, and ctest only reports a test's command when its executable already exists on disk — so on a freshly configured tree every test looked unregistered, and on a built tree the answer changed as artifacts appeared and disappeared. The generatedCTestTestfile.cmakecount is399in both a built and a freshly configured tree, which is what the check relies on instead.Both jobs run it immediately after configure, before anything is built, so it costs a second rather than another build. No source, no library behaviour and no test content changes.
Tested
Not tested with a title; nothing here changes library behaviour.
tools/check_test_registration.pyon Linux (CachyOS, GCC 16.2.1, Ninja):362 test executable(s), 5 built and not run as recorded, none new, exit 0;add_testline from a generatedCTestTestfile.cmakemakes it fail witherror: guest_scan_count_tests is built but no ctest test runs itand exit 1; restoring the line passes again;-t targets allfor Windows (tests\libhost_thread_local_test_library.dll,tests\windows_exception_tests.exe) against the same parser: it reports both names and exits 1 before the rule filter, and reportswindows_exception_testsas recorded and exits 0 after it. The real Windows listing is what the job itself produces;362 test executable(s), 5 built and not run as recorded, none new;-G Ninja, which is what the build-graph read needs.Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed in TechnicalDebt.mdfiles or images added to the repository (attach them to this PR)Imported from boykopovar/AnyPS5. Originally posted by Dextroid17 on 2026-10-07T20:13:11Z.
The Windows job failed on this step's first run, so it is fixed here rather than left for you:
Ninja prints target names with the platform separator, so the Windows build graph lists
tests\name_tests.exewhere Linux liststests/name_tests— the reader matched neither the backslash nor the.exesuffix, found no test executables, and failed. Both are accepted now.Verified by driving the reader with recorded Ninja output for both platforms, which return the same names, and by re-running the check on the Linux tree, which still reports
362 test executable(s), 5 built and not run as recorded, none new.Linux was green because Linux is the shape I developed against. That asymmetry is worth saying plainly, since it is the failure the check exists to catch.
Imported from boykopovar/AnyPS5. Originally posted by Dextroid17 on 2026-10-07T20:23:21Z.
Two follow-ups after that Windows failure, both already pushed:
tests\name_tests.exe— accept the platform separator and the.exesuffix.CXX_EXECUTABLE_LINKER__<target>_<config>and a shared library withCXX_SHARED_LIBRARY_LINKER__, on both platforms. That leaves outlibhost_thread_local_test_library, a support library whoseRUNTIME_OUTPUT_DIRECTORYputs its artifact in the test directory — on Linux that artifact is a.soand never lands there, which is why only the Windows job saw it.That second fix also surfaced a real instance of the class, Windows-only:
windows_exception_testsadd_testregisters it, so it is built and never run, and the Linux job cannot see it at allIt is recorded beside the other five, so the job stays green and only a new one fails.
Re-verified after both: the Linux tree still reads
362 test executable(s), 5 built and not run as recorded, none new, and driving the reader with recorded Ninja output for each platform now returns only the executables from each.Imported from boykopovar/AnyPS5. Originally posted by Dextroid17 on 2026-10-08T03:10:36Z.
@oneandonlydean ready for eyes — a CI guard that fails when a test executable is built but no test runs it. The earlier linux=CANCELLED was a superseded run; current checks are green.
Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-08T09:42:12Z.
Checked on a fresh Release/Ninja configure of the branch rebased onto current
main:388 test executable(s), 4 built and not run as recorded, none new(exit 0) in 0.4 s, before the build starts; removingguest_scan_count_testsfrom the generatedCTestTestfile.cmakemakes it fail with exit 1. Linux and Windows jobs were green on the previous head.Added on top of your commits (rebased on
main; the only conflict was the configure line inbuild.yml, now with-DANYPS5_ENABLE_SPIRV_TOOLS=ON, both kept):agc_driver_bda_device_testsis registered onmainnow, so itsKNOWN_UNRUNentry would hide a future loss of that registration. Removed it, and the script now also fails when aKNOWN_UNRUNentry is run by ctest, so the list can't go stale (checked: exit 1 with a registered test added to the list).Merging once CI is green on the rebased head.
Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-08T10:03:01Z.
My stale-entry check broke the Windows job:
guest_formatting_testsis only registered on Windows andwindows_exception_testsonly exists there, so both are run by ctest on Windows and were reported as stale. Pushed464f673: the not-run list is now per platform (guest_formatting_testsonly off Windows,windows_exception_testsdropped). Linux passes locally; the Windows log of the last run shows exactly the three remaining entries as not run. Merging once CI is green.