-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactor C-I test scripts and update Dockerfile to avoid issues
.ci-pipelines/ci-common-defs.sh - Abstracted reusable code into this script, which is sourced by the other C-I test scripts. - Renamed ALL_TESTS to GENERAL_TESTS - Now put the X_minver test in the MINVERSION_TEST variable .ci-pipelines/ci-cleanup-script.sh .ci-pipelines/ci-testing-script.sh - Now gets common variables & functions from ci-common-defs.sh - Now execute the test for #MINVERSION separately - Now uses #!/bin/bash instead of #!/bin/sh - Now uses absolute paths instead of relative paths ./ci-manual-cleanup-script.sh ./ci-manual-testing-script.sh - Removed ./ci-pipelines/Dockerfile - Updated comments - Add commands to make sure ci-common-defs.sh and ci-testing-script.sh are made executable Signed-off-by: Bob Yantosca <yantosca@seas.harvard.edu>
- Loading branch information
Showing
7 changed files
with
177 additions
and
153 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,26 @@ | ||
#!/bin/bash | ||
|
||
######################################################################## | ||
### C-I test cleanup script for github.com/KineticPreProcessor/KPP ### | ||
### ### | ||
### Use this if you have run the C-I tests manually, and wish to ### | ||
### remove compiled files (*.o, *.mod, *.exe) from C-I test folders. ### | ||
######################################################################## | ||
|
||
# Load common variables and functions | ||
. ${KPP_HOME}/.ci-pipelines/ci-common-defs.sh | ||
|
||
# Current directory | ||
cwd=$(pwd -P) | ||
|
||
# Clean up files in each C-I test folder | ||
for this_test in ${GENERAL_TESTS}; do | ||
clean_ci_test_folder "${this_test}" "${cwd}" | ||
done | ||
|
||
# Remove any log files used to store C-I test results | ||
cd $cwd | ||
rm -fv *log* | ||
|
||
# Return w/ success | ||
exit 0 |
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,128 @@ | ||
######################################################################## | ||
### Common variables and functions for the C-I tests ### | ||
######################################################################## | ||
|
||
#======================================================================= | ||
# Lists of C-I tests | ||
#======================================================================= | ||
|
||
# Testing different mechanisms | ||
GENERAL_TESTS="C_rk | ||
C_rosadj | ||
C_sd | ||
C_sdadj | ||
C_small_strato | ||
F90_lsode | ||
F90_radau | ||
F90_rk | ||
F90_rktlm | ||
F90_ros | ||
F90_rosadj | ||
F90_ros_autoreduce | ||
F90_rosenbrock | ||
F90_ros_split | ||
F90_rostlm | ||
F90_ros_upcase | ||
F90_saprc_2006 | ||
F90_sd | ||
F90_sdadj | ||
F90_seulex | ||
F90_small_strato | ||
" | ||
# Testing if #MINVERSION works | ||
MINVERSION_TEST="X_minver" | ||
|
||
#======================================================================= | ||
# Functions | ||
#======================================================================= | ||
|
||
# Returns the path to a C-I test folder | ||
function get_ci_test_path() { | ||
echo "${KPP_HOME}/ci-tests/${1}" | ||
return | ||
} | ||
|
||
# Run a C-I test | ||
function run_ci_test() { | ||
|
||
# Arguments | ||
this_test=${1} # Name of test | ||
return_dir=${2} # Directory where we will return upon test completion | ||
|
||
# Navigate to C-I test folder (or exit if error) | ||
test_path=$(get_ci_test_path "${this_test}") | ||
cd $test_path | ||
[[ $? -ne 0 ]] && exit 1 | ||
|
||
echo "" | ||
echo ">>>>>>>> Generating ${this_test} mechanism with KPP <<<<<<<<" | ||
echo "" | ||
${KPP_HOME}/bin/kpp $this_test.kpp | ||
[[ $? -ne 0 ]] && exit 1 | ||
|
||
echo "" | ||
echo ">>>>>>>> Building the ${this_test} test executable <<<<<<<<<" | ||
echo "" | ||
make -j -f Makefile_$this_test COMPILER=GFORTRAN | ||
[[ $? -ne 0 ]] && exit 1 | ||
|
||
echo "" | ||
echo ">>>>>>>> Running the ${this_test} test <<<<<<<<" | ||
echo "" | ||
./$this_test.exe | ||
[[ $? -ne 0 ]] && exit 1 | ||
|
||
echo "" | ||
echo ">>>>>>>> ${this_test} test was successful! <<<<<<<<" | ||
echo "" | ||
|
||
# Navigate back to original path and return w/ success | ||
cd $return_dir | ||
} | ||
|
||
# Test if the #MINVERSION command works | ||
function run_minversion_ci_test() { | ||
|
||
# Arguments | ||
this_test=${1} # Name of test | ||
return_dir=${2} # Directory where we will return upon test completion | ||
|
||
# Navigate to test folder (or exit if error) | ||
test_path=$(get_ci_test_path "${MINVERSION_TEST}") | ||
cd ${test_path} | ||
[[ $? -ne 0 ]] && exit 1 | ||
|
||
# Build the mechanism with KPP | ||
echo "" | ||
echo ">>>>>>>> Generating ${this_test} mechanism with KPP <<<<<<<<" | ||
echo "" | ||
${KPP_HOME}/bin/kpp ${MINVERSION_TEST}.kpp | ||
|
||
# Navigate back to original path and return w/ success | ||
cd $return_dir | ||
} | ||
|
||
# Removes compiled files in C-I test folders | ||
function clean_ci_test_folder() { | ||
|
||
# Arguments | ||
this_test=${1} # Name of test | ||
return_dir=${2} # Directory where we will return upon test completion | ||
|
||
# Navigate to test folder (or exit if error) | ||
test_path=$(get_ci_test_path "${this_test}") | ||
cd ${test_path} | ||
[[ $? -ne 0 ]] && exit 1 | ||
|
||
echo "" | ||
echo ">>>>>>>> Making distclean for ${this_test} <<<<<<<<" | ||
echo "" | ||
make -f Makefile_${this_test} distclean | ||
|
||
# Also remove other output files from the tests | ||
rm -f *.m | ||
rm -f Makefile.${this_test} | ||
|
||
# Navigate back to original path and return w/ success | ||
cd ${cwd} | ||
} |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,45 +1,27 @@ | ||
#!/bin/sh | ||
#!/bin/bash | ||
|
||
######################################################################## | ||
### CI tests for github.com/KineticPreProcessor/KPP ### | ||
### C-I test script for github.com/KineticPreProcessor/KPP ### | ||
######################################################################## | ||
|
||
# Get the list of CI test folders in ALL_TESTS | ||
source /kpp/.ci-pipelines/ci-testing-list.sh | ||
# Load common variables and functions | ||
. ${KPP_HOME}/.ci-pipelines/ci-common-defs.sh | ||
|
||
# Run each test | ||
# Check status of each individual operation and exit if any do not complete | ||
for this_test in $ALL_TESTS; do | ||
|
||
cd /kpp/ci-tests/$this_test | ||
[ $? -ne 0 ] && exit 1 | ||
|
||
echo "" | ||
echo ">>>>>>>> Generating $this_test mechanism with KPP <<<<<<<<" | ||
echo "" | ||
../../bin/kpp $this_test.kpp | ||
[ $? -ne 0 ] && exit 1 | ||
|
||
echo "" | ||
echo ">>>>>>>> Building the $this_test test executable <<<<<<<<<" | ||
echo "" | ||
make -j -f Makefile_$this_test COMPILER=GFORTRAN | ||
[ $? -ne 0 ] && exit 1 | ||
|
||
echo "" | ||
echo ">>>>>>>> Running the $this_test test <<<<<<<<" | ||
echo "" | ||
./$this_test.exe | ||
[ $? -ne 0 ] && exit 1 | ||
|
||
echo "" | ||
echo ">>>>>>>> $this_test test was successful! <<<<<<<<" | ||
echo "" | ||
# Current directory | ||
cwd=$(pwd -P) | ||
|
||
# Run C-I tests with various mechanism + integrator combinations | ||
for this_test in ${GENERAL_TESTS}; do | ||
run_ci_test "${this_test}" "${cwd}" | ||
done | ||
|
||
# Run a C-I test to see if the #MINVERSION command works as advertised | ||
run_minversion_ci_test "${MINVERSION_TEST}" "${cwd}" | ||
|
||
# Return w/ success | ||
echo "" | ||
echo ">>>>>>>> All tests finished succesfully! <<<<<<<<" | ||
echo "" | ||
|
||
# Return with success | ||
exit 0 |