diff --git a/scripts/hw-gate.sh b/scripts/hw-gate.sh index 51c46f447..de6894237 100755 --- a/scripts/hw-gate.sh +++ b/scripts/hw-gate.sh @@ -631,11 +631,11 @@ fi # ---- kat + needle + KLD: one step per model ----------------------------------------------- if has kat || has needle || has kld; then - [ -f "$TEXT" ] || { has kld && { result kld FAIL 0 "text missing: $TEXT"; infra=1; }; } + [ -f "$TEXT" ] || { has kld && { result kld SKIP 0 "text missing (input absent): $TEXT"; infra=1; }; } while IFS='|' read -r name file repeat donee srvargs; do want_model "$name" || continue model=$MODELS/$file base=$STORE/kld/$name.kld - if [ ! -f "$model" ]; then result "model $name" FAIL 0 "model missing: $model"; infra=1; continue; fi + if [ ! -f "$model" ]; then result "model $name" SKIP 0 "model missing (input absent): $model"; infra=1; continue; fi dokat=0; has kat && dokat=1 needle=0; [ "$donee" = 1 ] && has needle && needle=1 dokld=0; has kld && [ -f "$TEXT" ] && [ -z "$srvargs" ] && dokld=1 diff --git a/tests/hw_gate_test.py b/tests/hw_gate_test.py index 4609ad87b..acf63d7e7 100644 --- a/tests/hw_gate_test.py +++ b/tests/hw_gate_test.py @@ -103,6 +103,22 @@ def script_invariants(): npu = src.find("if has npu;") if npu < 0 or "flock" not in src[npu:]: bad.append("the NPU phase must still hold ~/npu.lock: an NPU dispatch must not overlap another") + # engine#2501: an absent INPUT is a SKIP row, not a FAIL row. The exit code already said so + # (infra=1 -> exit 2), but the row is what a human reads, and it said FAIL on something nobody can + # fix -- so every PR went red on main's own pin. A `sed` over all three FAILs would also flip the + # KLD row, and that one is a RESULT: asserted below to stay FAIL. + for absent in ('"model missing', '"text missing'): + i = src.find(absent) + if i < 0: # renamed or removed: fail rather than pass over nothing + bad.append(f"no {absent} row found: the absent-input rows must exist and be SKIP") + continue + line = src[src.rfind(chr(10), 0, i) + 1:src.find(chr(10), i)] + if " SKIP " not in line: + bad.append(f"{absent} must be SKIP, not FAIL: an absent input is not a result (engine#2501)") + if "infra=1" not in line: # SKIP alone would let "ran nothing" look like "all passed" + bad.append(f"{absent} must keep infra=1, so a run with no inputs still exits 2") + if src.find('result "kld $name" FAIL') < 0: + bad.append("the KLD mismatch row must stay FAIL: a verify mismatch is a result, not an absent input") return bad