Skip to content

Fix relative PRE_TEST discovery paths#3175

Open
NgoQuocViet2001 wants to merge 1 commit into
catchorg:develfrom
NgoQuocViet2001:fix/3051-relative-pre-test-paths
Open

Fix relative PRE_TEST discovery paths#3175
NgoQuocViet2001 wants to merge 1 commit into
catchorg:develfrom
NgoQuocViet2001:fix/3051-relative-pre-test-paths

Conversation

@NgoQuocViet2001

Copy link
Copy Markdown

Description

Add an opt-in USE_RELATIVE_PATHS mode to catch_discover_tests for DISCOVERY_MODE PRE_TEST.

When enabled, the generated CTest include resolves the test executable, discovery script, working directory, and discovery cache relative to its own relocated build-tree location. This keeps the existing behavior unchanged by default, supports single- and multi-config generators, and requires CMake 3.24 for the path generator expressions. The option and version requirement are documented.

The regression relocates the build tree before first discovery, uses a generator-expression WORKING_DIRECTORY, verifies the discovered names, runs the actual tests, and cleans the generated discovery cache.

GitHub Issues

Closes #3051

Testing

  • Single-config Ninja relocation before first discovery: 5/5 tests passed
  • Multi-config Ninja/Zig in a path containing spaces: default and relocated relative modes both discovered 5 tests; relocated CTest passed
  • CMake 3.23.3: default mode configured successfully; opt-in mode failed with the expected CMake 3.24 requirement
  • Python syntax and git diff --check passed

AI assistance

Codex (GPT-5, autonomous) implemented and iteratively validated the change on behalf of @NgoQuocViet2001. The operator requested the contribution but did not manually author or line-by-line review the patch.

@codecov

codecov Bot commented Jul 11, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 91.12%. Comparing base (a15f718) to head (77c8a2f).

Additional details and impacted files
@@            Coverage Diff             @@
##            devel    #3175      +/-   ##
==========================================
+ Coverage   91.09%   91.12%   +0.03%     
==========================================
  Files         204      204              
  Lines        8922     8922              
==========================================
+ Hits         8127     8130       +3     
+ Misses        795      792       -3     
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

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.

catch_discover_tests needs to support relative paths

1 participant