prompt: You will be provided with a partial code base and an issue statement explaining a problem to resolve.
  <issue>
  SystemTestsCompareTwo multisubmit tries to do too much in phase 1
  In comparing #1830 with what made it to master, I noticed that the indentation of this block is wrong:
  
  ```python
          # Compare results
          # Case1 is the "main" case, and we need to do the comparisons from there
          self._activate_case1()
          self._link_to_case2_output()
  
          self._component_compare_test(self._run_one_suffix, self._run_two_suffix, success_change=success_change)
  ```
  
  -- this should be indented under the "Second run" conditional.
  
  The current indentation leads the ERR test (and any other multi-submit test) to try to do component_compare_test after the first phase, leading to a FAIL result. This doesn't cause a test failure, because the FAIL is later overwritten with a PASS, but it is still incorrect.
  
  I have a fix for this in an incoming PR.
  
  </issue>
  <code>
  [start of scripts/lib/CIME/SystemTests/erp.py]
  1 """
  2 CIME ERP test.  This class inherits from SystemTestsCompareTwo
  3 
  4 This is a pes counts hybrid (open-MP/MPI) restart bfb test from
  5 startup.  This is just like an ERS test but the pe-counts/threading
  6 count are modified on retart.
  7 (1) Do an initial run with pes set up out of the box (suffix base)
  8 (2) Do a restart test with half the number of tasks and threads (suffix rest)
  9 """
  10 
  11 from CIME.XML.standard_module_setup import *
  12 from CIME.case_setup import case_setup
  13 from CIME.SystemTests.system_tests_compare_two import SystemTestsCompareTwo
  14 from CIME.check_lockedfiles import *
  15 
  16 logger = logging.getLogger(__name__)
  17 
  18 class ERP(SystemTestsCompareTwo):
  19 
  20     def __init__(self, case):
  21         """
  22         initialize a test object
  23         """
  24         SystemTestsCompareTwo.__init__(self, case,
  25                                        separate_builds = True,
  26                                        run_two_suffix = 'rest',
  27                                        run_one_description = 'initial',
  28                                        run_two_description = 'restart')
  29 
  30     def _common_setup(self):
  31         self._case.set_value("BUILD_THREADED",True)
  32 
  33     def _case_one_setup(self):
  34         stop_n      = self._case.get_value("STOP_N")
  35 
  36         expect(stop_n > 2, "ERROR: stop_n value {:d} too short".format(stop_n))
  37 
  38     def _case_two_setup(self):
  39         # halve the number of tasks and threads
  40         for comp in self._case.get_values("COMP_CLASSES"):
  41             ntasks    = self._case1.get_value("NTASKS_{}".format(comp))
  42             nthreads  = self._case1.get_value("NTHRDS_{}".format(comp))
  43             rootpe    = self._case1.get_value("ROOTPE_{}".format(comp))
  44             if ( nthreads > 1 ):
  45                 self._case.set_value("NTHRDS_{}".format(comp), nthreads/2)
  46             if ( ntasks > 1 ):
  47                 self._case.set_value("NTASKS_{}".format(comp), ntasks/2)
  48                 self._case.set_value("ROOTPE_{}".format(comp), rootpe/2)
  49 
  50         stop_n = self._case1.get_value("STOP_N")
  51         rest_n = self._case1.get_value("REST_N")
  52         stop_new = stop_n - rest_n
  53         expect(stop_new > 0, "ERROR: stop_n value {:d} too short {:d} {:d}".format(stop_new,stop_n,rest_n))
  54         self._case.set_value("STOP_N", stop_new)
  55         self._case.set_value("HIST_N", stop_n)
  56         self._case.set_value("CONTINUE_RUN", True)
  57         self._case.set_value("REST_OPTION","never")
  58 
  59         # Note, some components, like CESM-CICE, have
  60         # decomposition information in env_build.xml that
  61         # needs to be regenerated for the above new tasks and thread counts
  62         case_setup(self._case, test_mode=True, reset=True)
  63 
  64     def _case_one_custom_postrun_action(self):
  65         self.copy_case1_restarts_to_case2()
  66
  [end of scripts/lib/CIME/SystemTests/erp.py]
  </code>
  
  I need you to solve this issue by generating a single patch file that I can apply directly to this repository using git apply. Please respond with a single patch file in the following format.
  <patch>
  diff --git a/file.py b/file.py
  --- a/file.py
  +++ b/file.py
  @@ -1,27 +1,35 @@
   def euclidean(a, b):
  -    while b:
  -        a, b = b, a % b
  -    return a
  +    if b == 0:
  +        return a
  +    return euclidean(b, a % b)
   
   
   def bresenham(x0, y0, x1, y1):
       points = []
       dx = abs(x1 - x0)
       dy = abs(y1 - y0)
  -    sx = 1 if x0 < x1 else -1
  -    sy = 1 if y0 < y1 else -1
  -    err = dx - dy
  +    x, y = x0, y0
  +    sx = -1 if x0 > x1 else 1
  +    sy = -1 if y0 > y1 else 1
   
  -    while True:
  -        points.append((x0, y0))
  -        if x0 == x1 and y0 == y1:
  -            break
  -        e2 = 2 * err
  -        if e2 > -dy:
  -            err -= dy
  -            x0 += sx
  -        if e2 < dx:
  -            err += dx
  -            y0 += sy
  +    if dx > dy:
  +        err = dx / 2.0
  +        while x != x1:
  +            points.append((x, y))
  +            err -= dy
  +            if err < 0:
  +                y += sy
  +                err += dx
  +            x += sx
  +    else:
  +        err = dy / 2.0
  +        while y != y1:
  +            points.append((x, y))
  +            err -= dx
  +            if err < 0:
  +                x += sx
  +                err += dy
  +            y += sy
  +
  +    points.append((x, y))
       return points
  
  </patch>
golden_diff: diff --git a/scripts/lib/CIME/SystemTests/erp.py b/scripts/lib/CIME/SystemTests/erp.py
  --- a/scripts/lib/CIME/SystemTests/erp.py
  +++ b/scripts/lib/CIME/SystemTests/erp.py
  @@ -1,5 +1,5 @@
   """
  -CIME ERP test.  This class inherits from SystemTestsCompareTwo
  +CIME ERP test.  This class inherits from RestartTest
   
   This is a pes counts hybrid (open-MP/MPI) restart bfb test from
   startup.  This is just like an ERS test but the pe-counts/threading
  @@ -10,31 +10,26 @@
   
   from CIME.XML.standard_module_setup import *
   from CIME.case_setup import case_setup
  -from CIME.SystemTests.system_tests_compare_two import SystemTestsCompareTwo
  +from CIME.SystemTests.restart_tests import RestartTest
   from CIME.check_lockedfiles import *
   
   logger = logging.getLogger(__name__)
   
  -class ERP(SystemTestsCompareTwo):
  +class ERP(RestartTest):
   
       def __init__(self, case):
           """
           initialize a test object
           """
  -        SystemTestsCompareTwo.__init__(self, case,
  -                                       separate_builds = True,
  -                                       run_two_suffix = 'rest',
  -                                       run_one_description = 'initial',
  -                                       run_two_description = 'restart')
  +        RestartTest.__init__(self, case,
  +                             separate_builds = True,
  +                             run_two_suffix = 'rest',
  +                             run_one_description = 'initial',
  +                             run_two_description = 'restart')
   
       def _common_setup(self):
           self._case.set_value("BUILD_THREADED",True)
   
  -    def _case_one_setup(self):
  -        stop_n      = self._case.get_value("STOP_N")
  -
  -        expect(stop_n > 2, "ERROR: stop_n value {:d} too short".format(stop_n))
  -
       def _case_two_setup(self):
           # halve the number of tasks and threads
           for comp in self._case.get_values("COMP_CLASSES"):
  @@ -47,15 +42,7 @@
                   self._case.set_value("NTASKS_{}".format(comp), ntasks/2)
                   self._case.set_value("ROOTPE_{}".format(comp), rootpe/2)
   
  -        stop_n = self._case1.get_value("STOP_N")
  -        rest_n = self._case1.get_value("REST_N")
  -        stop_new = stop_n - rest_n
  -        expect(stop_new > 0, "ERROR: stop_n value {:d} too short {:d} {:d}".format(stop_new,stop_n,rest_n))
  -        self._case.set_value("STOP_N", stop_new)
  -        self._case.set_value("HIST_N", stop_n)
  -        self._case.set_value("CONTINUE_RUN", True)
  -        self._case.set_value("REST_OPTION","never")
  -
  +        RestartTest._case_two_setup(self)
           # Note, some components, like CESM-CICE, have
           # decomposition information in env_build.xml that
           # needs to be regenerated for the above new tasks and thread counts
  
verification_info: {"golden_diff": "diff --git a/scripts/lib/CIME/SystemTests/erp.py b/scripts/lib/CIME/SystemTests/erp.py\n--- a/scripts/lib/CIME/SystemTests/erp.py\n+++ b/scripts/lib/CIME/SystemTests/erp.py\n@@ -1,5 +1,5 @@\n \"\"\"\n-CIME ERP test.  This class inherits from SystemTestsCompareTwo\n+CIME ERP test.  This class inherits from RestartTest\n \n This is a pes counts hybrid (open-MP/MPI) restart bfb test from\n startup.  This is just like an ERS test but the pe-counts/threading\n@@ -10,31 +10,26 @@\n \n from CIME.XML.standard_module_setup import *\n from CIME.case_setup import case_setup\n-from CIME.SystemTests.system_tests_compare_two import SystemTestsCompareTwo\n+from CIME.SystemTests.restart_tests import RestartTest\n from CIME.check_lockedfiles import *\n \n logger = logging.getLogger(__name__)\n \n-class ERP(SystemTestsCompareTwo):\n+class ERP(RestartTest):\n \n     def __init__(self, case):\n         \"\"\"\n         initialize a test object\n         \"\"\"\n-        SystemTestsCompareTwo.__init__(self, case,\n-                                       separate_builds = True,\n-                                       run_two_suffix = 'rest',\n-                                       run_one_description = 'initial',\n-                                       run_two_description = 'restart')\n+        RestartTest.__init__(self, case,\n+                             separate_builds = True,\n+                             run_two_suffix = 'rest',\n+                             run_one_description = 'initial',\n+                             run_two_description = 'restart')\n \n     def _common_setup(self):\n         self._case.set_value(\"BUILD_THREADED\",True)\n \n-    def _case_one_setup(self):\n-        stop_n      = self._case.get_value(\"STOP_N\")\n-\n-        expect(stop_n > 2, \"ERROR: stop_n value {:d} too short\".format(stop_n))\n-\n     def _case_two_setup(self):\n         # halve the number of tasks and threads\n         for comp in self._case.get_values(\"COMP_CLASSES\"):\n@@ -47,15 +42,7 @@\n                 self._case.set_value(\"NTASKS_{}\".format(comp), ntasks/2)\n                 self._case.set_value(\"ROOTPE_{}\".format(comp), rootpe/2)\n \n-        stop_n = self._case1.get_value(\"STOP_N\")\n-        rest_n = self._case1.get_value(\"REST_N\")\n-        stop_new = stop_n - rest_n\n-        expect(stop_new > 0, \"ERROR: stop_n value {:d} too short {:d} {:d}\".format(stop_new,stop_n,rest_n))\n-        self._case.set_value(\"STOP_N\", stop_new)\n-        self._case.set_value(\"HIST_N\", stop_n)\n-        self._case.set_value(\"CONTINUE_RUN\", True)\n-        self._case.set_value(\"REST_OPTION\",\"never\")\n-\n+        RestartTest._case_two_setup(self)\n         # Note, some components, like CESM-CICE, have\n         # decomposition information in env_build.xml that\n         # needs to be regenerated for the above new tasks and thread counts\n", "issue": "SystemTestsCompareTwo multisubmit tries to do too much in phase 1\nIn comparing #1830 with what made it to master, I noticed that the indentation of this block is wrong:\r\n\r\n```python\r\n        # Compare results\r\n        # Case1 is the \"main\" case, and we need to do the comparisons from there\r\n        self._activate_case1()\r\n        self._link_to_case2_output()\r\n\r\n        self._component_compare_test(self._run_one_suffix, self._run_two_suffix, success_change=success_change)\r\n```\r\n\r\n-- this should be indented under the \"Second run\" conditional.\r\n\r\nThe current indentation leads the ERR test (and any other multi-submit test) to try to do component_compare_test after the first phase, leading to a FAIL result. This doesn't cause a test failure, because the FAIL is later overwritten with a PASS, but it is still incorrect.\r\n\r\nI have a fix for this in an incoming PR.\n", "before_files": [{"content": "\"\"\"\nCIME ERP test.  This class inherits from SystemTestsCompareTwo\n\nThis is a pes counts hybrid (open-MP/MPI) restart bfb test from\nstartup.  This is just like an ERS test but the pe-counts/threading\ncount are modified on retart.\n(1) Do an initial run with pes set up out of the box (suffix base)\n(2) Do a restart test with half the number of tasks and threads (suffix rest)\n\"\"\"\n\nfrom CIME.XML.standard_module_setup import *\nfrom CIME.case_setup import case_setup\nfrom CIME.SystemTests.system_tests_compare_two import SystemTestsCompareTwo\nfrom CIME.check_lockedfiles import *\n\nlogger = logging.getLogger(__name__)\n\nclass ERP(SystemTestsCompareTwo):\n\n    def __init__(self, case):\n        \"\"\"\n        initialize a test object\n        \"\"\"\n        SystemTestsCompareTwo.__init__(self, case,\n                                       separate_builds = True,\n                                       run_two_suffix = 'rest',\n                                       run_one_description = 'initial',\n                                       run_two_description = 'restart')\n\n    def _common_setup(self):\n        self._case.set_value(\"BUILD_THREADED\",True)\n\n    def _case_one_setup(self):\n        stop_n      = self._case.get_value(\"STOP_N\")\n\n        expect(stop_n > 2, \"ERROR: stop_n value {:d} too short\".format(stop_n))\n\n    def _case_two_setup(self):\n        # halve the number of tasks and threads\n        for comp in self._case.get_values(\"COMP_CLASSES\"):\n            ntasks    = self._case1.get_value(\"NTASKS_{}\".format(comp))\n            nthreads  = self._case1.get_value(\"NTHRDS_{}\".format(comp))\n            rootpe    = self._case1.get_value(\"ROOTPE_{}\".format(comp))\n            if ( nthreads > 1 ):\n                self._case.set_value(\"NTHRDS_{}\".format(comp), nthreads/2)\n            if ( ntasks > 1 ):\n                self._case.set_value(\"NTASKS_{}\".format(comp), ntasks/2)\n                self._case.set_value(\"ROOTPE_{}\".format(comp), rootpe/2)\n\n        stop_n = self._case1.get_value(\"STOP_N\")\n        rest_n = self._case1.get_value(\"REST_N\")\n        stop_new = stop_n - rest_n\n        expect(stop_new > 0, \"ERROR: stop_n value {:d} too short {:d} {:d}\".format(stop_new,stop_n,rest_n))\n        self._case.set_value(\"STOP_N\", stop_new)\n        self._case.set_value(\"HIST_N\", stop_n)\n        self._case.set_value(\"CONTINUE_RUN\", True)\n        self._case.set_value(\"REST_OPTION\",\"never\")\n\n        # Note, some components, like CESM-CICE, have\n        # decomposition information in env_build.xml that\n        # needs to be regenerated for the above new tasks and thread counts\n        case_setup(self._case, test_mode=True, reset=True)\n\n    def _case_one_custom_postrun_action(self):\n        self.copy_case1_restarts_to_case2()\n", "path": "scripts/lib/CIME/SystemTests/erp.py"}]}