Closed billsacks closed 8 years ago
A lot of what you suggest has already been done. For example look at the ers.py and err.py
@jedwards4b : I agree that the new python scripts are a big step forward from the shell scripts in this respect! And I did look at ers.py before writing this issue. What I'm suggesting amounts to minor tweaks on top of what is already in place to remove the remaining duplication. I think that this is especially important because the (small) bits of duplication are somewhat cryptic to someone who doesn't understand the whole set of testing scripts, which means that people (myself included) will inevitably copy and paste this without really understanding it... which in my experience leads to bugs and maintainability problems. There is also a greater chance that a critical line will accidentally be left out.
Specifically, I am suggesting moving the run method:
def run(self):
success = self._ers_first_phase()
if success:
return self._ers_second_phase()
else:
return False
as well as this logic (in _ers_second_phase):
# Compare restart file
if success:
return self._component_compare_test("base", "rest")
else:
return False
into a shared location, so it doesn't need to be duplicated for each test.
I believe that this further refactoring would have reduced the chances of introducing one of the LII bugs documented in issue #291 , as well as the ERP bug documented in issue #295.
This issue is a revamped version of https://github.com/CESM-Development/cime/issues/146, taking into account the new (and much easier to work with!) python-based system tests. That older issue had some additional ideas; the main ones were:
I feel that those additional things would be nice to have, but not essential.
Most of our system tests do two runs that differ in some way, then compare them to make sure they are identical. There is a desire - from myself and others - to add many more tests along these lines that tweak small things and ensure that the simulation isn't affected (e.g., turn carbon isotopes on in CLM and ensure that this doesn't change the evolution of the bulk carbon pools).
The new python-based system tests are a big step forward from the old shell scripts - thank you to everyone who worked on that! However, to make the test scripts more maintainable, and to make it easier to add new system tests, I'd suggest even more aggressive removal of duplication between these tests. Here I'm using the LII test as an example.
There are three main things I'd like to see:
Introduce a pre-build stage, so I can move the namelist setup out of the build stage
The main point would be to avoid needing to check if things have already been done and avoid doing them again. This would also make the whole test flow logic more clear.
I envision something like the following prototype (which is probably buggy, but hopefully conveys what I envision well enough):
The intent here is to make the specific test class (LII above) contain only what is unique to that test. Once that's the case, it will become much easier to create and maintain a wide variety of tests.