Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions CIME/SystemTests/funit.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,13 @@ def get_test_spec_dir(self):
"""
return get_cime_root()

def get_extra_run_tests_args(self):
"""
Override this to return a string containing extra command-line arguments to
run_tests.py
"""
return ""

def run_phase(self):

rundir = self._case.get_value("RUNDIR")
Expand All @@ -51,8 +58,9 @@ def run_phase(self):
get_cime_root(), "scripts", "fortran_unit_testing", "run_tests.py"
)
)
args = "--build-dir {} --test-spec-dir {} --machine {}".format(
exeroot, test_spec_dir, mach
extra_args = self.get_extra_run_tests_args()
args = "--build-dir {} --test-spec-dir {} --machine {} {}".format(
exeroot, test_spec_dir, mach, extra_args
)

stat = run_cmd(
Expand Down
11 changes: 9 additions & 2 deletions CIME/XML/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,20 @@ def __init__(self, infile=None, files=None):
files = Files()
infile = files.get_value("CONFIG_TESTS_FILE")
GenericXML.__init__(self, infile)
# append any component specific config_tests.xml files

# Append any component-specific config_tests.xml files. We take care to only add a
# given file once, since adding a given file multiple times creates a "multiple
# matches" error. (This can happen if multiple CONFIG_TESTS_FILEs resolve to the
# same path.)
files_added = set()
for comp in files.get_components("CONFIG_TESTS_FILE"):
if comp is None:
continue
infile = files.get_value("CONFIG_TESTS_FILE", attribute={"component": comp})
if os.path.isfile(infile):
infile_abspath = os.path.abspath(infile)
if os.path.isfile(infile) and infile_abspath not in files_added:
self.read(infile)
files_added.add(infile_abspath)

def support_single_exe(self, case):
"""Checks if case supports --single-exe.
Expand Down
2 changes: 2 additions & 0 deletions CIME/data/config/cesm/config_files.xml
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@
<values>
<value>$CIMEROOT/CIME/data/config/config_tests.xml</value>
<!-- component specific config_tests files -->
<value component="allactive">$SRCROOT/cime_config/config_tests.xml</value>
<value component="clm">$COMP_ROOT_DIR_LND/cime_config/config_tests.xml</value>
<value component="slim">$COMP_ROOT_DIR_LND/cime_config/config_tests.xml</value>
<value component="cam">$COMP_ROOT_DIR_ATM/cime_config/config_tests.xml</value>
Expand Down Expand Up @@ -371,6 +372,7 @@
<type>char</type>
<values>
<value component="any" >$CIMEROOT/CIME/SystemTests</value>
<value component="allactive" >$SRCROOT/cime_config/SystemTests</value>
<value component="clm" >$COMP_ROOT_DIR_LND/cime_config/SystemTests</value>
<value component="cam" >$COMP_ROOT_DIR_ATM/cime_config/SystemTests</value>
<value component="pop" >$COMP_ROOT_DIR_OCN/cime_config/SystemTests</value>
Expand Down
64 changes: 43 additions & 21 deletions CIME/tests/test_unit_xml_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,16 +32,27 @@ def test_support_single_exe(self, _setup_cases_if_not_yet_done):

case.get_compset_components.return_value = ()

case.get_value.side_effect = (
"SMS",
tdir,
f"{caseroot}",
"SMS.f19_g16.S",
"cpl",
"SMS.f19_g16.S",
f"{caseroot}",
"SMS.f19_g16.S",
)
def fake_get_value(item, attribute=None):
simple_lookup = {
"TESTCASE": "SMS",
"CASEROOT": f"{caseroot}",
"CASEBASEID": "SMS.f19_g16.S",
"COMP_INTERFACE": "cpl",
"DRV_RESTART_POINTER": None,
}
if item in simple_lookup:
return simple_lookup[item]
elif item == "SYSTEM_TESTS_DIR":
if attribute["component"] == "any":
return tdir
else:
return None

raise KeyError(
f"Unmocked call: case.get_value({item}, attribute={attribute})"
)

case.get_value.side_effect = fake_get_value

tests = Tests()

Expand All @@ -65,17 +76,28 @@ def test_support_single_exe_error(self, _setup_cases_if_not_yet_done):

case.get_compset_components.return_value = ()

case.get_value.side_effect = (
"ERP",
tdir,
f"{caseroot}",
"ERP.f19_g16.S",
"cpl",
None,
"ERP.f19_g16.S",
f"{caseroot}",
"ERP.f19_g16.S",
)
def fake_get_value(item, attribute=None):
simple_lookup = {
"TESTCASE": "ERP",
"CASEROOT": f"{caseroot}",
"CASEBASEID": "ERP.f19_g16.S",
"CASE": "ERP.f19_g16.S",
"COMP_INTERFACE": "cpl",
"DRV_RESTART_POINTER": None,
}
if item in simple_lookup:
return simple_lookup[item]
elif item == "SYSTEM_TESTS_DIR":
if attribute["component"] == "any":
return tdir
else:
return None

raise KeyError(
f"Unmocked call: case.get_value({item}, attribute={attribute})"
)

case.get_value.side_effect = fake_get_value

tests = Tests()

Expand Down
7 changes: 6 additions & 1 deletion CIME/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -2267,7 +2267,7 @@ def find_system_test(testname, case):
if testname.startswith("TEST"):
system_test_path = "CIME.SystemTests.system_tests_common.{}".format(testname)
else:
components = ["any"]
components = ["any", "allactive"]
components.extend(case.get_compset_components())
fdir = []
for component in components:
Expand All @@ -2276,6 +2276,11 @@ def find_system_test(testname, case):
)
if tdir is not None:
tdir = os.path.abspath(tdir)
if tdir in fdir:
# This can happen if multiple SYSTEM_TESTS_DIRs resolve to the same
# path; in this case, we just want to handle the first occurrence and
# skip the rest.
continue
system_test_file = os.path.join(tdir, "{}.py".format(testname.lower()))
if os.path.isfile(system_test_file):
fdir.append(tdir)
Expand Down
Loading