Skip to content

Commit

Permalink
Merge pull request ESMCI#4478 from jedwards4b/support_machine_compile…
Browse files Browse the repository at this point in the history
…r_wildcards

support wildcard for machine and compiler name with meaning current d…
  • Loading branch information
jedwards4b authored Aug 21, 2023
2 parents 35bfbae + a7913e3 commit b4ed025
Showing 1 changed file with 21 additions and 7 deletions.
28 changes: 21 additions & 7 deletions CIME/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,7 @@ def _read_cime_config_file():
cime_config_file = os.path.abspath(
os.path.join(os.path.expanduser("~"), ".cime", "config")
)
cime_config = configparser.SafeConfigParser()
cime_config = configparser.ConfigParser()
if os.path.isfile(cime_config_file):
cime_config.read(cime_config_file)
for section in cime_config.sections():
Expand Down Expand Up @@ -661,8 +661,8 @@ def import_and_run_sub_or_cmd(
run_sub_or_cmd(
cmd, cmdargs, subname, subargs, logfile, case, from_dir, timeout
)
except Exception as e:
raise e from None
except Exception as e1:
raise e1 from None
except Exception:
if logfile:
with open(logfile, "a") as log_fd:
Expand Down Expand Up @@ -1014,6 +1014,12 @@ def parse_test_name(test_name):
['ERS', None, 'fe12_123', 'JGF', 'machine', 'compiler', None]
>>> parse_test_name('ERS.fe12_123.JGF.machine_compiler.test-mods')
['ERS', None, 'fe12_123', 'JGF', 'machine', 'compiler', ['test/mods']]
>>> parse_test_name('ERS.fe12_123.JGF.*_compiler.test-mods')
['ERS', None, 'fe12_123', 'JGF', None, 'compiler', ['test/mods']]
>>> parse_test_name('ERS.fe12_123.JGF.machine_*.test-mods')
['ERS', None, 'fe12_123', 'JGF', 'machine', None, ['test/mods']]
>>> parse_test_name('ERS.fe12_123.JGF.*_*.test-mods')
['ERS', None, 'fe12_123', 'JGF', None, None, ['test/mods']]
>>> parse_test_name('ERS.fe12_123.JGF.machine_compiler.test-mods--other-dir-path--and-one-more')
['ERS', None, 'fe12_123', 'JGF', 'machine', 'compiler', ['test/mods', 'other/dir/path', 'and/one/more']]
>>> parse_test_name('SMS.f19_g16.2000_DATM%QI.A_XLND_SICE_SOCN_XROF_XGLC_SWAV.mach-ine_compiler.test-mods') # doctest: +IGNORE_EXCEPTION_DETAIL
Expand Down Expand Up @@ -1047,6 +1053,10 @@ def parse_test_name(test_name):
),
)
rv[4:5] = rv[4].split("_")
if rv[4] == "*":
rv[4] = None
if rv[5] == "*":
rv[5] = None
rv.pop()

if rv[-1] is not None:
Expand Down Expand Up @@ -1139,7 +1149,6 @@ def get_full_test_name(
]

result = partial_test

for partial_val, arg_val, name in required_fields:
if partial_val is None:
# Add to result based on args
Expand All @@ -1149,9 +1158,14 @@ def get_full_test_name(
partial_test, name
),
)
result = "{}{}{}".format(
result, "_" if name == "compiler" else ".", arg_val
)
if name == "machine" and "*_" in result:
result = result.replace("*_", arg_val + "_")
elif name == "compiler" and "_*" in result:
result = result.replace("_*", "_" + arg_val)
else:
result = "{}{}{}".format(
result, "_" if name == "compiler" else ".", arg_val
)
elif arg_val is not None and partial_val != partial_compiler:
expect(
arg_val == partial_val,
Expand Down

0 comments on commit b4ed025

Please sign in to comment.