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.24%. Comparing base (0aeb818) to head (c15c563).

Additional details and impacted files
@@            Coverage Diff             @@
##            devel    #3175      +/-   ##
==========================================
- Coverage   91.27%   91.24%   -0.03%     
==========================================
  Files         204      204              
  Lines        8973     8973              
==========================================
- Hits         8190     8187       -3     
- Misses        783      786       +3     
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@NgoQuocViet2001
NgoQuocViet2001 force-pushed the fix/3051-relative-pre-test-paths branch from 77c8a2f to c15c563 Compare August 11, 2026 09:50
@NgoQuocViet2001

Copy link
Copy Markdown
Author

Rebased onto current devel and resolved the upstream discovery-test changes while preserving the USE_RELATIVE_PATHS regression.

Focused Windows/MSVC validation passed for both the default and relocated relative modes: 22 test names matched the CTest listing, 22 matched TEST_LIST, and the relocated tests ran successfully. AppVeyor is also green across all 5 jobs.

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