CMake: decouple unit/integration test selection#550
Open
ouankou wants to merge 1 commit intoCambridge-ICCS:mainfrom
Open
CMake: decouple unit/integration test selection#550ouankou wants to merge 1 commit intoCambridge-ICCS:mainfrom
ouankou wants to merge 1 commit intoCambridge-ICCS:mainfrom
Conversation
jatkinson1000
requested changes
Feb 23, 2026
Member
jatkinson1000
left a comment
There was a problem hiding this comment.
Hi @ouankou
Thanks for this contribution and we feel it will be a useful feature.
I have a couple of requests/suggestions for you before we merge this.
- Please add
FTORCHto the option names. This is so that when used as part of a larger build they are clear and do not conflict with other packages that might use the same commands. - Could the logic be simplified whilst preserving behaviour, e.g. to:
?
# Test selection if(CMAKE_BUILD_TESTS) set(_ftorch_tests_default ON) else() set(_ftorch_tests_default OFF) endif() option(BUILD_UNIT_TESTS "Build pFUnit-based unit tests" ${_ftorch_tests_default}) option(BUILD_INTEGRATION_TESTS "Build integration tests from examples/" ${_ftorch_tests_default}) # Enable tests if any test option is ON if(BUILD_UNIT_TESTS OR BUILD_INTEGRATION_TESTS) set(CMAKE_BUILD_TESTS ON) elseif(CMAKE_BUILD_TESTS) message(FATAL_ERROR "CMAKE_BUILD_TESTS=ON requires at least one of BUILD_UNIT_TESTS or BUILD_INTEGRATION_TESTS to be ON.") endif()
- We will also need some updates to the documentation around this. There is the main README.md, but then within
pages/there areinstallation/general.mdanddeveloper/testing.mdthat will need something adding.
|
|
||
| if(CMAKE_BUILD_TESTS AND NOT BUILD_UNIT_TESTS AND NOT BUILD_INTEGRATION_TESTS) | ||
| message(FATAL_ERROR | ||
| "CMAKE_BUILD_TESTS=ON requires at least one of BUILD_UNIT_TESTS or BUILD_INTEGRATION_TESTS to be ON.") |
Member
There was a problem hiding this comment.
This line fails CMake linting for being too long.
Member
|
Hi @ouankou are you interested in making the above changes so that we can move towards merging this? |
Author
Sure, I'll address the proposed changes accordingly. Thanks for the review! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
To run integration tests without forcing pFUnit, this PR adds two test-selection options and keeps backward compatibility with existing
CMAKE_BUILD_TESTSworkflows.BUILD_UNIT_TESTSto control pFUnit unit tests.BUILD_INTEGRATION_TESTSto control integration tests fromexamples/.Behavior
-DCMAKE_BUILD_TESTS=ON: both test families default to ON (unchanged behavior).-DCMAKE_BUILD_TESTS=ON -DBUILD_UNIT_TESTS=OFFor-DBUILD_INTEGRATION_TESTS=ON: integration tests only.-DCMAKE_BUILD_TESTS=ON -DBUILD_INTEGRATION_TESTS=OFFor-DBUILD_UNIT_TESTS=ON: unit tests only.-DCMAKE_BUILD_TESTS=ON -DBUILD_UNIT_TESTS=OFF -DBUILD_INTEGRATION_TESTS=OFF: configuration fails with clear error.