From 2398c628cc66797143c8aa6e744ea61d93cdf56e Mon Sep 17 00:00:00 2001 From: James Foucar Date: Wed, 21 Oct 2015 14:10:45 -0600 Subject: [PATCH] create_test: Fix race condition with PEND state in TestStatus Move the PEND state addition from testcase_setup to create_test_impl. This will ensure it gets created before wait_for_tests is run. [BFB] --- cime/scripts-acme/create_test_impl.py | 5 +++++ cime/scripts/Tools/testcase_setup | 1 - 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/cime/scripts-acme/create_test_impl.py b/cime/scripts-acme/create_test_impl.py index c072b0f64819..c705843b90a7 100644 --- a/cime/scripts-acme/create_test_impl.py +++ b/cime/scripts-acme/create_test_impl.py @@ -314,6 +314,11 @@ def _test_status_phase(self, test_name): for phase in PHASES[0:made_it_to_phase+1]: str_to_write += "%s %s %s\n" % (self._get_test_status(test_name, phase), test_name, phase) + if (not self._no_run and not self._is_broken(test_name)): + # Ensure PEND state always gets added to TestStatus file if we are + # about to run test + str_to_write += "%s %s %s\n" % (TEST_PENDING_STATUS, test_name, RUN_PHASE) + try: test_status_file = os.path.join(self._get_test_dir(test_name), TEST_STATUS_FILENAME) with open(test_status_file, "w") as fd: diff --git a/cime/scripts/Tools/testcase_setup b/cime/scripts/Tools/testcase_setup index 6d7ea5f4c48e..626a1a28c68d 100755 --- a/cime/scripts/Tools/testcase_setup +++ b/cime/scripts/Tools/testcase_setup @@ -263,7 +263,6 @@ my $testcase_begin = <<'END_BEGIN'; set TESTSTATUS_LOG = $CASEROOT/TestStatus.log set TESTSTATUS_OUT_NLCOMP = $CASEROOT/TestStatus.nlcomp - echo "PEND ${CASEBASEID} RUN" >>&! $TESTSTATUS_OUT touch $TESTSTATUS_LOG set sdate = `date +"%Y-%m-%d %H:%M:%S"`