Skip to content

Fail visibly when CEA_BUILD_TESTING is on but pFUnit is missing - #152

Open
djkees wants to merge 2 commits into
nasa:mainfrom
djkees:up/cmake-pfunit-required
Open

Fail visibly when CEA_BUILD_TESTING is on but pFUnit is missing#152
djkees wants to merge 2 commits into
nasa:mainfrom
djkees:up/cmake-pfunit-required

Conversation

@djkees

@djkees djkees commented Sep 3, 2026

Copy link
Copy Markdown
Contributor

Summary

CEA_BUILD_TESTING=ON (the default for top-level builds) silently registered zero Fortran unit tests when the GFE/pFUnit prerequisite wasn't set up, and ctest reported success anyway. Originally reported at djkees#97.

Changes

In source/CMakeLists.txt, when CEA_BUILD_TESTING is on but PFUNIT_FOUND is false:

  • Emit a message(WARNING ...) at configure time pointing to CONTRIBUTING.md's "Running Tests" prerequisite steps.
  • Register a cea_core_test_pfunit_missing placeholder test marked WILL_FAIL TRUE, so ctest's own exit code reflects the missing prerequisite instead of reporting a clean pass with zero tests run.

find_package(PFUNIT REQUIRED) was considered but rejected: CEA_BUILD_TESTING also gates cea_main_test (the CLI smoke test), which needs no pFUnit at all, so making it REQUIRED would force every top-level dev build to set up GFE just to run the CLI tests.

Testing

  • Configured a scratch build tree with CEA_BUILD_TESTING=ON and no GFE/pFUnit installed (gfortran/Ninja via a conda toolchain): confirmed the new message(WARNING ...) fires at source/CMakeLists.txt.
  • Built that tree and ran ctest -R pfunit_missing --output-on-failure: confirmed cea_core_test_pfunit_missing fails with the intended message and a non-zero exit code (previously ctest would have reported 0 tests / success).
  • Did not exercise the PFUNIT_FOUND=TRUE branch directly (no local pFUnit/GFE install in this environment) — that branch is unmodified by this change, so behavior there is unaffected by inspection.

Compatibility / Numerical behavior

  • No expected changes to numerical results

Drafted with Claude's assistance

  • Root cause confirmed by direct read of CMakeLists.txt and source/CMakeLists.txt before and after the change.
  • Both new code paths (configure-time warning, failing ctest placeholder) were exercised live in a scratch build tree rather than assumed correct, as noted under Testing.

Previously cea_core_test was silently skipped and ctest reported success
with zero tests. Now a configure-time warning fires and a WILL_FAIL
placeholder test surfaces the gap in ctest's own result too.

Co-authored-by: Claude Sonnet 5 <noreply@anthropic.com>
* Build GFE/pFUnit on Windows bindc CI legs

* Disable CEA_BUILD_TESTING on Windows bindc CI legs instead of building GFE
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.

1 participant