forked from NCAR/wrf_hydro_nwm_public
-
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.
Adding ctest structure and two basic tests. Adding ability to run $ m…
…ake croton to download Croton testcase, extract tarball and setup. Makefile copied to Run directory. Cleanup of Run directory handled differently. (NCAR#702) Croton CMake tests: adding ability to choose the different test options as a Makefile target
- Loading branch information
1 parent
97f245d
commit a821261
Showing
8 changed files
with
144 additions
and
5 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
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,34 @@ | ||
# add Makefile target to setup test runs | ||
# - croton test options: {Gridded, Gridded_no_lakes, NWM, Reach, ReachLakes} | ||
add_custom_target(croton | ||
COMMAND bash | ||
${CMAKE_CURRENT_SOURCE_DIR}/setup_cmake_testcase.sh Gridded ${CMAKE_BINARY_DIR}) | ||
add_custom_target(croton-gridded | ||
COMMAND bash | ||
${CMAKE_CURRENT_SOURCE_DIR}/setup_cmake_testcase.sh Gridded ${CMAKE_BINARY_DIR}) | ||
add_custom_target(croton-gridded-no-lakes | ||
COMMAND bash | ||
${CMAKE_CURRENT_SOURCE_DIR}/setup_cmake_testcase.sh Gridded_no_lakes ${CMAKE_BINARY_DIR}) | ||
add_custom_target(croton-nwm | ||
COMMAND bash | ||
${CMAKE_CURRENT_SOURCE_DIR}/setup_cmake_testcase.sh NWM ${CMAKE_BINARY_DIR}) | ||
add_custom_target(croton-reach | ||
COMMAND bash | ||
${CMAKE_CURRENT_SOURCE_DIR}/setup_cmake_testcase.sh Reach ${CMAKE_BINARY_DIR}) | ||
add_custom_target(croton-reach-lakes | ||
COMMAND bash | ||
${CMAKE_CURRENT_SOURCE_DIR}/setup_cmake_testcase.sh ReachLakes ${CMAKE_BINARY_DIR}) | ||
|
||
|
||
# generic ctests | ||
add_executable(fortran_ctest_should_fail | ||
should_fail.f90) | ||
add_test(NAME fortran_ctest_should_fail | ||
COMMAND fortran_ctest_should_fail) | ||
set_tests_properties(fortran_ctest_should_fail | ||
PROPERTIES WILL_FAIL TRUE) | ||
|
||
add_executable(fortran_ctest_should_not_fail | ||
should_not_fail.f90) | ||
add_test(NAME fortran_ctest_should_not_fail | ||
COMMAND fortran_ctest_should_not_fail) |
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,29 @@ | ||
# this file is to be copied into the CMake ${CMAKE_BINARY_DIR}/Run/ directory | ||
all: build | ||
|
||
build: | ||
make -C .. | ||
|
||
run: | ||
./wrf_hydro.exe | ||
|
||
# download and extract Croton, NY test case to Run directory | ||
# testcase options: {Gridded, Gridded_no_lakes, NWM, Reach, ReachLakes} | ||
croton: | ||
make -C .. croton | ||
croton-gridded: | ||
make -C .. croton-gridded | ||
croton-gridded-no-lakes: | ||
make -C .. croton-gridded-no-lakes | ||
croton-nwm: | ||
make -C .. croton-nwm | ||
croton-reach: | ||
make -C .. croton-reach | ||
croton-reach-lakes: | ||
make -C .. croton-reach-lakes | ||
|
||
clean: | ||
rm -f *.LDASOUT_DOMAIN1 *.LAKEOUT_DOMAIN1 *.CHRTOUT_DOMAIN1 | ||
rm -f *.GWOUT_DOMAIN1 *.RTOUT_DOMAIN1 *.CHANOBS_DOMAIN1 | ||
rm -f RESTART.*_DOMAIN1 HYDRO_RST.*_DOMAIN1 | ||
rm -f diag_hydro.* |
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,36 @@ | ||
#!/bin/bash | ||
|
||
# Bash script is meant to be used by CMake. It downloads and extracts the | ||
# Croton, NY testcase to the CMake build Run directory. It then setups up the | ||
# files so ctest can run wrf_hydro.exe | ||
|
||
# setup directory variables in script | ||
# testcase_type values = {Gridded, Gridded_no_lakes, NWM, Reach, ReachLakes} | ||
testcase_type=${1} | ||
binary_dir=${2} | ||
test_file_dir=${binary_dir}/tests | ||
run_dir=${binary_dir}/Run | ||
|
||
# download testcase if not present | ||
croton_tarball=croton_NY_training_example_v5.2.tar.gz | ||
if [ ! -f ${test_file_dir}/${croton_tarball} ] | ||
then | ||
cd ${test_file_dir} | ||
wget -nv https://github.com/NCAR/wrf_hydro_nwm_public/releases/download/v5.2.0/${croton_tarball} | ||
fi | ||
|
||
# extract testcase | ||
cd ${run_dir} | ||
if [ ! -d example_case ] | ||
then | ||
tar zxf ${test_file_dir}/${croton_tarball} | ||
fi | ||
|
||
# setup testcase | ||
testcase=example_case/ | ||
testcase_dir=${testcase}/${testcase_type} | ||
cp ${testcase_dir}/hydro.namelist . | ||
cp ${testcase_dir}/namelist.hrldas . | ||
ln -sf ${testcase_dir}/DOMAIN . | ||
ln -sf ${testcase_dir}/RESTART . | ||
ln -sf ${testcase}/FORCING . |
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,4 @@ | ||
program should_fail | ||
implicit none | ||
error stop 1 | ||
end program should_fail |
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,4 @@ | ||
program should_not_fail | ||
implicit none | ||
stop | ||
end program should_not_fail |