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

compare two test case names match #1832

Merged
merged 6 commits into from
Aug 23, 2017
Merged
Show file tree
Hide file tree
Changes from 5 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
17 changes: 9 additions & 8 deletions scripts/lib/CIME/SystemTests/system_tests_compare_two.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,6 @@ def __init__(self,
self._case2 = None

self._setup_cases_if_not_yet_done()

# ========================================================================
# Methods that MUST be implemented by specific tests that inherit from this
# base class
Expand Down Expand Up @@ -195,13 +194,11 @@ def _get_caseroot2(self):
Assumes that self._case1 is already set to point to the case1 object,
and that self._run_two_suffix is already set.
"""
casename1 = self._case1.get_value("CASE")
casename2 = self._case1.get_value("CASE")
caseroot1 = self._case1.get_value("CASEROOT")

casename2 = "{}.{}".format(casename1, self._run_two_suffix)

# Nest the case directory for case2 inside the case directory for case1
caseroot2 = os.path.join(caseroot1, casename2)
caseroot2 = os.path.join(caseroot1, "case2", casename2)

return caseroot2

Expand Down Expand Up @@ -230,14 +227,17 @@ def _setup_cases_if_not_yet_done(self):
# test setup when it's not needed - e.g., by appending things to user_nl
# files multiple times. This is why we want to make sure to just do the
# test setup once.)

if os.path.exists(self._caseroot2):
self._case2 = self._case_from_existing_caseroot(self._caseroot2)
else:
try:
# Since case 2 has the same name as case1 its CIME_OUTPUT_ROOT must also be different
case2_output_root = os.path.join(self._case1.get_value("CIME_OUTPUT_ROOT"),
"case2",self._case1.get_value("CASE"))
self._case2 = self._case1.create_clone(
newcase = self._caseroot2,
keepexe = self._separate_builds==False)
keepexe = self._separate_builds==False,
cime_output_root = case2_output_root)
self._setup_cases()
except:
# If a problem occurred in setting up the test cases, it's
Expand All @@ -248,7 +248,8 @@ def _setup_cases_if_not_yet_done(self):
# case, but if we didn't remove the case2 directory, the next
# re-build of the test would think, "okay, setup is done, I can
# move on to the build", which would be wrong.
shutil.rmtree(self._caseroot2)
if os.path.isdir(self._caseroot2):
shutil.rmtree(self._caseroot2)
self._activate_case1()
logger.warning("WARNING: Test case setup failed. Case2 has been removed, "
"but the main case may be in an inconsistent state. "
Expand Down
3 changes: 2 additions & 1 deletion scripts/lib/CIME/tests/case_fake.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ def __init__(self, case_root, create_case_root=True):
os.makedirs(case_root)
self.set_value('CASEROOT', case_root)
casename = os.path.basename(case_root)
self.set_value('CIME_OUTPUT_ROOT','/tmp')
self.set_value('CASE', casename)
self.set_value('CASEBASEID', casename)
self.set_value('RUN_TYPE', 'startup')
Expand Down Expand Up @@ -63,7 +64,7 @@ def copy(self, newcasename, newcaseroot):

return newcase

def create_clone(self, newcase, keepexe=False):
def create_clone(self, newcase, keepexe=False, mach_dir=None, project=None, cime_output_root=None):
# Need to disable unused-argument checking: keepexe is needed to match
# the interface of Case, but is not used in this fake implementation
#
Expand Down