-
Notifications
You must be signed in to change notification settings - Fork 35
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 71f5c9a
Showing
555 changed files
with
124,168 additions
and
0 deletions.
There are no files selected for viewing
Empty file.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,107 @@ | ||
--- | ||
orphan: true | ||
--- | ||
|
||
# Example installation of pFUnit and pFUnit_demos | ||
|
||
## Set up the environment | ||
|
||
Installing pFUnit requires Git, a Fortran compiler and CMake. | ||
|
||
### On a cluster | ||
|
||
On an HPC cluster you might need to add a few environment modules. For | ||
example, on [Tetralith](https://www.nsc.liu.se/systems/tetralith/) you | ||
would do: | ||
|
||
```bash | ||
module add git/2.19.3-nsc1-gcc-system | ||
module add CMake/3.16.4-nsc1 | ||
export FC=/software/sse/manual/mpprun/4.1.3/nsc-wrappers/ifort | ||
``` | ||
|
||
### On own computer | ||
|
||
If you don't have [CMake](https://cmake.org/) or a Fortran compiler | ||
installed yet, one option is to install them into a conda environment | ||
by first saving the following into a file `environment.yml`: | ||
|
||
```yaml | ||
name: compilers | ||
channels: | ||
- conda-forge | ||
dependencies: | ||
- cmake | ||
- compilers | ||
``` | ||
|
||
followed by installing the packages into a new environment: | ||
```bash | ||
conda env create -f environment.yml | ||
``` | ||
and finally activating the environment: | ||
```bash | ||
conda activate compilers | ||
``` | ||
|
||
For good measure, set the `FC` variable to point to your | ||
Fortran compiler (adjust path as needed): | ||
```bash | ||
export FC=$HOME/miniconda3/envs/compilers/bin/gfortran | ||
``` | ||
|
||
## Clone the pFUnit repository | ||
|
||
```bash | ||
git clone --recursive [email protected]:Goddard-Fortran-Ecosystem/pFUnit.git | ||
cd pFUnit | ||
``` | ||
|
||
## Configure with Cmake | ||
|
||
```bash | ||
mkdir build | ||
cd build | ||
cmake .. | ||
``` | ||
|
||
## Build and install | ||
|
||
The following will install pFUnit into a directory `installed` under | ||
the `build` directory. | ||
|
||
```bash | ||
make tests | ||
make install | ||
``` | ||
|
||
## Compiling with pFUnit | ||
|
||
When compiling with pFUnit, set: | ||
```bash | ||
export PFUNIT_DIR=$HOME/path/to/pFUnit/build/installed | ||
``` | ||
|
||
and run CMake with `-DCMAKE_PREFIX_PATH=$PFUNIT_DIR`. | ||
|
||
|
||
## Clone the pFUnit_demos repository | ||
|
||
This is for testing and learning purposes. | ||
|
||
```bash | ||
git clone [email protected]:Goddard-Fortran-Ecosystem/pFUnit_demos.git | ||
``` | ||
|
||
### Try out the Trivial, Basic, and MPI examples | ||
|
||
```bash | ||
cd pFUnit_demos | ||
export PFUNIT_DIR=~pFUnit/build/installed/PFUNIT-4.2 | ||
cd Trivial | ||
./build_with_cmake_and_run.x | ||
cd ../Basic | ||
./build_with_cmake_and_run.x | ||
cd ../MPI | ||
./build_with_cmake_and_run.x | ||
´´´ |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
orphan: true | ||
--- | ||
|
||
This page has been merged with [Motivation](motivation) |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
# Conclusions and recommendations | ||
|
||
## The basics | ||
|
||
- Learn one test framework well enough for basics | ||
- Explore and use the good tools that exist out there | ||
- An incomplete list of testing frameworks can be found in the [Quick Reference](quick-reference) | ||
- Start with some basics | ||
- Some simple thing that test all parts | ||
- Automate tests | ||
- Faster feedback and reduce the number of surprises | ||
|
||
|
||
## Going more in-depth | ||
|
||
- Strike a healthy balance between unit tests and integration tests | ||
- As the code gets larger and the chance of undetected bugs | ||
increases, tests should increase | ||
- When adding new functionality, also add tests | ||
- When you discover and fix a bug, also commit a test against this bug | ||
- Use code coverage analysis to identify untested or unused code | ||
- If you make your code easier to test, it becomes more modular | ||
|
||
|
||
## Ways to get started | ||
|
||
You probably won't do everything perfectly when you start off... But | ||
what are some of the easy starting points? | ||
|
||
- Do you have some single functions that are easy to test, but hard to | ||
verify just by looking at them? Add unit tests. | ||
|
||
- Do you have data analysis or simulation of some sort? Make an | ||
end-to-end test with sample data, or sample parameters. This is | ||
useful as an example anyway. | ||
|
||
- A local testing framework + GitHub actions is very easy! And works | ||
well in the background - you do whatever you want and get an email | ||
if you break things. It's actually pretty freeing. |
Oops, something went wrong.