Unit Tests & Continuous Integration for Scalable Geophysical Simulations
Unit testing frameworks provide the foundation for writing and executing self-test code on specific portions of a software project. Testing isolated code segments allows for verifying function outputs against a wide range of input combinations. Integration and system tests respectively test multiple portions or an entire set of the software. Continuous integration services such as GitHub Actions can automatically run unit and integration tests upon each code push.
Geophysical simulations often combine numerous external and third-party numeric and physics libraries. Historically, manual regression testing tested benchmark cases where specific inputs yielded known outputs. Given the increasing need in scientific computing to support diverse computing platforms, industry best practices have come to the forefront of geophysical simulation software.
We discuss our approach to unit, integration, and system testing with continuous integration for the FIGMENTS and GEMINI3D ionospheric simulation suites composed of code written in C, C++, and Fortran. Our approach uses the CMake test driver program CTest to manage running of MPI-based simulations appropriate for the computer running the test. Unit tests and integration tests can be run on a public service like GitHub Actions. System tests that take several hours to complete may be executed in automatically run nightly tests on a private workstation or server. CTest results can optionally be submitted to the CDash service to present a dashboard of results across computing platforms and time to help show regressions have not been detected.