Skip to content

Commit 451ab76

Browse files
committed
fp-stability: harden log preservation and report writing (review feedback)
- _preserve_logs runs in _run_case's finally block; an OSError there (disk full, dest collision) would replace the case's real outcome and, being uncatchable by the suite's MFCException handler, abort the whole run. Make it best-effort with a printed warning, matching the adjacent ignore_errors rmtree. - _emit_github_summary creates log_dir if missing instead of raising FileNotFoundError at the very end of a run.
1 parent 4c1c1d9 commit 451ab76

2 files changed

Lines changed: 7 additions & 1 deletion

File tree

toolchain/mfc/fp_stability.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -533,7 +533,12 @@ def _run_case(
533533
cons.print(f" [bold yellow]float-max check error[/bold yellow]: {exc}")
534534

535535
finally:
536-
_preserve_logs(work_dir, os.path.join(log_dir, name))
536+
# best-effort, like the rmtree below: a failed log copy must not replace
537+
# the case's real outcome (this runs even when the try block is raising)
538+
try:
539+
_preserve_logs(work_dir, os.path.join(log_dir, name))
540+
except OSError as exc:
541+
cons.print(f" [bold yellow]could not preserve logs[/bold yellow]: {exc}")
537542
shutil.rmtree(work_dir, ignore_errors=True)
538543
cons.unindent()
539544
cons.print()

toolchain/mfc/fp_stability_report.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,7 @@ def _emit_github_summary(results: list, n_samples: int, log_dir: str = None):
168168

169169
text = "\n".join(md) + "\n"
170170
if log_dir:
171+
os.makedirs(log_dir, exist_ok=True)
171172
with open(os.path.join(log_dir, "summary.md"), "w") as f:
172173
f.write(text)
173174
summary_path = os.environ.get("GITHUB_STEP_SUMMARY")

0 commit comments

Comments
 (0)