Repository: ESMCI/cime

Issue:
Need better test case coverage in cime_developer
We are currently only testing NCK, ERI, SEQ, ERS, ERR, and SMS.

Untested: ERP, ERT, ICP, LII, NCR, NOC, PEA, PEM, PET, PFS, REP, SSP

It seems like we should be testing most if not all of these nightly.



Discussion:
After discussion:  LII and SSP can't be tested in CIME.  Others can't easily be tested in CIME without full component models.

Can we use fake tests?

I forgot about this issue. This is fairly important if we want to guarantee that things like PET will work for our users. @rljacob this should be assigned to someone so that we don't forget; not sure who the best person is, probably one of the Jims.

Resolving patch:
diff --git a/scripts/lib/CIME/case.py b/scripts/lib/CIME/case.py
--- a/scripts/lib/CIME/case.py
+++ b/scripts/lib/CIME/case.py
@@ -107,7 +107,7 @@ def __init__(self, case_root=None, read_only=True):
         self.cores_per_task = None
         # check if case has been configured and if so initialize derived
         if self.get_value("CASEROOT") is not None:
-            self._initialize_derived_attributes()
+            self.initialize_derived_attributes()
 
     def check_if_comp_var(self, vid):
         vid = vid
@@ -119,7 +119,7 @@ def check_if_comp_var(self, vid):
                 return vid, comp, iscompvar
         return vid, comp, iscompvar
 
-    def _initialize_derived_attributes(self):
+    def initialize_derived_attributes(self):
         """
         These are derived variables which can be used in the config_* files
         for variable substitution using the {{ var }} syntax
@@ -809,7 +809,7 @@ def configure(self, compset_name, grid_name, machine_name=None,
         if test:
             self.set_value("TEST",True)
 
-        self._initialize_derived_attributes()
+        self.initialize_derived_attributes()
 
         # Make sure that parallel IO is not specified if total_tasks==1
         if self.total_tasks == 1:
diff --git a/scripts/lib/CIME/case_setup.py b/scripts/lib/CIME/case_setup.py
--- a/scripts/lib/CIME/case_setup.py
+++ b/scripts/lib/CIME/case_setup.py
@@ -136,11 +136,10 @@ def _case_setup_impl(case, caseroot, clean=False, test_mode=False, reset=False,
                 else:
                     expect(False, "NINST_%s value %d greater than NTASKS_%s %d" % (comp, ninst, comp, ntasks))
 
-        # Set TOTAL_CORES
-        case.set_value("TOTAL_CORES", case.total_tasks * case.cores_per_task )
-
         if os.path.exists("case.run"):
             logger.info("Machine/Decomp/Pes configuration has already been done ...skipping")
+
+            case.initialize_derived_attributes()
         else:
             check_pelayouts_require_rebuild(case, models)
 
@@ -159,6 +158,12 @@ def _case_setup_impl(case, caseroot, clean=False, test_mode=False, reset=False,
             cost_pes = env_mach_pes.get_cost_pes(pestot, thread_count, machine=case.get_value("MACH"))
             case.set_value("COST_PES", cost_pes)
 
+            # Make sure pio settings are consistent
+            if adjust_pio:
+                adjust_pio_layout(case, tasks_per_node)
+
+            case.initialize_derived_attributes()
+
             # create batch files
             logger.info("Creating batch script case.run")
             env_batch = case.get_env("batch")
@@ -176,10 +181,6 @@ def _case_setup_impl(case, caseroot, clean=False, test_mode=False, reset=False,
                     logger.info("Writing %s script from input template %s" % (job, input_batch_script))
                     env_batch.make_batch_script(input_batch_script, job, case, pestot, tasks_per_node, num_nodes, thread_count)
 
-            # Make sure pio settings are consistant
-            if adjust_pio:
-                adjust_pio_layout(case, tasks_per_node)
-
             # Make a copy of env_mach_pes.xml in order to be able
             # to check that it does not change once case.setup is invoked
             logger.info("Locking file env_mach_pes.xml")
@@ -187,6 +188,9 @@ def _case_setup_impl(case, caseroot, clean=False, test_mode=False, reset=False,
             logger.debug("at copy TOTALPES = %s"%case.get_value("TOTALPES"))
             lock_file("env_mach_pes.xml")
 
+        # Set TOTAL_CORES
+        case.set_value("TOTAL_CORES", case.total_tasks * case.cores_per_task )
+
         # Create user_nl files for the required number of instances
         if not os.path.exists("user_nl_cpl"):
             logger.info("Creating user_nl_xxx files for components and cpl")


Test patch:
diff --git a/scripts/lib/update_acme_tests.py b/scripts/lib/update_acme_tests.py
--- a/scripts/lib/update_acme_tests.py
+++ b/scripts/lib/update_acme_tests.py
@@ -48,6 +48,7 @@
                              "ERP.f45_g37_rx1.A",
                              "SMS_D_Ln9.f19_g16_rx1.A",
                              "DAE.f19_f19.A",
+                             "PET.f19_f19.A",
                              "SMS.T42_T42.S",
                              "PRE.f45_g37_rx1.ADESP")
                             ),