Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Refine install_test with a find_package inside a sub-directory#964

Merged
tpadioleau merged 4 commits intomainCExA-project/ddc:mainfrom
refine-install_testCExA-project/ddc:refine-install_testCopy head branch name to clipboard
Feb 26, 2026
Merged

Refine install_test with a find_package inside a sub-directory#964
tpadioleau merged 4 commits intomainCExA-project/ddc:mainfrom
refine-install_testCExA-project/ddc:refine-install_testCopy head branch name to clipboard

Conversation

@tpadioleau
Copy link
Copy Markdown
Member

@tpadioleau tpadioleau commented Nov 4, 2025

  • Make the install_test more robust.
  • Raise the minimal version support of PDI to 1.10.1.

@tpadioleau tpadioleau self-assigned this Nov 4, 2025
@tpadioleau
Copy link
Copy Markdown
Member Author

blocked by pdidev/pdi#526

@codecov
Copy link
Copy Markdown

codecov Bot commented Nov 4, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 94.72%. Comparing base (b7945b4) to head (83d15a3).
⚠️ Report is 3 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #964   +/-   ##
=======================================
  Coverage   94.72%   94.72%           
=======================================
  Files          59       59           
  Lines        2863     2863           
  Branches      890      890           
=======================================
  Hits         2712     2712           
  Misses         93       93           
  Partials       58       58           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@tpadioleau tpadioleau mentioned this pull request Dec 2, 2025
17 tasks
@tpadioleau tpadioleau force-pushed the refine-install_test branch 2 times, most recently from 85f38ba to 49e4b4a Compare December 19, 2025 13:04
@tpadioleau tpadioleau force-pushed the refine-install_test branch 2 times, most recently from 3d8a1ad to 44be49b Compare February 5, 2026 08:16
@tpadioleau tpadioleau force-pushed the refine-install_test branch 2 times, most recently from b00bfca to 15ccca2 Compare February 14, 2026 08:20
@tpadioleau tpadioleau force-pushed the refine-install_test branch 5 times, most recently from 18e9f9d to 1d0639d Compare February 24, 2026 09:18
Comment on lines +9 to +14
function(assert)
if(NOT (${ARGN}))
string(REPLACE ";" " " ASSERT_TEXT "${ARGN}")
message(FATAL_ERROR "Assertion failed: ${ASSERT_TEXT}")
endif()
endfunction()
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add docstrings to this function.
An example of how it works would be useful

Comment thread install_test/CMakeLists.txt Outdated
Comment on lines +19 to +35
## Test targets
assert(NOT TARGET DDC::core)
assert(NOT TARGET DDC::fft)
assert(NOT TARGET DDC::pdi)
assert(NOT TARGET DDC::splines)
## Test normal variables
assert(NOT DEFINED DDC_FOUND)
assert(NOT DEFINED DDC_BUILD_DOUBLE_PRECISION)
assert(NOT DEFINED DDC_fft_FOUND)
assert(NOT DEFINED DDC_pdi_FOUND)
assert(NOT DEFINED DDC_splines_FOUND)
## Test cache variables
assert(NOT DEFINED CACHE{DDC_FOUND})
assert(NOT DEFINED CACHE{DDC_BUILD_DOUBLE_PRECISION})
assert(NOT DEFINED CACHE{DDC_fft_FOUND})
assert(NOT DEFINED CACHE{DDC_pdi_FOUND})
assert(NOT DEFINED CACHE{DDC_splines_FOUND})
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we refactor these checks.
Comments would be useful what you expect to be defined and not defined

# Targets that must exist
foreach(tgt IN ITEMS DDC::core)
    assert(TARGET ${tgt})
endforeach()

# Targets that must NOT exist
foreach(tgt IN ITEMS DDC::fft DDC::pdi DDC::splines)
    assert(NOT TARGET ${tgt})
endforeach()

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure, for the tests below I will need two loops for the targets and normal variable sections. I am not convinced we gain much in readability:

foreach(tgt IN ITEMS DDC::core)
    assert(TARGET ${tgt})
endforeach()
foreach(tgt IN ITEMS DDC::fft DDC::pdi DDC::splines)
    assert(NOT TARGET ${tgt})
endforeach()
foreach(tgt IN ITEMS DDC_FOUND DDC_BUILD_DOUBLE_PRECISION)
    assert(DEFINED ${tgt})
endforeach()
foreach(tgt IN ITEMS DDC_fft_FOUND DDC_pdi_FOUND DDC_splines_FOUND)
    assert(NOT DEFINED ${tgt})
endforeach()
foreach(tgt IN ITEMS DDC_FOUND DDC_BUILD_DOUBLE_PRECISION DDC_fft_FOUND DDC_pdi_FOUND DDC_splines_FOUND)
    assert(NOT DEFINED CACHE{${tgt}})
endforeach()

Regarding the comments, I feel assertions are really short enough to be self explanatory.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is more for the explanatory
In the current implementation, the similar checks are repeated, and it is not explained what you expect in each check.

## Test targets
assert(NOT TARGET DDC::core)
assert(NOT TARGET DDC::fft)
assert(NOT TARGET DDC::pdi)
assert(NOT TARGET DDC::splines)

In my way, it is clear what you expect to be defined and not defined. Also, it is much easier to maintain

