Skip to content

tests: ignore commented CMake registrations when checking CTest coverage - #2199

Merged
DadaCap merged 1 commit into
ProjectLeonida:mainfrom
EdenBendheim:ubiq/ctest-registration-comments
Nov 29, 2026
Merged

DadaCap merged 1 commit into
ProjectLeonida:mainfrom
EdenBendheim:ubiq/ctest-registration-comments

Conversation

@EdenBendheim

Copy link
Copy Markdown
Contributor

Claimed in the coordination issue as: TEST-CTEST-REGISTRATION-COMMENTS (claim)

Commenting out add_test(...) left the registration checker green for a built executable. In a throwaway CMake project, ctest -N listed zero tests while the checker reported zero missing registrations. The checker now strips CMake line and bracket comments before scanning declarations and skip properties. It preserves literal # characters in quoted, escaped and bracket arguments.

Three regression cases failed on main a73a57e13. With this change, all 10 registration tests pass on Python 3.12.14 and 3.14.3 on macOS, and the checker flags the omitted executable from the CMake fixture. Compile, diff and changed-file game-data checks passed. Simulated merge with #1418 was clean.

GPUs tested: n/a. All tests used synthetic inputs.

AI-assisted: yes. Created with gpt-6.2-astra in Codex.

@real-rusher

Copy link
Copy Markdown
Contributor

Verified on main a73a57e (Ubuntu 24.04 x86-64, Python 3.13, no GPU). Merges cleanly. python -I tests/test_ctest_registration.py: 10 tests OK against the real runtime/CMakeLists.txt.

Compared with main's helpers on a small CMake text (one live test, plus a commented-out add_executable and add_test): main's built_test_executables() and registered_commands() count disabled_test and orphan_test from the comments; this PR's count only live_test. compileall clean.

AI-assisted: yes (Claude Code)

@DeadlyChirp

Copy link
Copy Markdown
Contributor

Tested on Windows 11, Python 3.12.10, with this PR merged onto current upstream main.

  • tests/test_ctest_registration.py: 10 passed (main: 6 passed).

(AI-assisted test run; output checked by hand.)

@sodove

sodove commented Nov 28, 2026

Copy link
Copy Markdown
Contributor

#2199 | head 6deaf03745eb920a372d7e9e0a96a493608e1a08 | python3 -I tests/test_ctest_registration.py -v | red: 10 passed with full file. Methods only: 4 tests, 3 assertion failures, 1 error | green: 11 passed with full file. Same methods: 4 passed | Full file green/green. Isolated check red → green

The checker and its tests share this file. As a separate control I copied only the four new test methods verbatim onto main, preserving its checker. That produced three assertion failures and one missing-helper error. The same four methods passed after merging. The focused invocation was python3 -I tests/test_ctest_registration.py CTestRegistrationTest.test_comments_do_not_build_or_register_tests CTestRegistrationTest.test_comments_inside_multiline_commands_are_ignored CTestRegistrationTest.test_hashes_inside_arguments_are_not_comments CTestRegistrationTest.test_commented_skip_code_does_not_enable_the_skip_check -v.

Pinned main 4938673668d807bf365b61284bf22b1ff8d02cc4, merged into the PR head. Ubuntu 26.04.1 (WSL2), Python 3.14.4. Full suite: not run. AI-assisted: OpenAI Codex. Batch claim.

@zmasi

zmasi commented Nov 29, 2026

Copy link
Copy Markdown
Contributor

Independent verification on Windows 11 (10.0.26200, x64) of 6deaf03745 merged onto current origin/main (59e65849b0, 0 merge conflicts), tested under both Python 3.12.10 and Python 3.14.5:

  • Suite & CRLF comment checks:
    • python -I -B tests/test_ctest_registration.py: Ran 11 tests, OK on both Python 3.12.10 (0.33 s) and Python 3.14.5 (0.32 s) against current runtime/CMakeLists.txt.
    • Verified strip_cmake_comments() also preserves \r\n line counts and strips # line comments and #[=[...]=] bracket comments cleanly on CRLF inputs.
  • Hygiene: git diff --check, python -I -m compileall -q tests/test_ctest_registration.py, python -I scripts/check_no_game_data.py tests/test_ctest_registration.py, python -I tests/test_ci_registration.py (18/18), and python -I tests/test_text_write_line_endings.py (3/3) all exited 0.

AI-assisted.

@OreoFR

OreoFR commented Nov 29, 2026

Copy link
Copy Markdown
Contributor

Verified by OreoFR on macOS 27.2.1 (26B131), Apple M5, APFS (case-insensitive), Python 3.12.16, main c8bf0e7, PR head 6deaf03 : red 3 failures / green 11 OK

python3.12 -I tests/test_ctest_registration.py (11 tests):

  • Merge: clean. The PR's test file is older than main's (main added test_xdxr_postbuild_readback_skips_with_the_ctest_skip_code in c13614e), and the file holds the code under test, so red = the merged file with strip_cmake_comments made an identity function.
  • Red: 3 failures: test_comments_do_not_build_or_register_tests, test_comments_inside_multiline_commands_are_ignored, test_commented_skip_code_does_not_enable_the_skip_check (test_hashes_inside_arguments_are_not_comments is a guard and passes either way).
  • Green (main + git merge --no-ff): 11/11 OK, skipped 0.
  • Neighbours, same on main and merge: test_ci_registration 18 OK; test_cmake_translator_deps OK (1 skipped). Skipped on Mac: test_build_runtime_cmake (needs Windows PowerShell + csc), test_cmake_vulkan_missing x3 (no cmake on PATH).
  • Diff: the tokenizer handles escapes, quoted strings and bracket arguments/comments before # comments and keeps newlines. Stripping runs twice (setUpClass and helpers), harmless since idempotent. Minor: [[...]] is matched without checking it starts an argument (no practical impact). No game data.

Verdict: READY

AI-assisted: Claude Code

@DadaCap

DadaCap commented Nov 29, 2026

Copy link
Copy Markdown
Collaborator

Merging, thank you @EdenBendheim! OreoFR's agent verified this head merged with current main: the test fails on main and passes with the PR (#2199 (comment)), and it still merges cleanly.

AI-assisted (Claude Code, Claude Opus 5.5), on behalf of DadaCap.

@DadaCap
DadaCap merged commit 212d2ec into ProjectLeonida:main Nov 29, 2026
5 of 8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants