Skip to content

Commit

Permalink
Simplify local testing
Browse files Browse the repository at this point in the history
  • Loading branch information
eprovst committed Sep 20, 2022
1 parent 8a28707 commit c8b5e55
Show file tree
Hide file tree
Showing 4 changed files with 67 additions and 2 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,5 @@ legolas_config.par
!/tests/regression_tests/baseline/*.dat
!/tests/pylbo_tests/utility_files/*.dat
!/tests/pylbo_tests/utility_files/*.log
/tests/pFUnit
tests/regression_tests/test_results
14 changes: 12 additions & 2 deletions tests/regression_tests/conftest.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,17 @@
import os
from pathlib import Path
import shutil
import sys

import pytest
import shutil
from pathlib import Path

# Search for Pylbo in $LEGOLASDIR/post_processing.
# Useful when Pylbo is not installed as a package.
if "LEGOLASDIR" in os.environ.keys():
_pylbo_path = Path(os.environ["LEGOLASDIR"]).joinpath("post_processing")
if _pylbo_path.is_dir():
sys.path.append(str(_pylbo_path.resolve()))

import pylbo

pylbo.set_loglevel("warning")
Expand Down
17 changes: 17 additions & 0 deletions tests/run_regression_tests.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/bin/bash

cd $LEGOLASDIR

# Build Legolas
if [[ ! -d build ]]; then
mkdir build
fi
cd build
cmake ..
make -j 2
cd ..

# Run regression tests
cd tests/regression_tests
pytest -v regression.py test*

37 changes: 37 additions & 0 deletions tests/run_unit_tests.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
#!/bin/bash

cd $LEGOLASDIR

# Pull and compile pFUnit if not yet available
if [[ ! -d tests/pFUnit ]]; then
cd tests
git clone https://github.com/Goddard-Fortran-Ecosystem/pFUnit.git
cd pFUnit
mkdir build
cd build
cmake .. -DSKIP_MPI=YES -DSKIP_OPENMP=YES -DSKIP_FHAMCREST=YES
make -j 2 tests
make -j 2 install
cd ../../..
fi

# Build Legolas
if [[ ! -d build ]]; then
mkdir build
fi
cd build
cmake ..
make -j 2
cd ..

# Build and run unit tests
cd tests/unit_tests
if [[ ! -d build ]]; then
mkdir build
fi
cd build
env PFUNIT_DIR="$LEGOLASDIR/tests/pFUnit/build/" cmake ..
make -j 2
cd ..
./test_legolas

0 comments on commit c8b5e55

Please sign in to comment.