Skip to content

Commit

Permalink
Partial implementation of the prereq test. Still need to find out a g…
Browse files Browse the repository at this point in the history
…eneric way of verifying that the dependant job actually depends on the other one
  • Loading branch information
mfdeakin-sandia committed Aug 7, 2017
1 parent 57bbb46 commit 848c0df
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions scripts/tests/scripts_regression_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@
from CIME.code_checker import check_code, get_all_checkable_files
from CIME.test_status import *

from CIME.case_setup import case_setup
from CIME.case_submit import submit
import CIME.build as build

SCRIPT_DIR = CIME.utils.get_scripts_root()
TOOLS_DIR = os.path.join(SCRIPT_DIR,"Tools")
MACHINE = Machines()
Expand Down Expand Up @@ -1398,6 +1402,29 @@ def test_cime_case(self):
# Test some test properties
self.assertEqual(case.get_value("TESTCASE"), "TESTRUNPASS")

###########################################################################
def test_cime_case_prereq(self):
###########################################################################
testcase_name = 'Prereq_test'
testdir = os.path.join(TEST_ROOT, testcase_name)
if os.path.exists(testdir):
shutil.rmtree(testdir)
run_cmd_assert_result(self, ("%s/create_newcase --case %s --script-root %s --compset X --res f19_g16 --output-root %s"
% (SCRIPT_DIR, testcase_name, testdir, testdir)),
from_dir=SCRIPT_DIR)

with Case(testdir, read_only=False) as case:
case_setup(case, clean=False, test_mode=False, reset=False)
build.case_build(testdir, case=case, sharedlib_only=False, model_only=False)
submit_output = run_cmd_assert_result(self, "%s/case.submit" % (testdir), from_dir=testdir).split('\n')
submit_line_tag = 'Submitted job ids '
submit_line = [s for s in submit_output if submit_line_tag in s][0]
# Remove the tag used to identify the line, the brackets, and the quotations from the string-list
# This leaves us with a comma separated list of ids
submit_ids = submit_line.replace(submit_line_tag, '').replace('[', '').replace(']', '').replace('\'', '').split(',')
prereq_id = submit_ids[-1]
submit(case, prereq=prereq_id)

###########################################################################
def test_cime_case_build_threaded_1(self):
###########################################################################
Expand Down

0 comments on commit 848c0df

Please sign in to comment.