@@ -149,6 +149,16 @@ def trace_to_uuid(trace: str) -> str:
149149 return hex (binascii .crc32 (hashlib .sha1 (str (trace ).encode ()).digest ())).upper ()[2 :].zfill (8 )
150150
151151
152+ # Opt-in (per test, via honor_io_keys=True) exemption from the POST_PROCESS_OFF_PARAMS
153+ # clobber: a test whose DEFINITION sets parallel_io etc. for coverage (MPI-IO AMR restart,
154+ # load_balance) keeps its explicit values. Content-based honoring is wrong: Example-derived
155+ # tests import example case.py files that set these keys, but their goldens were generated
156+ # under the clobber (an unconditional honor broke 18 example goldens on every CI lane).
157+ HONOR_IO_SNIPPET = """
158+ # this test opts in to keeping its explicitly-set IO keys (see HONOR_IO_SNIPPET)
159+ mods = {k: v for k, v in mods.items() if k not in case}"""
160+
161+
152162@dataclasses .dataclass (init = False )
153163class TestCase (case .Case ):
154164 ppn : int
@@ -158,13 +168,24 @@ class TestCase(case.Case):
158168 kind : str = "golden"
159169 convergence_spec : Optional [dict ] = None
160170 canary : bool = False
171+ honor_io_keys : bool = False
161172
162173 def __init__ (
163- self , trace : str , mods : dict , ppn : int = None , override_tol : float = None , restart_check : bool = False , kind : str = "golden" , convergence_spec : Optional [dict ] = None , canary : bool = False
174+ self ,
175+ trace : str ,
176+ mods : dict ,
177+ ppn : int = None ,
178+ override_tol : float = None ,
179+ restart_check : bool = False ,
180+ kind : str = "golden" ,
181+ convergence_spec : Optional [dict ] = None ,
182+ canary : bool = False ,
183+ honor_io_keys : bool = False ,
164184 ) -> None :
165185 self .trace = trace
166186 self .ppn = ppn or 1
167187 self .override_tol = override_tol
188+ self .honor_io_keys = honor_io_keys
168189 self .restart_check = restart_check
169190 self .kind = kind
170191 self .convergence_spec = convergence_spec
@@ -319,10 +340,7 @@ def create_directory(self):
319340 if case['p'] != 0:
320341 mods.update({ json .dumps (POST_PROCESS_3D_PARAMS )} )
321342else:
322- mods = { json .dumps (POST_PROCESS_OFF_PARAMS )}
323- # honor a case's EXPLICIT setting of these keys (e.g. parallel_io = T for MPI-IO
324- # restart / load_balance coverage) instead of clobbering it
325- mods = {{k: v for k, v in mods.items() if k not in case}}
343+ mods = { json .dumps (POST_PROCESS_OFF_PARAMS )} { HONOR_IO_SNIPPET if self .honor_io_keys else "" }
326344
327345print(json.dumps({{**case, **mods}}))
328346""" ,
@@ -380,6 +398,7 @@ class TestCaseBuilder:
380398 kind : str = "golden"
381399 convergence_spec : Optional [dict ] = None
382400 canary : bool = False
401+ honor_io_keys : bool = False
383402
384403 def get_uuid (self ) -> str :
385404 return trace_to_uuid (self .trace )
@@ -412,7 +431,7 @@ def to_case(self) -> TestCase:
412431 if self .functor :
413432 self .functor (dictionary )
414433
415- return TestCase (self .trace , dictionary , self .ppn , self .override_tol , self .restart_check , canary = self .canary )
434+ return TestCase (self .trace , dictionary , self .ppn , self .override_tol , self .restart_check , canary = self .canary , honor_io_keys = self . honor_io_keys )
416435
417436
418437@dataclasses .dataclass
@@ -447,7 +466,9 @@ def define_convergence_case(trace: str, spec: dict, ppn: int = None) -> TestCase
447466 return TestCaseBuilder (trace , {}, None , None , ppn or 1 , None , None , False , kind = "convergence" , convergence_spec = spec )
448467
449468
450- def define_case_d (stack : CaseGeneratorStack , newTrace : str , newMods : dict , ppn : int = None , functor : Callable = None , override_tol : float = None , restart_check : bool = False ) -> TestCaseBuilder :
469+ def define_case_d (
470+ stack : CaseGeneratorStack , newTrace : str , newMods : dict , ppn : int = None , functor : Callable = None , override_tol : float = None , restart_check : bool = False , honor_io_keys : bool = False
471+ ) -> TestCaseBuilder :
451472 mods : dict = {}
452473
453474 for mod in stack .mods :
@@ -463,7 +484,7 @@ def define_case_d(stack: CaseGeneratorStack, newTrace: str, newMods: dict, ppn:
463484 if not common .isspace (trace ):
464485 traces .append (trace )
465486
466- return TestCaseBuilder (" -> " .join (traces ), mods , None , None , ppn or 1 , functor , override_tol , restart_check )
487+ return TestCaseBuilder (" -> " .join (traces ), mods , None , None , ppn or 1 , functor , override_tol , restart_check , honor_io_keys = honor_io_keys )
467488
468489
469490def input_bubbles_lagrange (self ):
0 commit comments