Skip to content
Merged
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
52 changes: 34 additions & 18 deletions CIME/test_scheduler.py
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,20 @@ def _order_tests_by_runtime(tests, baseline_root):
)


###############################################################################
def _run_cmpgen_namelists(test_dir):
###############################################################################
env = os.environ.copy()
env["PYTHONPATH"] = f"{get_cime_root()}:{get_tools_path()}"
cmdstat, output, _ = run_cmd(
"./case.cmpgen_namelists",
combine_output=True,
from_dir=test_dir,
env=env,
)
return cmdstat, output


###############################################################################
class TestScheduler(object):
###############################################################################
Expand Down Expand Up @@ -998,24 +1012,11 @@ def _setup_phase(self, test):
test, "./case.setup", SETUP_PHASE, from_dir=test_dir
)

# It's OK for this command to fail with baseline diffs but not catastrophically
# cmpgen_namelists is called again with checks later in _setup_phase(). This call is
# necessary for the correct behavior of --skip-tests-with-existing-baselines, and we don't
# need to check it for errors.
if rv[0]:
env = os.environ.copy()
env["PYTHONPATH"] = f"{get_cime_root()}:{get_tools_path()}"
cmdstat, output, _ = run_cmd(
"./case.cmpgen_namelists",
combine_output=True,
from_dir=test_dir,
env=env,
)
try:
expect(
cmdstat in [0, TESTS_FAILED_ERR_CODE],
"Fatal error in case.cmpgen_namelists: {}".format(output),
)
except Exception:
self._update_test_status_file(test, SETUP_PHASE, TEST_FAIL_STATUS)
raise
_run_cmpgen_namelists(test_dir)

if self._single_exe:
with Case(self._get_test_dir(test), read_only=False) as case:
Expand Down Expand Up @@ -1046,13 +1047,28 @@ def _sharedlib_build_phase(self, test):
)

test_dir = self._get_test_dir(test)
return self._shell_cmd_for_phase(
result = self._shell_cmd_for_phase(
test,
"./case.build --sharedlib-only",
SHAREDLIB_BUILD_PHASE,
from_dir=test_dir,
)

# It's OK for this command to fail with baseline diffs but not catastrophically
env = os.environ.copy()
env["PYTHONPATH"] = f"{get_cime_root()}:{get_tools_path()}"
cmdstat, output = _run_cmpgen_namelists(test_dir)
try:
expect(
cmdstat in [0, TESTS_FAILED_ERR_CODE],
"Fatal error in case.cmpgen_namelists: {}".format(output),
)
except Exception:
self._update_test_status_file(test, SETUP_PHASE, TEST_FAIL_STATUS)
raise

return result

###########################################################################
def _get_build_group(self, test):
###########################################################################
Expand Down
Loading