Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve handling of hist comparisons in TestStatus.log #1606

Merged
merged 3 commits into from
May 25, 2017
Merged
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
4 changes: 2 additions & 2 deletions scripts/lib/CIME/SystemTests/pre.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ def _case_two_setup(self):
self._case.set_value("PAUSE_N", pausen)
comps = [ x.lower() for x in self._case.get_values("COMP_CLASSES") ]
pcl = self._case.get_value("PAUSE_COMPONENT_LIST")
expect(pcl == "all" or set(pcl.split(':')).issubset(comps),
expect(pcl == "all" or set(pcl.split(':')).issubset(comps),
"PRE ERROR: Invalid PAUSE_COMPONENT_LIST, '%s'"%pcl)

self._case.flush()
Expand Down Expand Up @@ -101,7 +101,7 @@ def run_phase(self):
expect((len(restart_files_2) == 1),
"Missing case2 restart file, %s", glob_str)
rfile2 = restart_files_2[0]
ok, out = cprnc(comp, rfile1, rfile2, self._case, rundir2) # pylint: disable=unused-variable
ok = cprnc(comp, rfile1, rfile2, self._case, rundir2)[0]
logger.warning("CPRNC result for %s: %s"%(os.path.basename(rfile1), "PASS" if (ok == should_match) else "FAIL"))
compare_ok = compare_ok and (should_match == ok)

Expand Down
14 changes: 9 additions & 5 deletions scripts/lib/CIME/hist_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,7 @@ def _compare_hists(case, from_dir1, from_dir2, suffix1="", suffix2="", outfile_s
expect(suffix1 != suffix2, "Comparing files to themselves?")

testcase = case.get_value("CASE")
casedir = case.get_value("CASEROOT")
all_success = True
num_compared = 0
comments = "Comparing hists for case '%s' dir1='%s', suffix1='%s', dir2='%s' suffix2='%s'\n" % \
Expand All @@ -204,20 +205,23 @@ def _compare_hists(case, from_dir1, from_dir2, suffix1="", suffix2="", outfile_s
num_compared += len(match_ups)

for hist1, hist2 in match_ups:
success, cprnc_comments = cprnc(model, hist1, hist2, case, from_dir1,
success, cprnc_log_file = cprnc(model, hist1, hist2, case, from_dir1,
multiinst_cpl_compare = multiinst_cpl_compare,
outfile_suffix = outfile_suffix)
if success:
comments += " %s matched %s\n" % (hist1, hist2)
else:
comments += " %s did NOT match %s\n" % (hist1, hist2)
comments += cprnc_comments + "\n"
comments += " cat " + cprnc_log_file + "\n"
shutil.copy(cprnc_log_file, casedir)
all_success = False

if num_compared == 0:
all_success = False
comments += "Did not compare any hist files! Missing baselines?\n"

comments += "PASS" if all_success else "FAIL"

return all_success, comments

def compare_test(case, suffix1, suffix2):
Expand Down Expand Up @@ -245,7 +249,7 @@ def cprnc(model, file1, file2, case, rundir, multiinst_cpl_compare=False, outfil
outfile_suffix - if non-blank, then the output file name ends with this
suffix (with a '.' added before the given suffix)

returns True if the files matched
returns (True if the files matched, log_name)
"""
cprnc_exe = case.get_value("CCSM_CPRNC")
basename = os.path.basename(file1)
Expand Down Expand Up @@ -276,9 +280,9 @@ def cprnc(model, file1, file2, case, rundir, multiinst_cpl_compare=False, outfil
# dimensions and so cprnc will indicate that the files seem to be DIFFERENT
# in this case we only want to check that the fields we are able to compare
# have no differences.
return (cpr_stat == 0 and " 0 had non-zero differences" in out, out)
return (cpr_stat == 0 and " 0 had non-zero differences" in out, output_filename)
else:
return (cpr_stat == 0 and "files seem to be IDENTICAL" in out, out)
return (cpr_stat == 0 and "files seem to be IDENTICAL" in out, output_filename)

def compare_baseline(case, baseline_dir=None, outfile_suffix=""):
"""
Expand Down
13 changes: 8 additions & 5 deletions scripts/lib/CIME/wait_for_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -152,14 +152,17 @@ def create_cdash_upload_xml(results, cdash_build_name, cdash_build_group, utc_ti
if (test_status not in [TEST_PASS_STATUS, NAMELIST_FAIL_STATUS]):
ts = TestStatus(os.path.dirname(test_path))

build_status = ts.get_status(MODEL_BUILD_PHASE)
run_status = ts.get_status(RUN_PHASE)
if ( build_status == TEST_FAIL_STATUS or run_status == TEST_FAIL_STATUS ):
build_status = ts.get_status(MODEL_BUILD_PHASE)
run_status = ts.get_status(RUN_PHASE)
baseline_status = ts.get_status(BASELINE_PHASE)
if ( build_status == TEST_FAIL_STATUS or run_status == TEST_FAIL_STATUS or baseline_status == TEST_FAIL_STATUS):
param = "EXEROOT" if build_status == TEST_FAIL_STATUS else "RUNDIR"
src_dir = CIME.utils.run_cmd_no_fail("./xmlquery %s -value" % param, from_dir=os.path.dirname(test_path))
log_src_dir = CIME.utils.run_cmd_no_fail("./xmlquery %s -value" % param, from_dir=os.path.dirname(test_path))
log_dst_dir = os.path.join(log_dir, "%s_%s_logs" % (test_name, param))
os.makedirs(log_dst_dir)
for log_file in glob.glob(os.path.join(src_dir, "*log*")):
for log_file in glob.glob(os.path.join(log_src_dir, "*log*")):
shutil.copy(log_file, log_dst_dir)
for log_file in glob.glob(os.path.join(log_src_dir, "*.cprnc.out*")):
shutil.copy(log_file, log_dst_dir)

need_to_upload = True
Expand Down