## Since we only find DDC, we expect that DDC::core and its related variable are defined, 
## but other components should not be defined
foreach(tgt IN ITEMS DDC::core)
    assert(TARGET ${tgt})
endforeach()
foreach(tgt IN ITEMS DDC::fft DDC::pdi DDC::splines)
    assert(NOT TARGET ${tgt})
endforeach()
foreach(tgt IN ITEMS DDC_FOUND DDC_BUILD_DOUBLE_PRECISION)
    assert(DEFINED ${tgt})
endforeach()
foreach(tgt IN ITEMS DDC_fft_FOUND DDC_pdi_FOUND DDC_splines_FOUND)
    assert(NOT DEFINED ${tgt})
endforeach()
foreach(tgt IN ITEMS DDC_FOUND DDC_BUILD_DOUBLE_PRECISION DDC_fft_FOUND DDC_pdi_FOUND DDC_splines_FOUND)
    assert(NOT DEFINED CACHE{${tgt}})
endforeach()

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is more for the explanatory
In the current implementation, the similar checks are repeated

I would hope the CMake code itself is self explanatory and intuitive. That would avoid out of date comments.

it is not explained what you expect in each check

I am not sure to understand, I expect what is implemented in each check.

Overall I think I can add a comment about the general idea: DDC components are additive, only requested components will be defined, if not already defined. The PR is not changing any behavior but only adding a test for it.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is more for the explanatory
In the current implementation, the similar checks are repeated

I would hope the CMake code itself is self explanatory and intuitive. That would avoid out of date comments.

I understand that self explanatory CMake code is nicer. To me, line by line checks are not particularly readable.
Also, this implementation is not quite scalable. If we increment the components, we will likely make mistakes.

it is not explained what you expect in each check

I am not sure to understand, I expect what is implemented in each check.

It is not clear what you would like to explain with comments.
For example, the following comment ## Test targets is repeated, but it is clear that you are testing targets.
I would rather like to know why and what you expect in each check.

## Test targets
assert(NOT TARGET DDC::core)
assert(NOT TARGET DDC::fft)
assert(NOT TARGET DDC::pdi)
assert(NOT TARGET DDC::splines)

...

# Test whether `find_package(DDC)` can be called multiple times
find_package(DDC 0.10 REQUIRED)

## Test targets
assert(TARGET DDC::core)
assert(NOT TARGET DDC::fft)
assert(NOT TARGET DDC::pdi)
assert(NOT TARGET DDC::splines)

Overall I think I can add a comment about the general idea: DDC components are additive, only requested components will be defined, if not already defined. The PR is not changing any behavior but only adding a test for it.

That would be useful

Copy link
Copy Markdown
Member Author

@tpadioleau tpadioleau left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the review, adding a documentation for the internal CMake assert function.

Comment thread install_test/CMakeLists.txt
Comment thread install_test/CMakeLists.txt Outdated
Comment on lines +19 to +35
## Test targets
assert(NOT TARGET DDC::core)
assert(NOT TARGET DDC::fft)
assert(NOT TARGET DDC::pdi)
assert(NOT TARGET DDC::splines)
## Test normal variables
assert(NOT DEFINED DDC_FOUND)
assert(NOT DEFINED DDC_BUILD_DOUBLE_PRECISION)
assert(NOT DEFINED DDC_fft_FOUND)
assert(NOT DEFINED DDC_pdi_FOUND)
assert(NOT DEFINED DDC_splines_FOUND)
## Test cache variables
assert(NOT DEFINED CACHE{DDC_FOUND})
assert(NOT DEFINED CACHE{DDC_BUILD_DOUBLE_PRECISION})
assert(NOT DEFINED CACHE{DDC_fft_FOUND})
assert(NOT DEFINED CACHE{DDC_pdi_FOUND})
assert(NOT DEFINED CACHE{DDC_splines_FOUND})
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure, for the tests below I will need two loops for the targets and normal variable sections. I am not convinced we gain much in readability:

foreach(tgt IN ITEMS DDC::core)
    assert(TARGET ${tgt})
endforeach()
foreach(tgt IN ITEMS DDC::fft DDC::pdi DDC::splines)
    assert(NOT TARGET ${tgt})
endforeach()
foreach(tgt IN ITEMS DDC_FOUND DDC_BUILD_DOUBLE_PRECISION)
    assert(DEFINED ${tgt})
endforeach()
foreach(tgt IN ITEMS DDC_fft_FOUND DDC_pdi_FOUND DDC_splines_FOUND)
    assert(NOT DEFINED ${tgt})
endforeach()
foreach(tgt IN ITEMS DDC_FOUND DDC_BUILD_DOUBLE_PRECISION DDC_fft_FOUND DDC_pdi_FOUND DDC_splines_FOUND)
    assert(NOT DEFINED CACHE{${tgt}})
endforeach()

Regarding the comments, I feel assertions are really short enough to be self explanatory.

Comment thread CMakeLists.txt
Copy link
Copy Markdown
Member

@yasahi-hpc yasahi-hpc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good

@tpadioleau tpadioleau merged commit 054a2c8 into main Feb 26, 2026
79 checks passed
@tpadioleau tpadioleau deleted the refine-install_test branch February 26, 2026 11:35
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.

3 participants

Morty Proxy This is a proxified and sanitized view of the page, visit original site.