Skip to content

Commit 4794356

Browse files
committed
fix(test): the POST_PROCESS_OFF_PARAMS honor-exemption is per-test opt-in (honor_io_keys), not content-based - honoring any case's explicit parallel_io/prim_vars_wrt broke the 18 Example-derived goldens whose imported case.py sets those keys (goldens were generated under the clobber): every full CI test lane failed with line-count mismatches (first seen on intel-reldebug only because it finishes first; reproduced locally under nvfortran, exit 0 with 6 extra prim.*.dat pack entries). The two tests the exemption exists for (5EFB3277 MPI-IO AMR restart, 0253D658 load_balance) opt in via define_case_d(honor_io_keys=True); UUIDs and goldens unchanged. Validated: ibm_ellipse/ibm_stl/phasechange_bubble pass again and both opt-ins keep their coverage (5/5 with -a)
1 parent a0de508 commit 4794356

2 files changed

Lines changed: 31 additions & 10 deletions

File tree

toolchain/mfc/test/case.py

Lines changed: 29 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -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)
153163
class 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)})
321342
else:
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
327345
print(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

469490
def input_bubbles_lagrange(self):

toolchain/mfc/test/cases.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2682,7 +2682,7 @@ def amr_golden_tests():
26822682
# (coarse-halo exchange before tagging, fine seam halo) - a rank-seam or restart-offset bug
26832683
# is a silent wrong answer everywhere else in the suite
26842684
stack.push("2 MPI Ranks", {"parallel_io": "T"})
2685-
cases.append(define_case_d(stack, "", {}, ppn=2, restart_check=True))
2685+
cases.append(define_case_d(stack, "", {}, ppn=2, restart_check=True, honor_io_keys=True))
26862686
stack.pop()
26872687
stack.pop()
26882688

@@ -3714,7 +3714,7 @@ def load_balance_tests():
37143714
"patch_icpp(3)%alpha(2)": 1.0 - eps_lb,
37153715
},
37163716
)
3717-
cases.append(define_case_d(stack, "", {}, ppn=2))
3717+
cases.append(define_case_d(stack, "", {}, ppn=2, honor_io_keys=True))
37183718
stack.pop()
37193719

37203720
load_balance_tests()

0 commit comments

Comments
 (0)