Skip to content

Commit

Permalink
Add homme python test
Browse files Browse the repository at this point in the history
  • Loading branch information
jgfouca committed Aug 10, 2016
1 parent bbd20fb commit c77a64e
Show file tree
Hide file tree
Showing 4 changed files with 66 additions and 29 deletions.
26 changes: 0 additions & 26 deletions scripts/Testing/Testcases/HOMME_script

This file was deleted.

62 changes: 62 additions & 0 deletions utils/python/CIME/SystemTests/homme.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
"""
CIME HOMME test. This class inherits from SystemTestsCommon
"""
from CIME.XML.standard_module_setup import *
from CIME.SystemTests.system_tests_common import SystemTestsCommon
from CIME.build import post_build, case_build

import shutil

logger = logging.getLogger(__name__)

class HOMME(SystemTestsCommon):

def __init__(self, case):
"""
initialize an object interface to the SMS system test
"""
SystemTestsCommon.__init__(self, case)

def build_phase(self, sharedlib_only=False, model_only=False):
if not sharedlib_only:
# Build HOMME
srcroot = self._case.get_value("SRCROOT")
mach = self._case.get_value("MACH")
procs = self._case.get_value("TOTALPES")
exeroot = self._case.get_value("EXEROOT")
baseline = self._case.get_value("CCSM_BASELINE")
basegen = self._case.get_value("BASEGEN_CASE")
basecmp = self._case.get_value("BASECMP_CASE")
generate = self._case.get_value("GENERATE_BASELINE")

basename = basegen if generate else basecmp
cmake_cmd = "cmake -C %s/components/homme/cmake/machineFiles/%s.cmake -DUSE_NUM_PROCS=%s %s/components/homme -DHOMME_BASELINE_DIR=%s/%s >& homme.bldlog" % (srcroot, mach, procs, srcroot, baseline, basename)

run_cmd_no_fail(cmake_cmd, from_dir=exeroot)
run_cmd_no_fail("make -j8 >> homme.bldlog 2>&1", from_dir=exeroot)

post_build(self._case, [os.path.join(exeroot, "homme.bldlog")])

def run_phase(self):

rundir = self._case.get_value("RUNDIR")
exeroot = self._case.get_value("EXEROOT")
baseline = self._case.get_value("CCSM_BASELINE")
compare = self._case.get_value("COMPARE_BASELINE")
generate = self._case.get_value("GENERATE_BASELINE")
basegen = self._case.get_value("BASEGEN_CASE")

log = os.path.join(rundir, "homme.log")
if os.path.exists(log):
os.remove(log)

if generate:
full_baseline_dir = os.path.join(baseline, basegen, "tests", "baseline")
run_cmd_no_fail("make -j 4 baseline >& %s" % log, from_dir=exeroot)
if os.path.isdir(full_baseline_dir):
shutil.rmtree(full_baseline_dir)
shutil.copytree(os.path.join(exeroot, "tests", "baseline"), full_baseline_dir)
elif compare:
run_cmd_no_fail("make -j 4 check >& %s" % log, from_dir=exeroot)
else:
run_cmd_no_fail("make -j 4 baseline >& %s" % log, from_dir=exeroot)
4 changes: 2 additions & 2 deletions utils/python/CIME/SystemTests/system_tests_common.py
Original file line number Diff line number Diff line change
Expand Up @@ -431,8 +431,8 @@ def build_phase(self, sharedlib_only=False, model_only=False):
f.write(self._script)

os.chmod(modelexe, 0755)
self._case.set_value("BUILD_COMPLETE", True)
self._case.flush()

post_build(self._case, [])

def run_phase(self):
self.run_indv(suffix=None)
Expand Down
3 changes: 2 additions & 1 deletion utils/python/CIME/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,8 @@ def post_build(case, logs):
# Set XML to indicate build complete
case.set_value("BUILD_COMPLETE", True)
case.set_value("BUILD_STATUS", 0)
case.set_value("SMP_BUILD", os.environ["SMP_VALUE"])
if "SMP_VALUE" in os.environ:
case.set_value("SMP_BUILD", os.environ["SMP_VALUE"])
case.flush()

if os.path.exists("LockedFiles/env_build.xml"):
Expand Down

0 comments on commit c77a64e

Please sign in to comment.