From d8224980d7b6cce60f564b548305401f55fff0a3 Mon Sep 17 00:00:00 2001 From: Drake Stapleton <213298340+drakestapleton@users.noreply.github.com> Date: Fri, 20 Nov 2026 06:58:54 -0600 Subject: [PATCH] Isolate API shell mutants during parallel host checks --- tests/api_shells_mutants.py | 31 ++++++++++++------------------- tests/api_shells_run.sh | 10 +++++++++- 2 files changed, 21 insertions(+), 20 deletions(-) diff --git a/tests/api_shells_mutants.py b/tests/api_shells_mutants.py index 4c05e987..dcb4bfa8 100755 --- a/tests/api_shells_mutants.py +++ b/tests/api_shells_mutants.py @@ -54,25 +54,18 @@ def main() -> int: if count != 1: print(f"FAIL mutant {name}: site count {count}") return 1 - with open(full, "w") as fh: - fh.write(src.replace(old, new, 1)) - try: - with tempfile.TemporaryDirectory(prefix="api-shells-mutant-") as out: - env = dict(os.environ, OUT_DIR=out) - r = subprocess.run( - ["bash", script, "regen"], - cwd=ROOT, - env=env, - stdout=subprocess.PIPE, - stderr=subprocess.STDOUT, - text=True, - ) - finally: - with open(full, "w") as fh: - fh.write(src) - if r.returncode == 0: - tail = r.stdout[-400:] - print(f"FAIL mutant {name} survived\n{tail}") + with tempfile.TemporaryDirectory(prefix="api-shells-mutant-") as out: + mutant = os.path.join(out, os.path.basename(path)) + with open(mutant, "w") as fh: + fh.write(src.replace(old, new, 1)) + env = dict(os.environ, OUT_DIR=out, API_SHELLS_MUTANT=mutant) + r = subprocess.run( + ["bash", script, "regen"], cwd=ROOT, env=env, + stdout=subprocess.PIPE, stderr=subprocess.STDOUT, text=True, + ) + if r.returncode != 1 or "FAIL api-shells checks=" not in r.stdout: + print(f"FAIL mutant {name}: expected a differential mismatch, " + f"got rc={r.returncode}\n{r.stdout[-400:]}") return 1 print(f"KILLED {name} rc={r.returncode}") killed += 1 diff --git a/tests/api_shells_run.sh b/tests/api_shells_run.sh index f57ad1df..60977ef0 100755 --- a/tests/api_shells_run.sh +++ b/tests/api_shells_run.sh @@ -10,7 +10,15 @@ mkdir -p "$OUT" if [[ "${1:-}" == "regen" ]]; then export OMEGA_OMC="${OMEGA_OMC:-$HOME/work/cudastack/omega-mv/seed/out/omc}" export OMEGA_BRIDGE="${OMEGA_BRIDGE:-$HOME/work/cudastack/omega-bridge}" - export OMEGA_UNITS="om/api/apish_shp.om om/api/apish_pack.om om/api/apish_slot.om om/api/apish_blk.om om/api/apish_trit.om" + units=() + for name in shp pack slot blk trit; do + source_file="om/api/apish_$name.om" + if [[ "${API_SHELLS_MUTANT:-}" == */"apish_$name.om" ]]; then + source_file="$API_SHELLS_MUTANT" + fi + units+=("$source_file") + done + export OMEGA_UNITS="${units[*]}" export OMEGA_UNITS_DEST="$OUT/gen" mkdir -p "$OMEGA_UNITS_DEST" bash om/units.sh