Skip to content

Commit

Permalink
Add _common_setup to SystemTestsCompareTwo
Browse files Browse the repository at this point in the history
Also add some necessary settings in REP test, in _common_setup

Test suite: None
Test baseline: N/A
Test namelist changes: N/A
Test status: N/A

Fixes: None

User interface changes?: No

Code review: None
  • Loading branch information
billsacks committed Jul 28, 2016
1 parent 6e7d094 commit e406c31
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 2 deletions.
10 changes: 10 additions & 0 deletions utils/python/CIME/SystemTests/rep.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,16 @@ def __init__(self, case):
self.set_description_first_phase('Run 1')
self.set_description_second_phase('Run 2')

def _common_setup(self):
# TODO(wjs, 2016-07-27) Many of these settings are made for most tests -
# especially setting HIST_OPTION and HIST_N. Should these be moved to
# some common place to avoid duplication by all tests (and in case some
# other "standard" settings are added in the future)?
self._case.set_value("CONTINUE_RUN",False)
self._case.set_value("REST_OPTION","none")
self._case.set_value("HIST_OPTION","$STOP_OPTION")
self._case.set_value("HIST_N","$STOP_N")

def _setup_first_phase(self):
pass

Expand Down
27 changes: 25 additions & 2 deletions utils/python/CIME/SystemTests/system_tests_compare_two.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,23 @@
Classes that inherit from this are REQUIRED to implement the following methods:
(1) _setup_first_phase
(1) _common_setup
This method will be called before both the first and second phase of the
two-phase test, before either _setup_first_phase or
_setup_second_phase. This should contain settings needed for both phases of
the run, such as setting CONTINUE_RUN to False. In principle, these settings
could just be made once, but for robustness and communication purposes, this
is executed before both run phases.
(2) _setup_first_phase
This method will be called to set up the run for the first phase of the
two-phase test
(2) _setup_second_phase
(3) _setup_second_phase
This method will be called to set up the run for the second phase of the
two-phase test
In addition, the __init__ method in subclasses MAY set various attributes AFTER
calling SystemTestsCompareTwo.__init__, via calls to the following. However,
this is only for the sake of enhancing communication via logging, file names,
Expand Down Expand Up @@ -126,6 +135,18 @@ def set_description_second_phase(self, description):
# base class
# ========================================================================

def _common_setup(self):
"""
This method will be called before both the first and second phase of the
two-phase test, before either _setup_first_phase or
_setup_second_phase. This should contain settings needed for both phases of
the run, such as setting CONTINUE_RUN to False. In principle, these settings
could just be made once, but for robustness and communication purposes, this
is executed before both run phases.
"""
raise NotImplementedError


def _setup_first_phase(self):
"""
Sets up the run for the first phase of the two-phase test.
Expand All @@ -152,6 +173,7 @@ def run(self):
Runs both phases of the two-phase test and compares their results
"""

self._common_setup()
self._setup_first_phase()
self._case.flush()
logger.info('Doing first run: ' + self._description_first_phase)
Expand All @@ -162,6 +184,7 @@ def run(self):
self._status_run1 = "FAIL"
return False

self._common_setup()
self._setup_second_phase()
self._case.flush()
logger.info('Doing second run: ' + self._description_second_phase)
Expand Down

0 comments on commit e406c31

Please sign in to comment.