forked from marbl-ecosys/MARBL
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Introduced MARBL_tools/run_test_suite.sh, a bash script that runs a series of tests; Travis CI now tries to build the sphinx documentation and then runs this test script. A few improvements to some python scripts along the way: 1. added a --no_pause option to bld_lib.py and bld_exe.py; if run with that flag, the user will not be prompted to press [return] between compilers 2. If a build fails, bld_lib.py and bld_exe.py exit immediately (rather than attempting to build with the next compiler and eventually returning a status of 0) 3. marbl_with_restore.input reflects tracers that are restored in POP
- Loading branch information
Showing
8 changed files
with
188 additions
and
56 deletions.
There are no files selected for viewing
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
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,157 @@ | ||
#!/bin/bash | ||
|
||
# Convert shell return code to "PASS" or "FAIL" | ||
# (0 = PASS, all other return codes = FAIL) | ||
function check_return() { | ||
if [ $1 -eq 0 ]; then | ||
echo "PASS" | ||
else | ||
echo "FAIL" | ||
fi | ||
|
||
} | ||
|
||
################################################# | ||
|
||
# Output test results | ||
function print_status() { | ||
TEST_CNT=$((TEST_CNT+1)) | ||
if [ "${STATUS}" == "FAIL" ]; then | ||
FAIL_CNT=$((FAIL_CNT+1)) | ||
fi | ||
echo "${TEST_CNT}. $1: ${STATUS}" | ||
} | ||
|
||
################################################# | ||
|
||
############### | ||
# Global Vars # | ||
############### | ||
|
||
MARBL_ROOT=`(cd ..; pwd -P)` | ||
OUTFILE=${MARBL_ROOT}/.test.out | ||
TEST_CNT=0 | ||
FAIL_CNT=0 | ||
echo "Test Results:" > $OUTFILE | ||
|
||
######### | ||
# TESTS # | ||
######### | ||
|
||
# Convert YAML to JSON | ||
cd ${MARBL_ROOT}/MARBL_tools | ||
echo "$ ./yaml_to_json.py" | ||
./yaml_to_json.py | ||
STATUS=$(check_return $?) | ||
print_status "yaml_to_json.py" >> $OUTFILE | ||
|
||
# Generate a settings file (python) | ||
cd ${MARBL_ROOT}/MARBL_tools | ||
echo "$ ./MARBL_generate_settings_file.py" | ||
./MARBL_generate_settings_file.py | ||
STATUS=$(check_return $?) | ||
print_status "MARBL_generate_settings_file.py" >> $OUTFILE | ||
|
||
# Test MARBL_generate_diagnostics_file.py | ||
cd ${MARBL_ROOT}/MARBL_tools | ||
echo "$ ./MARBL_generate_diagnostics_file.py" | ||
./MARBL_generate_diagnostics_file.py | ||
STATUS=$(check_return $?) | ||
print_status "MARBL_generate_diagnostics_file.py" >> $OUTFILE | ||
|
||
# Clean Fortran Code | ||
cd ${MARBL_ROOT}/tests/driver_src | ||
echo "$ make clean" | ||
make clean | ||
STATUS=$(check_return $?) | ||
print_status "make clean" >> $OUTFILE | ||
|
||
# Build libmarbl.a | ||
cd ${MARBL_ROOT}/tests/bld_tests | ||
echo "$ ./bld_lib.py --no_pause" | ||
./bld_lib.py --no_pause | ||
STATUS=$(check_return $?) | ||
print_status "bld_lib.py --no_pause" >> $OUTFILE | ||
|
||
# Build stand-alone executable (only if library built successfully) | ||
if [ "${STATUS}" == "PASS" ]; then | ||
cd ${MARBL_ROOT}/tests/bld_tests | ||
echo "$ ./bld_exe.py --no_pause" | ||
./bld_exe.py --no_pause | ||
STATUS=$(check_return $?) | ||
print_status "bld_exe.py --no_pause" >> $OUTFILE | ||
fi | ||
|
||
# Only test Fortran executable if build was successful | ||
if [ "${STATUS}" == "PASS" ]; then | ||
# get_put unit test | ||
cd ${MARBL_ROOT}/tests/unit_tests/get_put | ||
echo "$ ./get_put.py" | ||
./get_put.py | ||
STATUS=$(check_return $?) | ||
print_status "get_put.py" >> $OUTFILE | ||
|
||
# marbl_utils unit test | ||
cd ${MARBL_ROOT}/tests/unit_tests/utils_routines | ||
echo "$ ./marbl_utils.py" | ||
./marbl_utils.py | ||
STATUS=$(check_return $?) | ||
print_status "marbl_utils.py" >> $OUTFILE | ||
|
||
# Initialize MARBL | ||
cd ${MARBL_ROOT}/tests/regression_tests/init | ||
echo "$ ./init.py" | ||
./init.py | ||
STATUS=$(check_return $?) | ||
print_status "init.py" >> $OUTFILE | ||
|
||
# Initialize MARBL, clean up memory, initialize again | ||
cd ${MARBL_ROOT}/tests/regression_tests/init-twice | ||
echo "$ ./init-twice.py" | ||
./init-twice.py | ||
STATUS=$(check_return $?) | ||
print_status "init-twice.py" >> $OUTFILE | ||
|
||
# Generate a settings file (Fortran) | ||
cd ${MARBL_ROOT}/tests/regression_tests/gen_input_file | ||
echo "$ ./gen_input_file.py" | ||
./gen_input_file.py | ||
STATUS=$(check_return $?) | ||
print_status "gen_input_file.py" >> $OUTFILE | ||
|
||
# Print all diagnostics MARBL can provide | ||
cd ${MARBL_ROOT}/tests/regression_tests/requested_diags | ||
echo "$ ./requested_diags.py" | ||
./requested_diags.py | ||
STATUS=$(check_return $?) | ||
print_status "requested_diags.py" >> $OUTFILE | ||
|
||
# Print all forcings MARBL requires | ||
cd ${MARBL_ROOT}/tests/regression_tests/requested_forcings | ||
echo "$ ./requested_forcings.py" | ||
./requested_forcings.py | ||
STATUS=$(check_return $?) | ||
print_status "requested_forcings.py" >> $OUTFILE | ||
|
||
# Print all restoring fields being requested | ||
cd ${MARBL_ROOT}/tests/regression_tests/requested_restoring | ||
echo "$ ./requested_restoring.py" | ||
./requested_restoring.py -i ${MARBL_ROOT}/tests/input_files/marbl_with_restore.input | ||
STATUS=$(check_return $?) | ||
print_status "requested_restoring.py" >> $OUTFILE | ||
|
||
# Print all tracers MARBL computes tendencies for | ||
cd ${MARBL_ROOT}/tests/regression_tests/requested_tracers | ||
echo "$ ./requested_tracers.py" | ||
./requested_tracers.py | ||
STATUS=$(check_return $?) | ||
print_status "requested_tracers.py" >> $OUTFILE | ||
fi | ||
|
||
echo "----" | ||
cat $OUTFILE | ||
rm -f $OUTFILE | ||
echo "" | ||
echo "${TEST_CNT} tests were run, and $FAIL_CNT failed." | ||
exit ${FAIL_CNT} | ||
|
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,3 @@ | ||
Sphinx==1.7.5 | ||
sphinx-rtd-theme==0.2.5b1 | ||
sphinxcontrib-bibtex==0.4.0 |
This file was deleted.
Oops, something went wrong.
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
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
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 |
---|---|---|
@@ -1,3 +1,5 @@ | ||
tracer_restore_vars(1) = 'SiO3' | ||
tracer_restore_vars(2) = 'NO3' | ||
tracer_restore_vars(3) = 'PO4' | ||
tracer_restore_vars(4) = 'ALK' | ||
tracer_restore_vars(5) = 'ALK_ALT_CO2' |
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