Skip to content

Commit 6646095

Browse files
committed
Add SystemTest for FATES functional tests.
1 parent e425ffc commit 6646095

File tree

6 files changed

+70
-7
lines changed

6 files changed

+70
-7
lines changed

.gitmodules

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
[submodule "fates"]
2929
path = src/fates
3030
url = https://github.com/samsrabin/fates
31-
fxtag = c6ad0e63bcad0d0ab0ce8e19d04d812c584ad970
31+
fxtag = 4c334ac44f731d6922d10dd3fbc1339c077bf5ad
3232
fxrequired = AlwaysRequired
3333
# Standard Fork to compare to with "git fleximod test" to ensure personal forks aren't committed
3434
fxDONOTUSEurl = https://github.com/NGEET/fates
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
"""
2+
Implementation of the FATES functional tests.
3+
4+
This "system" test runs FATES's Fortran functional tests. We're abusing the system test
5+
infrastructure to run these, so that a run of the test suite can result in the unit tests
6+
being run as well.
7+
8+
Grid and compset are irrelevant for this test type.
9+
"""
10+
11+
import os
12+
import sys
13+
from CIME.SystemTests.funit import FUNIT
14+
from CIME.XML.standard_module_setup import *
15+
import systemtest_utils as stu
16+
17+
_FATES_TESTING_PYTHON = os.path.join(
18+
os.path.dirname(os.path.realpath(__file__)), os.pardir, os.pardir, "src", "fates", "testing"
19+
)
20+
21+
logger = logging.getLogger(__name__)
22+
23+
24+
class FUNCTIONALFATES(FUNIT):
25+
def __init__(self, case):
26+
FUNIT.__init__(self, case)
27+
28+
def run_phase(self):
29+
tool_path = os.path.join(_FATES_TESTING_PYTHON, "run_functional_tests.py")
30+
build_dir = os.path.join("bld", "fates_unit_tests")
31+
run_dir = "run"
32+
cmd = f"{tool_path} -b {build_dir} -r {run_dir} --save-figs"
33+
34+
stu.run_python_script(
35+
self._get_caseroot(),
36+
"ctsm_pylib",
37+
cmd,
38+
tool_path,
39+
)

cime_config/config_tests.xml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,15 @@ This defines various CTSM-specific system tests
2424
<DOUT_S>FALSE</DOUT_S>
2525
</test>
2626

27+
<test NAME="FUNCTIONALFATES">
28+
<DESC>Run FATES's Fortran functional tests. Grid and compset (and most case settings) are ignored.</DESC>
29+
<INFO_DBUG>1</INFO_DBUG>
30+
<STOP_OPTION>ndays</STOP_OPTION>
31+
<STOP_N>11</STOP_N>
32+
<CHECK_TIMING>FALSE</CHECK_TIMING>
33+
<DOUT_S>FALSE</DOUT_S>
34+
</test>
35+
2736
<test NAME="MKSURFDATAESMF">
2837
<DESC>Build and run the mksurfdata_esmf tool to generate a new fsurdat; then run the CTSM with this fsurdat</DESC>
2938
<INFO_DBUG>1</INFO_DBUG>

cime_config/testdefs/testlist_clm.xml

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4151,7 +4151,22 @@
41514151
</machines>
41524152
<options>
41534153
<option name="wallclock">00:30:00</option>
4154-
<option name="comment">This test runs FATES's Fortran unit tests. We're abusing the system test infrastructure to run these, so that a run of the test suite results in the unit tests being run as well. Grid and compset are irrelevant here, except that compset must be one that includes FATES in order for CIME to find the test definition.</option>
4154+
<option name="comment">This test runs FATES's Fortran unit tests. We're abusing the system test infrastructure to run these, so that a run of the test suite results in the unit tests being run as well. Grid and compset are irrelevant here, except that compset must be one that includes CTSM in order for CIME to find the test definition.</option>
4155+
</options>
4156+
</test>
4157+
4158+
<test name="FUNCTIONALFATES_P1x1" grid="f10_f10_mg37" compset="I2000Clm50Sp">
4159+
<machines>
4160+
<machine name="derecho" compiler="intel" category="aux_clm"/>
4161+
<machine name="izumi" compiler="intel" category="aux_clm"/>
4162+
<machine name="derecho" compiler="intel" category="fates"/>
4163+
<machine name="izumi" compiler="intel" category="fates"/>
4164+
<machine name="derecho" compiler="intel" category="unit_tests"/>
4165+
<machine name="izumi" compiler="intel" category="unit_tests"/>
4166+
</machines>
4167+
<options>
4168+
<option name="wallclock">00:30:00</option>
4169+
<option name="comment">This test runs FATES's Fortran functional tests. We're abusing the system test infrastructure to run these, so that a run of the test suite results in the unit tests being run as well. Grid and compset are irrelevant here, except that compset must be one that includes CTSM in order for CIME to find the test definition.</option>
41554170
</options>
41564171
</test>
41574172

python/ctsm/run_sys_tests.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -749,13 +749,13 @@ def _check_py_env(test_attributes):
749749
except ModuleNotFoundError as err:
750750
raise ModuleNotFoundError("modify_fsurdat" + err_msg) from err
751751

752-
# Check requirements for FUNITFATES, if needed
753-
if any("FUNITFATES" in t for t in test_attributes):
752+
# Check requirements for FUNCTIONALFATES, if needed
753+
if any("FUNCTIONALFATES" in t for t in test_attributes):
754754
add_fates_testing_to_path()
755755
try:
756-
import run_unit_tests
756+
import run_functional_tests
757757
except ModuleNotFoundError as err:
758-
raise ModuleNotFoundError("FATES run_unit_tests" + err_msg) from err
758+
raise ModuleNotFoundError("FATES run_functional_tests" + err_msg) from err
759759

760760
# Check requirements for RXCROPMATURITY, if needed
761761
if any("RXCROPMATURITY" in t for t in test_attributes):

0 commit comments

Comments
 (0)