-
Notifications
You must be signed in to change notification settings - Fork 37.7k
cmake: Create subdirectories in build tree in advance #32773
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers. Code Coverage & BenchmarksFor details see: https://corecheck.dev/bitcoin/bitcoin/pulls/32773. ReviewsSee the guideline for information on the review process.
If your review is incorrectly listed, please react with 👎 to this comment and the bot will ignore it on the next update. ConflictsNo conflicts as of last run. |
would it make sense to at least replace the recursive glob with a normal glob now, iterating over the given folders, given that they are listed anyway? |
Sure! Added a commit. |
Any hints how to verify / test this ? Have tried to see any difference between this PR and master but it's not clear to me what difference I should see. |
Is this setting up the environment for tests to run? Ideally, things like that should be done as test fixture and not executed during build system generation. |
Rebased.
I've updated the PR description with the relevant example.
At this moment, functional tests are not managed by ctest/cmake. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ACK 0b7d038
This PR changes :
- Recursive Glob -> 'explicit' non recursive GLOB
- Subdirectories now are created in advance, so that there aren't any problems with missing paths for sym-linking.
The PR fixes a "bug" and the code changes make the code communicate the intentions of the code better.
Can reproduce the successful subfolder creation and therefor file sym-linking :
$ ls -l
total 4
-rwxr-xr-x 1 jan staff 2683 Jul 3 15:57 invalid_signer.py
lrwxr-xr-x 1 jan staff 73 Jul 3 15:57 multi_signers.py -> /Users/jan/Projects/bitcoin/test/functional/mocks/multi_signers.py
lrwxr-xr-x 1 jan staff 69 Jul 3 15:57 no_signer.py -> /Users/jan/Projects/bitcoin/test/functional/mocks/no_signer.py
lrwxr-xr-x 1 jan staff 66 Jul 3 15:57 signer.py -> /Users/jan/Projects/bitcoin/test/functional/mocks/signer.py
This PR (works see invalid_signer.py
):
ls -l
total 0
lrwxr-xr-x 1 jan staff 74 Jul 3 16:05 invalid_signer.py -> /Users/jan/Projects/bitcoin/test/functional/mocks/invalid_signer.py
lrwxr-xr-x 1 jan staff 73 Jul 3 16:05 multi_signers.py -> /Users/jan/Projects/bitcoin/test/functional/mocks/multi_signers.py
lrwxr-xr-x 1 jan staff 69 Jul 3 16:05 no_signer.py -> /Users/jan/Projects/bitcoin/test/functional/mocks/no_signer.py
lrwxr-xr-x 1 jan staff 66 Jul 3 16:05 signer.py -> /Users/jan/Projects/bitcoin/test/functional/mocks/signer.py
- code review ✅
- building & tests ✅
@hebasto Thank you for supplying the additional information how to test the PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tested ACK 0b7d038
Confirmed that the subdirectories are created in the build tree before the symlinks preventing accidental COPY_ON_ERRORs like invalid_signer.py
Commit: 0b7d038
I also agree that using explicit file(GLOB ...)
for specific file types (e.g., *.py, *.json, *.csv, *.html) is more robust than the original file(GLOB_RECURSE ...)
This change ensures that subsequent symlink creation does not fail due to a missing path.
Rebased to resolve conflict with merged #32881. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
re ACK fa3beb6
Changes sinds last ACK:
- Solved Merge conflict.
Retested, still worked as described. ✅
Code review ✅
While reviewing #32697, I noticed that symlink creation fails when the target subdirectory does not exist. In such cases,
file(CREATE_LINK ... COPY_ON_ERROR SYMBOLIC)
falls back to copying, which implicitly creates the required path. As a result, a single file is copied instead of symlinked for subdirectories intest/functional
.This PR ensures that necessary subdirectories are created in advance, so that subsequent symlink creation does not fail due to missing paths.
For example: