Skip to content
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

Set up Unit Testing #49

Open
4 of 8 tasks
kvrigor opened this issue Jan 24, 2025 · 0 comments
Open
4 of 8 tasks

Set up Unit Testing #49

kvrigor opened this issue Jan 24, 2025 · 0 comments
Labels
tracking-issue A list of issues or TODOs

Comments

@kvrigor
Copy link
Member

kvrigor commented Jan 24, 2025

(migrated from internal issue tracker)

Here are some of my thoughts on how to start with automated tests in eCLM. For now only unit testing is covered; system testing is a different matter and I will post about it on another thread below.

Phase 1: Set up unit test infrastructure

CLM5 uses the parallel Fortran Unit testing library (a.k.a. pFUnit) to run unit tests. We need to integrate this into eCLM and test if it works.

1. Build pFUnit standalone

The goal of this step is to learn the correct cmake parameters to build pFUnit, which will be important for the next step.

  • Successfully build pFUnit on JSC systems
  • Successfully build pFUnit on Ubuntu (necessary for GitHub CI)

2. Build pFUnit within eCLM

3. Add dummy unit tests in eCLM and run them

  • Get familiar with writing and running unit tests. Check out pFUnit_demos for examples.
  • Add some dummy unit tests inside eCLM (e.g., one test that always passes and another test that always fails)
  • Run the tests. The workflow for running tests should look something like this:
# Configure eCLM
cmake -S src -B "$BUILD_DIR" \
      -DCMAKE_INSTALL_PREFIX="$INSTALL_DIR" \
      -DCMAKE_C_COMPILER=mpicc \
      -DCMAKE_Fortran_COMPILER=mpifort

# Build eCLM
cmake --build "$BUILD_DIR"

# Run tests
cd "$BUILD_DIR"
ctest

Phase 2: Port unit tests from CLM5 to eCLM

Once the test infrastructure is set up, we can start copying the unit tests under CTSM/src and test if they work.

@kvrigor kvrigor pinned this issue Jan 24, 2025
@kvrigor kvrigor added the tracking-issue A list of issues or TODOs label Jan 24, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
tracking-issue A list of issues or TODOs
Projects
None yet
Development

No branches or pull requests

1 participant