Repository: ESMCI/cime

Issue:
Refactor E3SM config_files.xml in CIME to contain bare minimum
Really, all it should point to is the "real" config_files.xml that lives in the host repo. I think something like this:

```
<entry_id version="2.0">

  <entry id="MODEL_CONFIG_FILES">
    <type>char</type>
    <default_value>$SRCROOT/cime_config/config_files.xml</default_value>
    <group>case_last</group>
    <file>env_case.xml</file>
    <desc>file containing paths</desc>
  <entry>
</entry_id>
```

The motivation for this change is that I feel E3SM developers should be able to tweak things like PES location for components without having to issue PRs to CIME.

The file in question is CIME/data/config/e3sm/config_files.xml


Discussion:
@rljacob , @jedwards4b , @mvertens , you may be interested in this proposal.
This make sense to me.  
@jasonb5 this is fairly high priority since one of our components wants to start experimenting with their own config pes file.
Seems like a Good Thing To Do.

Resolving patch:
diff --git a/CIME/XML/files.py b/CIME/XML/files.py
--- a/CIME/XML/files.py
+++ b/CIME/XML/files.py
@@ -50,6 +50,10 @@ def __init__(self, comp_interface=None):
         if os.path.isfile(config_files_override):
             self.read(config_files_override)
             self.overwrite_existing_entries()
+        elif self.get_version() >= 3.0:
+            model_config_files = self.get_value("MODEL_CONFIG_FILES")
+            self.read(model_config_files)
+            self.overwrite_existing_entries()
 
     def get_value(self, vid, attribute=None, resolved=True, subgroup=None):
         if vid == "COMP_ROOT_DIR_CPL":


Test patch:
diff --git a/CIME/tests/test_unit_case.py b/CIME/tests/test_unit_case.py
--- a/CIME/tests/test_unit_case.py
+++ b/CIME/tests/test_unit_case.py
@@ -81,7 +81,7 @@ def test_submit(
 
 class TestCase(unittest.TestCase):
     def setUp(self):
-        self.srcroot = os.path.abspath(cime_utils.get_cime_root())
+        self.srcroot = os.path.abspath(cime_utils.get_src_root())
         self.tempdir = tempfile.TemporaryDirectory()
 
     @mock.patch("CIME.case.case.Case.read_xml")
@@ -148,11 +148,12 @@ def test_copy(
         with self.tempdir as tempdir:
             caseroot = os.path.join(tempdir, "test1")
             with Case(caseroot, read_only=False) as case:
-                srcroot = os.path.abspath(
-                    os.path.join(os.path.dirname(__file__), "../../../../../")
-                )
                 case.create(
-                    "test1", srcroot, "A", "f19_g16_rx1", machine_name="cori-haswell"
+                    "test1",
+                    self.srcroot,
+                    "A",
+                    "f19_g16_rx1",
+                    machine_name="cori-haswell",
                 )
 
                 # Check that they're all called
@@ -222,11 +223,12 @@ def test_create(
         with self.tempdir as tempdir:
             caseroot = os.path.join(tempdir, "test1")
             with Case(caseroot, read_only=False) as case:
-                srcroot = os.path.abspath(
-                    os.path.join(os.path.dirname(__file__), "../../../../../")
-                )
                 case.create(
-                    "test1", srcroot, "A", "f19_g16_rx1", machine_name="cori-haswell"
+                    "test1",
+                    self.srcroot,
+                    "A",
+                    "f19_g16_rx1",
+                    machine_name="cori-haswell",
                 )
 
                 # Check that they're all called
@@ -268,7 +270,6 @@ def test_create(
 
 class TestCase_RecordCmd(unittest.TestCase):
     def setUp(self):
-        self.srcroot = os.path.abspath(cime_utils.get_cime_root())
         self.tempdir = tempfile.TemporaryDirectory()
 
     def assert_calls_match(self, calls, expected):