Use SOURCES keyword for source files in EkatCreateUnitTestExec#440
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR modernizes EKAT’s CMake unit-test helpers by switching source-file
specification from a positional argument to an explicit SOURCES keyword, making
call sites less error-prone and more self-documenting.
Changes:
- Update
EkatCreateUnitTestExec/EkatCreateUnitTestto accept source files
via theSOURCESmulti-value keyword. - Migrate existing test
CMakeLists.txtcall sites to the newSOURCESform. - Minor refactor in
tests/algorithmto create thetridiag_invalid_flagstest
directly from the selected precision executable.
Reviewed changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
cmake/EkatCreateUnitTest.cmake |
Introduces SOURCES keyword parsing and updates unit test creation flow. |
cmake/EkatCreateUnitTestWithAsserts.cmake |
Updates wrapper calls to pass sources via SOURCES. |
tests/algorithm/CMakeLists.txt |
Migrates to SOURCES keyword; refactors invalid-flags test creation. |
tests/core/CMakeLists.txt |
Migrates unit-test calls (and EkatCreateUnitTestExec) to SOURCES. |
tests/expression/CMakeLists.txt |
Migrates unit-test call to SOURCES. |
tests/kokkos/CMakeLists.txt |
Migrates unit-test calls to SOURCES. |
tests/logging/CMakeLists.txt |
Migrates unit-test calls to SOURCES. |
tests/pack/CMakeLists.txt |
Migrates unit-test calls to SOURCES. |
tests/parser/CMakeLists.txt |
Migrates unit-test call to SOURCES. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
052646f to
69c58e8
Compare
Contributor
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 10 out of 10 changed files in this pull request and generated 2 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
69c58e8 to
3211799
Compare
jgfouca
approved these changes
May 4, 2026
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.
Motivation
The cmake function EkatCreateUnitTestExec uses a named argument for the source files list. However, I find this a bit error prone compared to the more modern cmake way (based on
cmake_parse_arguments). In particular, it forces to use quotes to list all source files, and lists are one of the more tricky things in cmake: if you forget to quote, or use a var that expands to 2+ elements, the named argument would only bind to the 1st element, and the rest of the list will be parsed bycmake_parse_arguments. Moreover, keywords are much more self-documenting:To make sure this wasn't just my preference, I googled (and asked our bot friends), and it seems that keywords are in fact preferred over positional args, for readability and maintainability reasons. Let me know if you guys disagree.
E3SM Stakeholder Feedback
This will require to adapt the eamxx wrapper when we update ekat in e3sm.