Commit d14b33f
authored
🐛 Keep GoogleTest discovery artifacts in the build tree (#1954)
🤖 *AI text below* 🤖
## Description
CMake 4.3 writes a `cmake_test_discovery_*.json` bookkeeping file to the
directory passed to `gtest_discover_tests(WORKING_DIRECTORY ...)`. Our
test helpers passed source directories there because the same argument
also controls the runtime working directory of each discovered test. As
a result, configuring and building tests could dirty the source tree.
Run GoogleTest discovery from the current binary directory so the
bookkeeping file remains a build artifact. Preserve the existing runtime
working directory by setting the discovered tests' `WORKING_DIRECTORY`
property separately. The property name is deferred through a generator
expression so CMake's argument parser does not interpret it as a second
discovery option.
This is extracted from #1912 because it is independent of the QDMI
configuration work.
## Validation
- Configured and built representative targets with CMake 4.3.2.
- Confirmed that no `cmake_test_discovery_*.json` files appear outside
`build/`.
- Confirmed that the ordinary helper still runs a FoMaC test from its
source directory.
- Confirmed that the custom-working-directory helper still runs an IR
test from its configured build directory.
- `uvx nox -s lint`
- `git diff --check`
## Checklist
- [x] The pull request only contains commits that are focused and
relevant to this change.
- [x] I have added appropriate tests that cover the new/changed
functionality. (Existing tests exercise both helper variants.)
- [x] I have updated the documentation to reflect these changes. (No
user-facing documentation change is needed.)
- [x] I have added entries to the changelog for any noteworthy
additions, changes, fixes, or removals. (Not user-facing.)
- [x] I have added migration instructions to the upgrade guide (if
needed). (No migration is needed.)
- [x] The changes follow the project's style guidelines and introduce no
new warnings.
- [x] The changes are fully tested and pass the CI checks. (Local checks
pass; CI is pending.)
- [x] I have reviewed my own code changes.
**If PR contains AI-assisted content:**
- [x] Any agent that created, edited, or submitted GitHub content was
explicitly authorized for that scope, as required by our [AI Usage
Guidelines](https://github.com/munich-quantum-toolkit/core/blob/main/docs/ai_usage.md).
- [x] Every agent-authored or agent-edited public text body begins with
the visible disclosure `🤖 *AI text below* 🤖` (titles are exempt).
- [x] AI-assisted commits include an `Assisted-by: [Model Name] via
[Tool Name]` footer.
- [x] I confirm that I have personally reviewed and understood all
AI-generated content, and accept full responsibility for it.1 parent 88d1caf commit d14b33f
1 file changed
Lines changed: 8 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
19 | 19 | | |
20 | 20 | | |
21 | 21 | | |
22 | | - | |
23 | | - | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
24 | 26 | | |
25 | 27 | | |
26 | 28 | | |
| |||
40 | 42 | | |
41 | 43 | | |
42 | 44 | | |
43 | | - | |
44 | | - | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
45 | 49 | | |
46 | 50 | | |
47 | 51 | | |
| |||
0 commit comments