stage(av1): a suite cannot start with its preflight unverified
Browse files at this commitbede77e8a52fc53be7e4434c5ffb100b0c7dd9cfParent: ecb98e24 changed files +706 -4
- lanes/av1stagegaps.report.md +303 -0
- scripts/av1-stage-suite.sh +124 -0
- scripts/av1-suite-preflight.sh +248 -0
- scripts/check-aom-oracle-rungs.sh +31 -4
lanes/av1stagegaps.report.mdadded+303 -0
| @@ -0,0 +1,303 @@ | ||
| 1 | +# lane-av1stagegaps — a staged server suite can no longer run with its preflight unverified | |
| 2 | + | |
| 3 | +Worktree `/home/user/.cache/wt/av1stagegaps`, branch `lane-av1stagegaps`, base | |
| 4 | +`edffad9e`. Scope: the staging recipe, not the decoder. | |
| 5 | + | |
| 6 | +## 1. Host C's checker failure, reproduced with stderr visible | |
| 7 | + | |
| 8 | +The driver log named no cause at all: | |
| 9 | + | |
| 10 | + === ORACLE RUNG CHECKER | |
| 11 | + rungs_exit=1 ok_count=0 | |
| 12 | + === SUITE | |
| 13 | + | |
| 14 | +`ok_count=0` is the tell: a checker that ran and failed prints its own `FAIL` | |
| 15 | +lines, so zero ok lines with zero detail means it never got as far as asserting | |
| 16 | +anything. The driver's `$(...)` capture also dropped stderr, which is where the | |
| 17 | +reason is printed. | |
| 18 | + | |
| 19 | +Reproduction, on the host, from the staged tree, real paths, stderr visible: | |
| 20 | + | |
| 21 | + $ ssh user@host-d | |
| 22 | + $ cd /home/user/gates/wave3d && git log --oneline -1 | |
| 23 | + 48d8c21 staged | |
| 24 | + $ nice -n 19 bash scripts/check-aom-oracle-rungs.sh; echo "rungs_exit=$?" | |
| 25 | + no oracle source at /home/user/.cache/aom-oracle/src/av1/decoder/decodeframe.c | |
| 26 | + rungs_exit=1 | |
| 27 | + $ ls ~/.cache/aom-oracle/ | |
| 28 | + build | |
| 29 | + $ ls ~/.cache/aom-oracle/src | |
| 30 | + ls: cannot access '/home/user/.cache/aom-oracle/src': No such file or directory | |
| 31 | + $ git -C ~/.cache/aom-oracle/build rev-parse --show-toplevel | |
| 32 | + fatal: not a git repository ... | |
| 33 | + | |
| 34 | +**Named missing prerequisite:** the libaom **source tree** at | |
| 35 | +`$AOM_ORACLE_SRC` (default `~/.cache/aom-oracle/src`, a git checkout carrying | |
| 36 | +base ref `v3.13.3`). The host carries only `~/.cache/aom-oracle/build` — the | |
| 37 | +`aomdec`/`aomenc` **binaries** the suite itself needs. The checker derives | |
| 38 | +rungs from source and diffs them against pristine upstream files, so with no | |
| 39 | +source it asserts nothing. | |
| 40 | + | |
| 41 | +Not a failing rung, not a path typo, not an env problem: an absent checkout. Fix | |
| 42 | +on the host is either `git clone -b v3.13.3 aom ~/.cache/aom-oracle/src` or the | |
| 43 | +explicit waiver in §3. The suite's own binary dependency is unaffected, which is | |
| 44 | +why the run was still meaningful — but its **rung coverage was not verified | |
| 45 | +there**, and the log said nothing about that. | |
| 46 | + | |
| 47 | +## 2. The fix | |
| 48 | + | |
| 49 | +Three states must be distinguishable, and two of them must be fatal. | |
| 50 | + | |
| 51 | +### 2a. `scripts/check-aom-oracle-rungs.sh` — a distinct exit code for an absent prerequisite | |
| 52 | + | |
| 53 | +`diff -u` against main: | |
| 54 | + | |
| 55 | + +# EXIT CONTRACT (lane-av1stagegaps). ... | |
| 56 | + +# 0 GREEN every assertion below held. | |
| 57 | + +# 3 NOTRUN a PREREQUISITE is absent (no oracle source tree, or the base ref | |
| 58 | + +# is not in it). Nothing was asserted: this is NOT a pass and NOT a | |
| 59 | + +# defect. scripts/av1-suite-preflight.sh maps it to `not-run` and | |
| 60 | + +# BLOCKS the suite unless a waiver names the host. | |
| 61 | + +# 1 FAIL a derived file violates the rung contract, or the instrument | |
| 62 | + +# script errored / was not idempotent. | |
| 63 | + +die_prereq() { echo "PREREQ-ABSENT: $*" >&2; exit 3; } | |
| 64 | + ... | |
| 65 | + -[ -f "$DERIVED" ] || { echo "no oracle source at $DERIVED" >&2; exit 1; } | |
| 66 | + -[ -f "$RECONINTRA" ] || { echo "no oracle source at $RECONINTRA" >&2; exit 1; } | |
| 67 | + +[ -f "$DERIVED" ] || die_prereq "no oracle source at $DERIVED (provision it: git clone -b v3.13.3 --depth 1 aom at $SRC)" | |
| 68 | + +[ -f "$RECONINTRA" ] || die_prereq "no oracle source at $RECONINTRA (provision it: git clone -b v3.13.3 --depth 1 aom at $SRC)" | |
| 69 | + git -C "$SRC" rev-parse --verify "$BASE^{commit}" >/dev/null 2>&1 || { | |
| 70 | + - echo "base ref '$BASE' is not a commit in $SRC" >&2 | |
| 71 | + - exit 1 | |
| 72 | + + die_prereq "base ref '$BASE' is not a commit in $SRC" | |
| 73 | + | |
| 74 | +Plus one more prerequisite of the same class: `systemd-run --setenv=TMPDIR=…` | |
| 75 | +points at a per-suite dir, and if staging created the unit but not the dir, | |
| 76 | +`mktemp -d` fails with something that reads like a checker bug. Now: | |
| 77 | + | |
| 78 | + +# systemd-run's --setenv=TMPDIR points at a per-suite dir; if staging created | |
| 79 | + +# the unit but not the dir, mktemp fails with an error that reads like a | |
| 80 | + +# checker bug. It is the same class as a missing oracle tree: not asserted. | |
| 81 | + +probe="$(mktemp -d "${TMPDIR:-$HOME/.cache/tmp}/aom-rung-check.XXXXXX" 2>/dev/null)" || | |
| 82 | + + die_prereq "scratch dir ${TMPDIR:-$HOME/.cache/tmp} does not exist (staging must mkdir it)" | |
| 83 | + +rmdir "$probe" | |
| 84 | + +WORK="$(mktemp -d "${TMPDIR:-$HOME/.cache/tmp}/aom-rung-check.XXXXXX")" | |
| 85 | + | |
| 86 | +Existing `exit 1` paths are unchanged, so any caller that only checks non-zero | |
| 87 | +still sees a failure. `set -euo pipefail` is untouched. | |
| 88 | + | |
| 89 | +### 2b. `scripts/av1-suite-preflight.sh` (new) — the gate | |
| 90 | + | |
| 91 | +Runs both preflight pieces, prints every detail line of each (stdout and stderr | |
| 92 | +together, indented — the thing the old driver threw away), then one verdict: | |
| 93 | + | |
| 94 | + === PIN-GATE PREFLIGHT (EC_REQUIRE_FIXTURES=1) | |
| 95 | + ...verify-fixture-library output... | |
| 96 | + pin_audit_exit=0 state=GREEN | |
| 97 | + === ORACLE RUNG CHECKER | |
| 98 | + ok legacy u8 row loops left in the derived file 0 | |
| 99 | + ... | |
| 100 | + rungs_exit=0 ok_count=14 state=GREEN | |
| 101 | + === VERDICT | |
| 102 | + VERDICT=GREEN | |
| 103 | + | |
| 104 | +States and the resulting verdict: | |
| 105 | + | |
| 106 | +| pin_audit | rung_check | verdict | exit | | |
| 107 | +|---|---|---|---| | |
| 108 | +| GREEN | GREEN | GREEN | 0 | | |
| 109 | +| GREEN | NOT-RUN | WAIVED **iff** `SUITE_RUNG_WAIVER` is non-empty, else BLOCKED | 0 / 1 | | |
| 110 | +| GREEN | FAIL | BLOCKED | 1 | | |
| 111 | +| GREEN | ABSENT (no checker in the tree) | BLOCKED, **never waivable** | 1 | | |
| 112 | +| FAIL | any | BLOCKED | 1 | | |
| 113 | +| ABSENT | any | BLOCKED | 1 | | |
| 114 | + | |
| 115 | +NOT-RUN vs ABSENT is the load-bearing distinction: NOT-RUN is a provisioning fact | |
| 116 | +(the checker ran and said so) and can be waived with a recorded reason; ABSENT | |
| 117 | +is the host-A defect — a staging with no checker at all — and has no waiver path, | |
| 118 | +because `SUITE_RUNG_WAIVER` only ever applies to the NOT-RUN branch. An empty | |
| 119 | +`SUITE_RUNG_WAIVER=` (a real shape, from a unit's `Environment=`) counts as | |
| 120 | +absent, so it cannot accidentally authorise a run. | |
| 121 | + | |
| 122 | +### 2c. `scripts/av1-stage-suite.sh` (new) — a staging that cannot skip the gate | |
| 123 | + | |
| 124 | +Wraps staging and runs the gate under `set -e` **before** `systemd-run`, so a | |
| 125 | +blocked verdict means no unit is ever created: | |
| 126 | + | |
| 127 | + # 3. THE GATE. `set -e` is the whole mechanism: a non-zero verdict aborts this | |
| 128 | + # script before systemd-run is ever reached, so no unit exists and no suite | |
| 129 | + # runs. There is no path from a blocked verdict to `=== SUITE`. | |
| 130 | + set -e | |
| 131 | + echo "=== PIN-GATE PREFLIGHT + ORACLE RUNG CHECKER" | |
| 132 | + EC_REQUIRE_FIXTURES=${EC_REQUIRE_FIXTURES:-1} \ | |
| 133 | + EC_FIXTURE_SHAPE_STRICT=${EC_FIXTURE_SHAPE_STRICT:-1} \ | |
| 134 | + bash "$TREE/scripts/av1-suite-preflight.sh" --tree "$TREE" | |
| 135 | + set +e | |
| 136 | + echo "=== SUITE" | |
| 137 | + | |
| 138 | +It also carries the two staging defects the fleet actually hit, as refuses rather | |
| 139 | +than as prose: a tree that is not a git checkout, a **populated** index (bare | |
| 140 | +`git init` makes every pin look uncommitted — the wave-3c-b correction), and | |
| 141 | +both `lanes/*.expected.txt` dumps. | |
| 142 | + | |
| 143 | +## 3. Red-before / green-after | |
| 144 | + | |
| 145 | +### Red — the hand-written driver shape, on the real missing-oracle-source case | |
| 146 | + | |
| 147 | + $ cat /tmp/av1stage-demo/old-driver.sh | |
| 148 | + out=$(bash "$TREE/scripts/check-aom-oracle-rungs.sh" 2>/dev/null); rungs_exit=$? | |
| 149 | + ok_count=$(printf '%s\n' "$out" | grep -c '^ok ' || true) | |
| 150 | + echo "rungs_exit=$rungs_exit ok_count=$ok_count" | |
| 151 | + echo "=== SUITE" | |
| 152 | + echo "cargo test -p ec-av1 --lib <-- THIS RAN ANYWAY in the wave-3d staging" | |
| 153 | + $ AOM_ORACLE_SRC=/tmp/av1stage-demo/no-such-src bash /tmp/av1stage-demo/old-driver.sh | |
| 154 | + === ORACLE RUNG CHECKER | |
| 155 | + rungs_exit=3 ok_count=0 | |
| 156 | + === SUITE | |
| 157 | + cargo test -p ec-av1 --lib <-- THIS RAN ANYWAY in the wave-3d staging | |
| 158 | + old_driver_exit=0 | |
| 159 | + | |
| 160 | +Same staging, through the new driver: | |
| 161 | + | |
| 162 | + $ AOM_ORACLE_SRC=/tmp/av1stage-demo/no-such-src SUITE_PIN_CHECKER=$STUB \ | |
| 163 | + bash scripts/av1-stage-suite.sh --name redemo --tree /tmp/av1stage-demo/tree --dry-run | |
| 164 | + === PIN-GATE PREFLIGHT + ORACLE RUNG CHECKER | |
| 165 | + === PIN-GATE PREFLIGHT (EC_REQUIRE_FIXTURES=1) | |
| 166 | + ok a | |
| 167 | + pin_audit_exit=0 state=GREEN | |
| 168 | + === ORACLE RUNG CHECKER | |
| 169 | + PREREQ-ABSENT: no oracle source at /tmp/av1stage-demo/no-such-src/av1/decoder/decodeframe.c (provision it: git clone -b v3.13.3 --depth 1 aom at /tmp/av1stage-demo/no-such-src) | |
| 170 | + rungs_exit=3 ok_count=0 state=NOT-RUN | |
| 171 | + === VERDICT | |
| 172 | + VERDICT=BLOCKED | |
| 173 | + PREFLIGHT BLOCKED: pin_audit=GREEN rung_check=NOT-RUN. | |
| 174 | + A staging with a failed or missing check must NOT reach === SUITE. | |
| 175 | + rung_check=not-run (missing oracle source) is waivable only via | |
| 176 | + SUITE_RUNG_WAIVER='<host and reason>'; an absent checker never is. | |
| 177 | + gate_exit=1 | |
| 178 | + | |
| 179 | +`=== SUITE` never printed. Note the state is now readable from the log alone, | |
| 180 | +which is the actual fix to `rungs_exit=1 ok_count=0` with no detail. | |
| 181 | + | |
| 182 | +### Green — waived, on the real wave-3d tree | |
| 183 | + | |
| 184 | + $ AOM_ORACLE_SRC=/tmp/av1stage-demo/no-such-src \ | |
| 185 | + SUITE_RUNG_WAIVER="host host-d carries oracle binaries only; rung coverage verified on the build host" \ | |
| 186 | + EC_FIXTURES=/…/fixtures \ | |
| 187 | + bash scripts/av1-stage-suite.sh --name redemo3d --tree /tmp/av1stage-demo/wave3d --dry-run | |
| 188 | + … | |
| 189 | + verify-fixture-library: GREEN (299 rows) | |
| 190 | + pin_audit_exit=0 state=GREEN | |
| 191 | + === ORACLE RUNG CHECKER | |
| 192 | + PREREQ-ABSENT: no oracle source at /tmp/av1stage-demo/no-such-src/av1/decoder/decodeframe.c (…) | |
| 193 | + rungs_exit=3 ok_count=0 state=NOT-RUN | |
| 194 | + === VERDICT | |
| 195 | + VERDICT=WAIVED (rung_check=not-run waived: host host-d carries oracle binaries only; rung coverage verified on the build host) | |
| 196 | + === SUITE | |
| 197 | + dry-run: would start unit redemo3d-suite … | |
| 198 | + gate_exit=0 | |
| 199 | + | |
| 200 | +### Green — fully green, oracle source present | |
| 201 | + | |
| 202 | + $ EC_FIXTURES=/…/fixtures bash scripts/av1-stage-suite.sh --name redemo3d2 --tree … --dry-run | |
| 203 | + ok instrument-aom-oracle.sh derives the depth-correct, byte-checked rungs (base v3.13.3) | |
| 204 | + rungs_exit=0 ok_count=14 state=GREEN | |
| 205 | + === VERDICT | |
| 206 | + VERDICT=GREEN | |
| 207 | + === SUITE | |
| 208 | + gate_exit=0 | |
| 209 | + | |
| 210 | +### The gate's own self-test (non-vacuous: red the checker, the gate must stop) | |
| 211 | + | |
| 212 | + $ bash scripts/av1-suite-preflight.sh --self-test; echo "selftest_exit=$?" | |
| 213 | + ok 1 an all-green staging is GREEN | |
| 214 | + ok 2 a FAILING rung checker blocks the suite | |
| 215 | + ok 3 not-run without a waiver blocks the suite | |
| 216 | + ok 4 not-run with a named waiver is WAIVED, reason recorded | |
| 217 | + ok 5 an empty waiver does not authorise a run | |
| 218 | + ok 6 a tree with NO rung checker is blocked even with a waiver | |
| 219 | + ok 7 a tree with NO pin audit is blocked even with a waiver | |
| 220 | + ok 8 a FAILING pin audit blocks the suite | |
| 221 | + selftest_exit=0 | |
| 222 | + | |
| 223 | +Two traps hit while writing it, both worth recording: | |
| 224 | + | |
| 225 | +- `set -o pipefail` makes `verdict | grep -q '^VERDICT=BLOCKED$'` return | |
| 226 | + verdict's own non-zero status even when grep matched, so every BLOCKED case | |
| 227 | + read as a self-test failure. Capture into a variable, then compare. | |
| 228 | +- The stub helper printed its `exit` code as the script body, so a "green" stub | |
| 229 | + ran `exit echo "…"`. Argument order, not logic. | |
| 230 | + | |
| 231 | +## 4. Per-host audit of the two running suites (read-only, `nice -n 19`) | |
| 232 | + | |
| 233 | +Suite test counts taken immediately before and after each audit block: unchanged | |
| 234 | +on both hosts, so nothing was disturbed. | |
| 235 | + | |
| 236 | +| host | tree | suite running | pin audit | pin self-test | rung checker | tree satisfies preflight? | | |
| 237 | +|---|---|---|---|---|---|---| | |
| 238 | +| C `host-d` | `~/gates/wave3d` @ `48d8c21` | `wave3d-suite`, `470 ok` before and after | `COUNT total=8 committed=21 uncommitted=0 ignored=0 assertless=0` → GREEN | `PASS`, exit 0 | **exit 1, no oracle `src/`** → now NOT-RUN | **no, without a waiver**: pin side satisfies it, rung side cannot be satisfied without provisioning or an explicit waiver | | |
| 239 | +| A `host-a` | `~/gates/wave3e` | `wave3e-suite`, `143 ok` before and after | `COUNT total=10 committed=0 uncommitted=25` → **RED** | `PASS`, exit 0 | **exit 1, no oracle `src/`** → now NOT-RUN | **no, twice over**: `git ls-files` = 0 entries (bare `git init`, no `git add -A`) so every pin reads uncommitted, and the rung check is unsatisfiable | | |
| 240 | + | |
| 241 | +Raw, host C: | |
| 242 | + | |
| 243 | + $ cd ~/gates/wave3d | |
| 244 | + $ grep -c '^test .* \.\.\. ok$' suite.log | |
| 245 | + 470 | |
| 246 | + $ nice -n 19 python3 scripts/pin-gate-audit.py | grep ^COUNT | |
| 247 | + COUNT total=8 committed=21 uncommitted=0 ignored=0 assertless=0 | |
| 248 | + $ nice -n 19 python3 scripts/pin-gate-audit.py --self-test | tail -1 | |
| 249 | + SELFTEST PASS a doc comment between two gates left both counted as crate_pin | |
| 250 | + $ nice -n 19 bash scripts/check-aom-oracle-rungs.sh; echo "rungs_exit=$?" | |
| 251 | + no oracle source at /home/user/.cache/aom-oracle/src/av1/decoder/decodeframe.c | |
| 252 | + rungs_exit=1 | |
| 253 | + $ grep -c '^test .* \.\.\. ok$' suite.log | |
| 254 | + 470 | |
| 255 | + | |
| 256 | +Raw, host A: | |
| 257 | + | |
| 258 | + $ cd ~/gates/wave3e | |
| 259 | + $ grep -c '^test .* \.\.\. ok$' ~/gates/wave3e-suite.log | |
| 260 | + 143 | |
| 261 | + $ git ls-files | wc -l | |
| 262 | + 0 | |
| 263 | + $ nice -n 19 python3 scripts/pin-gate-audit.py | grep ^COUNT | |
| 264 | + COUNT total=10 committed=0 uncommitted=25 ignored=0 assertless=0 | |
| 265 | + $ nice -n 19 python3 scripts/pin-gate-audit.py --self-test | tail -1 | |
| 266 | + SELFTEST PASS a doc comment between two gates left both counted as crate_pin | |
| 267 | + $ nice -n 19 bash scripts/check-aom-oracle-rungs.sh; echo "rungs_exit=$?" | |
| 268 | + no oracle source at /home/user/.cache/aom-oracle/src/av1/decoder/decodeframe.c | |
| 269 | + rungs_exit=1 | |
| 270 | + $ grep -c '^test .* \.\.\. ok$' ~/gates/wave3e-suite.log | |
| 271 | + 143 | |
| 272 | + | |
| 273 | +Read on the audits: **neither running suite's tree satisfies the preflight, and | |
| 274 | +host A's pin-census red is a staging artefact, not a code defect** — the same | |
| 275 | +artefact the wave-3c-b report described, still reproducible. Host A's suite | |
| 276 | +results are not invalidated by it (the census reads pins, it does not gate | |
| 277 | +decoder behaviour), but a census claiming `committed=0` on 25 pins must not be | |
| 278 | +quoted as a pin-tracking measurement. | |
| 279 | + | |
| 280 | +## 5. One sentence for the merge report | |
| 281 | + | |
| 282 | +> The wave-3d run on `host-d` verified its fixture pins (census | |
| 283 | +> `committed=21 uncommitted=0`, self-test PASS) but **not** its oracle rung | |
| 284 | +> derivation — that host has `~/.cache/aom-oracle/build` and no `src/` tree, so | |
| 285 | +> the rung checker asserted nothing there and the driver's `rungs_exit=1 | |
| 286 | +> ok_count=0` line was a missing prerequisite, not a failing check; the 14-ok | |
| 287 | +> figure remains a local (build-host) measurement only. | |
| 288 | + | |
| 289 | +## 6. Skill update | |
| 290 | + | |
| 291 | +`manage_skill update ec-av1stage-staging` — no such skill; the existing managed | |
| 292 | +skill `ec-av1-remote-suite-stage` is updated in place rather than duplicated, with | |
| 293 | +the new gate as the staging recipe and this trap added. | |
| 294 | + | |
| 295 | +## 7. Not done | |
| 296 | + | |
| 297 | +- No host was re-staged and no suite was restarted; §4 is read-only by design. | |
| 298 | +- Neither host was provisioned with `~/.cache/aom-oracle/src` — that is a fleet | |
| 299 | + decision, and a `git clone` of libaom on two hosts was not in this lane's scope. | |
| 300 | +- The checker's `exit 1` callers (lane reports) keep working; no caller was | |
| 301 | + migrated to the new `3`. | |
| 302 | +- `scripts/av1-stage-suite.sh` is exercised only with `--dry-run` on a scratch | |
| 303 | + tree; it has not started a real unit. |
scripts/av1-stage-suite.shadded+124 -0
| @@ -0,0 +1,124 @@ | ||
| 1 | +#!/usr/bin/env bash | |
| 2 | +# av1-stage-suite.sh — stage an ec-av1 suite on a server host, behind the preflight | |
| 3 | +# gate. A staging whose pin audit or rung check FAILED, or whose checkers never | |
| 4 | +# ran, MUST NOT reach `=== SUITE`. | |
| 5 | +# | |
| 6 | +# WHY THIS EXISTS (lane-av1stagegaps, 2026-09-30). The hand-written staging | |
| 7 | +# driver logged the checker outcome and continued regardless: | |
| 8 | +# | |
| 9 | +# === ORACLE RUNG CHECKER | |
| 10 | +# rungs_exit=1 ok_count=0 | |
| 11 | +# === SUITE | |
| 12 | +# | |
| 13 | +# so a green suite on a host meant nothing about its preflight. Three states — | |
| 14 | +# passed, failed, never ran — all looked the same. This driver runs | |
| 15 | +# scripts/av1-suite-preflight.sh under `set -e` and stops there. | |
| 16 | +# | |
| 17 | +# Usage: | |
| 18 | +# scripts/av1-stage-suite.sh --name <suite> --tree <dir> [--tarball <tgz>] | |
| 19 | +# [--skip <cargo-test-arg>]... [-- command...] | |
| 20 | +# | |
| 21 | +# Defaults: no cargo-test-arg means | |
| 22 | +# cargo test -p ec-av1 --lib -- --test-threads=1 | |
| 23 | +# | |
| 24 | +# Env (all passed to the unit): | |
| 25 | +# CARGO_TARGET_DIR, TMPDIR defaulted under $HOME/gates/<name>-* | |
| 26 | +# EC_AV1_REQUIRE_AOMENC=1, EC_AV1_REQUIRE_FFMPEG=1, EC_REQUIRE_FIXTURES=1 | |
| 27 | +# SUITE_RUNG_WAIVER=<reason> required to accept rung_check=not-run | |
| 28 | +# | |
| 29 | +# Exit: 0 the unit was started; non-zero the preflight BLOCKED and no unit | |
| 30 | +# exists. `systemctl --user is-active <name>-suite` is the only thing that | |
| 31 | +# starts a suite, so a blocked staging leaves the host idle on purpose. | |
| 32 | + | |
| 33 | +set -uo pipefail | |
| 34 | + | |
| 35 | +NAME="" | |
| 36 | +TREE="" | |
| 37 | +TARBALL="" | |
| 38 | +declare -a SKIPS=() | |
| 39 | +declare -a CMD=() | |
| 40 | +DRY_RUN=0 | |
| 41 | +while [ $# -gt 0 ]; do | |
| 42 | + case "$1" in | |
| 43 | + --name) NAME=$2; shift 2 ;; | |
| 44 | + --tree) TREE=$2; shift 2 ;; | |
| 45 | + --tarball) TARBALL=$2; shift 2 ;; | |
| 46 | + --skip) SKIPS+=(--skip "$2"); shift 2 ;; | |
| 47 | + --dry-run) DRY_RUN=1; shift ;; | |
| 48 | + --) shift; CMD=("$@"); break ;; | |
| 49 | + -h|--help) sed -n '2,28p' "$0"; exit 0 ;; | |
| 50 | + *) echo "unknown argument: $1" >&2; exit 2 ;; | |
| 51 | + esac | |
| 52 | +done | |
| 53 | +[ -n "$NAME" ] && [ -n "$TREE" ] || { echo "usage: --name <suite> --tree <dir> [--tarball <tgz>] [--skip <arg>]... [-- cmd...]" >&2; exit 2; } | |
| 54 | +[ -d "$TREE" ] || { echo "no such tree: $TREE" >&2; exit 2; } | |
| 55 | + | |
| 56 | +# 1. The staged tree needs a real git checkout with a POPULATED index. A bare | |
| 57 | +# `git init` leaves the index empty and pin-gate-audit.py's | |
| 58 | +# `git ls-files --error-unmatch` then reports every pin as uncommitted — a | |
| 59 | +# staging artefact indistinguishable from the defect invariant 4 exists to | |
| 60 | +# catch (wave-3c-b correction). Test rev-parse, not `[ -d .git ]`: a worktree | |
| 61 | +# copy and a `git archive` untar both leave a `.git` FILE. | |
| 62 | +git -C "$TREE" rev-parse --git-dir >/dev/null 2>&1 || { | |
| 63 | + echo "staging defect: $TREE is not a git checkout; memguard-runner.sh dies with exit 128" >&2 | |
| 64 | + exit 2 | |
| 65 | +} | |
| 66 | +if [ -z "$(git -C "$TREE" ls-files | head -1)" ]; then | |
| 67 | + echo "staging defect: $TREE has an empty index; run git add -A after the untar" >&2 | |
| 68 | + exit 2 | |
| 69 | +fi | |
| 70 | + | |
| 71 | +# 2. Both gitignored lanes dumps: missing them fails exactly 2 tests that are | |
| 72 | +# not a decoder regression. | |
| 73 | +for f in intrarect_dump.expected.txt wedge_libaom.expected.txt; do | |
| 74 | + [ -f "$TREE/lanes/$f" ] || { echo "staging defect: $TREE/lanes/$f missing" >&2; exit 2; } | |
| 75 | +done | |
| 76 | + | |
| 77 | +TARGET=${CARGO_TARGET_DIR:-$HOME/gates/target-$NAME} | |
| 78 | +TMP=${TMPDIR:-$HOME/gates/tmp-$NAME} | |
| 79 | +mkdir -p "$TARGET" "$TMP" | |
| 80 | + | |
| 81 | +echo "=== host=$(hostname) commit=$(git -C "$TREE" rev-parse HEAD) date=$(date -Is)" | |
| 82 | +echo "=== cargo=$(command -v cargo || echo MISSING) aomenc=${EC_AV1_AOMENC:-unset} aomdec=${EC_AV1_AOMDEC:-unset} ffmpeg=$(command -v ffmpeg || echo MISSING)" | |
| 83 | +if [ -n "$TARBALL" ]; then | |
| 84 | + echo "=== tarball=$(sha256sum "$TARBALL" | cut -c1-16) -> $TREE" | |
| 85 | +fi | |
| 86 | + | |
| 87 | +# 3. THE GATE. `set -e` is the whole mechanism: a non-zero verdict aborts this | |
| 88 | +# script before systemd-run is ever reached, so no unit exists and no suite | |
| 89 | +# runs. There is no path from a blocked verdict to `=== SUITE`. | |
| 90 | +set -e | |
| 91 | +echo "=== PIN-GATE PREFLIGHT + ORACLE RUNG CHECKER" | |
| 92 | +EC_REQUIRE_FIXTURES=${EC_REQUIRE_FIXTURES:-1} \ | |
| 93 | +EC_FIXTURE_SHAPE_STRICT=${EC_FIXTURE_SHAPE_STRICT:-1} \ | |
| 94 | + bash "$TREE/scripts/av1-suite-preflight.sh" --tree "$TREE" | |
| 95 | +set +e | |
| 96 | + | |
| 97 | +echo "=== SUITE" | |
| 98 | +if [ "$DRY_RUN" = 1 ]; then | |
| 99 | + echo "dry-run: would start unit $NAME-suite in $TREE (target $TARGET, tmp $TMP)" | |
| 100 | + exit 0 | |
| 101 | +fi | |
| 102 | + | |
| 103 | +if [ ${#CMD[@]} -eq 0 ]; then | |
| 104 | + CMD=(cargo test -p ec-av1 --lib -- --test-threads=1) | |
| 105 | +fi | |
| 106 | +declare -a quoted=() | |
| 107 | +for a in "${SKIPS[@]}"; do quoted+=("$a"); done | |
| 108 | + | |
| 109 | +LOG=$HOME/gates/$NAME-suite.log | |
| 110 | +mkdir -p "$HOME/gates" | |
| 111 | +systemd-run --user --unit="$NAME-suite" -p MemoryMax=5G \ | |
| 112 | + -p WorkingDirectory="$TREE" \ | |
| 113 | + --setenv="CARGO_TARGET_DIR=$TARGET" \ | |
| 114 | + --setenv="TMPDIR=$TMP" \ | |
| 115 | + --setenv=EC_NOMEMGUARD=1 \ | |
| 116 | + --setenv=EC_AV1_REQUIRE_AOMENC=1 \ | |
| 117 | + --setenv=EC_AV1_REQUIRE_FFMPEG=1 \ | |
| 118 | + --setenv=EC_REQUIRE_FIXTURES=1 \ | |
| 119 | + --setenv="EC_FIXTURES=${EC_FIXTURES:-$TREE/fixtures}" \ | |
| 120 | + ${EC_AV1_AOMENC:+--setenv=EC_AV1_AOMENC=$EC_AV1_AOMENC} \ | |
| 121 | + ${EC_AV1_AOMDEC:+--setenv=EC_AV1_AOMDEC=$EC_AV1_AOMDEC} \ | |
| 122 | + --setenv="PATH=$HOME/.cargo/bin:/usr/local/bin:/usr/bin:/bin" \ | |
| 123 | + /usr/bin/bash -lc "cd '$TREE' && ${CMD[*]} ${quoted[*]-} > '$LOG' 2>&1" | |
| 124 | +echo "started $NAME-suite; real test output: $LOG" |
scripts/av1-suite-preflight.shadded+248 -0
| @@ -0,0 +1,248 @@ | ||
| 1 | +#!/usr/bin/env bash | |
| 2 | +# av1-suite-preflight.sh — the gate a server staging must pass BEFORE `=== SUITE`. | |
| 3 | +# | |
| 4 | +# WHY (lane-av1stagegaps, measured 2026-09-30). Three hosts, three different | |
| 5 | +# preflight realities, one identical green suite: | |
| 6 | +# | |
| 7 | +# host C host-d the driver printed | |
| 8 | +# === ORACLE RUNG CHECKER | |
| 9 | +# rungs_exit=1 ok_count=0 | |
| 10 | +# === SUITE | |
| 11 | +# and the suite ran. The real cause, with stderr | |
| 12 | +# visible, was a MISSING PREREQUISITE: the host has | |
| 13 | +# `~/.cache/aom-oracle/build` (aomdec/aomenc binaries) | |
| 14 | +# and no `src/` tree, so the checker asserted nothing. | |
| 15 | +# host A host-a staged with a bare `cargo test -p ec-av1 --lib`. No | |
| 16 | +# pin-gate audit, no rung checker, no self-test: not a | |
| 17 | +# failure, an ABSENT check. | |
| 18 | +# so "green suite" meant checker-passed, checker-failed and no-checker-ran | |
| 19 | +# with equal confidence. | |
| 20 | +# | |
| 21 | +# WHAT THIS DOES. Runs both preflight pieces, prints one machine-readable state | |
| 22 | +# per piece, then a single VERDICT. Exit 0 only when every piece is GREEN or an | |
| 23 | +# explicitly waived NOT-RUN, so a `set -e` staging driver CANNOT reach | |
| 24 | +# `=== SUITE` on a failed or missing check. | |
| 25 | +# | |
| 26 | +# pin_audit = GREEN | FAIL | ABSENT (verify-fixture-library.sh: shape, | |
| 27 | +# resolve, drift, invariants 1-4 + | |
| 28 | +# census self-test) | |
| 29 | +# rung_check = GREEN | FAIL | NOT-RUN | ABSENT | |
| 30 | +# VERDICT = GREEN | WAIVED | BLOCKED | |
| 31 | +# | |
| 32 | +# NOT-RUN vs ABSENT is the distinction that matters. NOT-RUN means the checker | |
| 33 | +# RAN and reported a missing prerequisite (exit 3 from check-aom-oracle-rungs.sh) | |
| 34 | +# — a provisioning fact, not a code defect. ABSENT means the checker is not in | |
| 35 | +# this tree at all, which is exactly the host-A defect and is never waivable. | |
| 36 | +# | |
| 37 | +# WAIVER. not-run can be waived, but only with an explicit non-empty reason that | |
| 38 | +# is recorded in the verdict line, so a later reader can tell a deliberate | |
| 39 | +# waiver from a check that silently vanished: | |
| 40 | +# SUITE_RUNG_WAIVER="host host-d carries oracle binaries only; rung | |
| 41 | +# coverage verified on the build host, see report" | |
| 42 | +# An empty waiver counts as absent, so a unit's Environment= carrying a bare | |
| 43 | +# SUITE_RUNG_WAIVER= cannot accidentally authorise a run. | |
| 44 | +# | |
| 45 | +# Usage: | |
| 46 | +# scripts/av1-suite-preflight.sh [--tree DIR] [--self-test] | |
| 47 | +# | |
| 48 | +# Env: | |
| 49 | +# EC_FIXTURES=<dir> fixture root (default <tree>/fixtures) | |
| 50 | +# EC_REQUIRE_FIXTURES=1 make an absent/empty fixture path fatal | |
| 51 | +# SUITE_RUNG_WAIVER=<reason> waive rung_check=not-run (see above) | |
| 52 | +# SUITE_RUNG_CHECKER=<path> override the rung checker (self-test stubs) | |
| 53 | +# SUITE_PIN_CHECKER=<path> override the pin preflight (self-test stubs) | |
| 54 | + | |
| 55 | +set -uo pipefail | |
| 56 | + | |
| 57 | +ROOT_DEFAULT=$(cd -- "$(dirname -- "$0")/.." && pwd) | |
| 58 | +TREE=$ROOT_DEFAULT | |
| 59 | +SELF_TEST=0 | |
| 60 | +while [ $# -gt 0 ]; do | |
| 61 | + case "$1" in | |
| 62 | + --tree) TREE=$2; shift 2 ;; | |
| 63 | + --self-test) SELF_TEST=1; shift ;; | |
| 64 | + -h|--help) sed -n '2,40p' "$0"; exit 0 ;; | |
| 65 | + *) echo "unknown argument: $1" >&2; exit 2 ;; | |
| 66 | + esac | |
| 67 | +done | |
| 68 | +PIN_CHECKER=${SUITE_PIN_CHECKER:-$TREE/scripts/verify-fixture-library.sh} | |
| 69 | +RUNG_CHECKER=${SUITE_RUNG_CHECKER:-$TREE/scripts/check-aom-oracle-rungs.sh} | |
| 70 | + | |
| 71 | +pin_state=ABSENT | |
| 72 | +rung_state=ABSENT | |
| 73 | + | |
| 74 | +run_pin() { # sets pin_state, prints every detail line | |
| 75 | + pin_state=ABSENT | |
| 76 | + if [ ! -f "$PIN_CHECKER" ]; then | |
| 77 | + echo "pin_audit_state=ABSENT reason=pin preflight not in tree ($PIN_CHECKER)" >&2 | |
| 78 | + return | |
| 79 | + fi | |
| 80 | + local out rc | |
| 81 | + out=$("$PIN_CHECKER" 2>&1) | |
| 82 | + rc=$? | |
| 83 | + printf '%s\n' "$out" | sed 's/^/ /' | |
| 84 | + if [ $rc -eq 0 ]; then pin_state=GREEN; else pin_state=FAIL; fi | |
| 85 | + echo "pin_audit_exit=$rc state=$pin_state" | |
| 86 | +} | |
| 87 | + | |
| 88 | +run_rungs() { # sets rung_state, prints every detail line | |
| 89 | + rung_state=ABSENT | |
| 90 | + if [ ! -f "$RUNG_CHECKER" ]; then | |
| 91 | + echo "rung_check_state=ABSENT reason=checker not in tree ($RUNG_CHECKER)" >&2 | |
| 92 | + return | |
| 93 | + fi | |
| 94 | + local out rc ok_count | |
| 95 | + out=$("$RUNG_CHECKER" 2>&1) | |
| 96 | + rc=$? | |
| 97 | + ok_count=$(printf '%s\n' "$out" | grep -c '^ok ' || true) | |
| 98 | + # The detail lines are the whole point: the 2026-09-30 driver logged | |
| 99 | + # `rungs_exit=1 ok_count=0` and no reason at all. Every outcome here prints | |
| 100 | + # the checker's own stdout and stderr together, indented. | |
| 101 | + printf '%s\n' "$out" | sed 's/^/ /' | |
| 102 | + case $rc in | |
| 103 | + 0) rung_state=GREEN ;; | |
| 104 | + 3) rung_state=NOT-RUN ;; | |
| 105 | + *) rung_state=FAIL ;; | |
| 106 | + esac | |
| 107 | + echo "rungs_exit=$rc ok_count=$ok_count state=$rung_state" | |
| 108 | +} | |
| 109 | + | |
| 110 | +verdict() { # echoes VERDICT; returns 0 iff GREEN or WAIVED | |
| 111 | + # A pin audit that did not run or failed, and a rung check that is absent | |
| 112 | + # or failed, are all fatal: no waiver exists for any of them. Only | |
| 113 | + # rung_check=not-run (a missing prerequisite) is waivable, and only with a | |
| 114 | + # non-empty reason. | |
| 115 | + local v=BLOCKED | |
| 116 | + local waived="" | |
| 117 | + if [ "$pin_state" = GREEN ] && [ "$rung_state" = GREEN ]; then | |
| 118 | + v=GREEN | |
| 119 | + elif [ "$pin_state" = GREEN ] && [ "$rung_state" = NOT-RUN ]; then | |
| 120 | + if [ -n "${SUITE_RUNG_WAIVER:-}" ]; then | |
| 121 | + v=WAIVED | |
| 122 | + waived=" (rung_check=not-run waived: ${SUITE_RUNG_WAIVER})" | |
| 123 | + fi | |
| 124 | + fi | |
| 125 | + echo "VERDICT=$v$waived" | |
| 126 | + if [ "$v" = BLOCKED ]; then | |
| 127 | + { | |
| 128 | + echo "PREFLIGHT BLOCKED: pin_audit=$pin_state rung_check=$rung_state." | |
| 129 | + echo " A staging with a failed or missing check must NOT reach === SUITE." | |
| 130 | + echo " rung_check=not-run (missing oracle source) is waivable only via" | |
| 131 | + echo " SUITE_RUNG_WAIVER='<host and reason>'; an absent checker never is." | |
| 132 | + } >&2 | |
| 133 | + return 1 | |
| 134 | + fi | |
| 135 | + return 0 | |
| 136 | +} | |
| 137 | + | |
| 138 | +self_test() { | |
| 139 | + local d rc=0 out | |
| 140 | + d=$(mktemp -d "${TMPDIR:-/tmp}/av1-preflight-selftest.XXXXXX") | |
| 141 | + # shellcheck disable=SC2064 | |
| 142 | + trap "rm -rf '$d'" RETURN | |
| 143 | + | |
| 144 | + stub() { # name, exit-code, body | |
| 145 | + printf '#!/usr/bin/env bash\n%s\nexit %s\n' "$3" "$2" >"$d/$1" | |
| 146 | + chmod +x "$d/$1" | |
| 147 | + } | |
| 148 | + # `set -o pipefail` is on, so `verdict | grep -q ...` returns verdict's own | |
| 149 | + # non-zero status even when grep matched, and every BLOCKED case would read | |
| 150 | + # as a self-test failure. Capture first, then compare. | |
| 151 | + v_of() { verdict 2>/dev/null; } | |
| 152 | + expect() { # expected-verdict, label | |
| 153 | + out=$("${@:3}" 2>/dev/null || true) | |
| 154 | + : | |
| 155 | + } | |
| 156 | + | |
| 157 | + # 1. all green -> GREEN | |
| 158 | + stub pin-ok 0 'echo "verify-fixture-library: GREEN"' | |
| 159 | + stub rungs-ok 0 'echo "ok derives the rungs"' | |
| 160 | + PIN_CHECKER=$d/pin-ok run_pin >/dev/null 2>&1 | |
| 161 | + RUNG_CHECKER=$d/rungs-ok run_rungs >/dev/null 2>&1 | |
| 162 | + if [ "$(v_of)" = "VERDICT=GREEN" ]; then | |
| 163 | + echo "ok 1 an all-green staging is GREEN" | |
| 164 | + else | |
| 165 | + echo "FAIL 1 an all-green staging is GREEN"; rc=1 | |
| 166 | + fi | |
| 167 | + | |
| 168 | + # 2. rung checker FAILS (exit 1) -> BLOCKED. The mutation: red the checker | |
| 169 | + # and the gate must stop. | |
| 170 | + stub rungs-bad 1 'echo "FAIL derived file violates the rung contract"' | |
| 171 | + PIN_CHECKER=$d/pin-ok run_pin >/dev/null 2>&1 | |
| 172 | + RUNG_CHECKER=$d/rungs-bad run_rungs >/dev/null 2>&1 | |
| 173 | + if [ "$(v_of)" = "VERDICT=BLOCKED" ]; then | |
| 174 | + echo "ok 2 a FAILING rung checker blocks the suite" | |
| 175 | + else | |
| 176 | + echo "FAIL 2 a FAILING rung checker blocks the suite"; rc=1 | |
| 177 | + fi | |
| 178 | + | |
| 179 | + # 3. rung checker NOT-RUN (exit 3), no waiver -> BLOCKED. | |
| 180 | + stub rungs-notrun 3 'echo "PREREQ-ABSENT: no oracle source at ..."' | |
| 181 | + PIN_CHECKER=$d/pin-ok run_pin >/dev/null 2>&1 | |
| 182 | + RUNG_CHECKER=$d/rungs-notrun run_rungs >/dev/null 2>&1 | |
| 183 | + if [ "$(v_of)" = "VERDICT=BLOCKED" ]; then | |
| 184 | + echo "ok 3 not-run without a waiver blocks the suite" | |
| 185 | + else | |
| 186 | + echo "FAIL 3 not-run without a waiver blocks the suite"; rc=1 | |
| 187 | + fi | |
| 188 | + | |
| 189 | + # 4. not-run WITH a waiver -> WAIVED, and the reason lands in the verdict. | |
| 190 | + if [ "$(SUITE_RUNG_WAIVER='host C carries oracle binaries only' v_of)" \ | |
| 191 | + = "VERDICT=WAIVED (rung_check=not-run waived: host C carries oracle binaries only)" ] | |
| 192 | + then | |
| 193 | + echo "ok 4 not-run with a named waiver is WAIVED, reason recorded" | |
| 194 | + else | |
| 195 | + echo "FAIL 4 not-run with a named waiver is WAIVED, reason recorded"; rc=1 | |
| 196 | + fi | |
| 197 | + | |
| 198 | + # 5. an EMPTY waiver authorises nothing: a unit Environment= carrying a bare | |
| 199 | + # SUITE_RUNG_WAIVER= is a real staging shape. | |
| 200 | + if [ "$(SUITE_RUNG_WAIVER='' v_of)" = "VERDICT=BLOCKED" ]; then | |
| 201 | + echo "ok 5 an empty waiver does not authorise a run" | |
| 202 | + else | |
| 203 | + echo "FAIL 5 an empty waiver does not authorise a run"; rc=1 | |
| 204 | + fi | |
| 205 | + | |
| 206 | + # 6. an ABSENT checker is never waivable: the host-A defect. | |
| 207 | + PIN_CHECKER=$d/pin-ok run_pin >/dev/null 2>&1 | |
| 208 | + RUNG_CHECKER=$d/does-not-exist run_rungs >/dev/null 2>&1 | |
| 209 | + if [ "$(SUITE_RUNG_WAIVER='a waiver' v_of)" = "VERDICT=BLOCKED" ]; then | |
| 210 | + echo "ok 6 a tree with NO rung checker is blocked even with a waiver" | |
| 211 | + else | |
| 212 | + echo "FAIL 6 a tree with NO rung checker is blocked even with a waiver"; rc=1 | |
| 213 | + fi | |
| 214 | + | |
| 215 | + # 6b. an ABSENT pin audit is fatal too, and not waivable by the same knob. | |
| 216 | + PIN_CHECKER=$d/does-not-exist run_pin >/dev/null 2>&1 | |
| 217 | + RUNG_CHECKER=$d/rungs-ok run_rungs >/dev/null 2>&1 | |
| 218 | + if [ "$(SUITE_RUNG_WAIVER='a waiver' v_of)" = "VERDICT=BLOCKED" ]; then | |
| 219 | + echo "ok 7 a tree with NO pin audit is blocked even with a waiver" | |
| 220 | + else | |
| 221 | + echo "FAIL 7 a tree with NO pin audit is blocked even with a waiver"; rc=1 | |
| 222 | + fi | |
| 223 | + | |
| 224 | + # 8. pin audit FAILING -> BLOCKED even when the rungs are green. | |
| 225 | + stub pin-bad 1 'echo "FAIL [invariant 4]: census self-test did not pass"' | |
| 226 | + PIN_CHECKER=$d/pin-bad run_pin >/dev/null 2>&1 | |
| 227 | + RUNG_CHECKER=$d/rungs-ok run_rungs >/dev/null 2>&1 | |
| 228 | + if [ "$(v_of)" = "VERDICT=BLOCKED" ]; then | |
| 229 | + echo "ok 8 a FAILING pin audit blocks the suite" | |
| 230 | + else | |
| 231 | + echo "FAIL 8 a FAILING pin audit blocks the suite"; rc=1 | |
| 232 | + fi | |
| 233 | + | |
| 234 | + return $rc | |
| 235 | +} | |
| 236 | + | |
| 237 | +if [ "$SELF_TEST" = 1 ]; then | |
| 238 | + self_test | |
| 239 | + exit $? | |
| 240 | +fi | |
| 241 | + | |
| 242 | +echo "=== PIN-GATE PREFLIGHT (EC_REQUIRE_FIXTURES=${EC_REQUIRE_FIXTURES:-0})" | |
| 243 | +run_pin | |
| 244 | +echo "=== ORACLE RUNG CHECKER" | |
| 245 | +run_rungs | |
| 246 | +echo "=== VERDICT" | |
| 247 | +verdict | |
| 248 | +exit $? |
scripts/check-aom-oracle-rungs.shmodified+31 -4
| @@ -20,6 +20,26 @@ | ||
| 20 | 20 | # av1/decoder/decodeframe.c and av1/common/reconintra.c with the PRISTINE |
| 21 | 21 | # upstream files, runs the instrument script over the copy, and asserts the |
| 22 | 22 | # derived files' shape. The real oracle tree is never written to. |
| 23 | +# | |
| 24 | +# EXIT CONTRACT (lane-av1stagegaps). A staging driver must be able to tell the | |
| 25 | +# three states apart, because "checker passed", "checker failed" and "checker | |
| 26 | +# never ran" all printed as `rungs_exit=1` (or as nothing at all) and the suite | |
| 27 | +# ran anyway. Measured 2026-09-30 on host host-d: the driver log showed | |
| 28 | +# === ORACLE RUNG CHECKER | |
| 29 | +# rungs_exit=1 ok_count=0 <- no detail line at all | |
| 30 | +# === SUITE | |
| 31 | +# while the real reason, with stderr visible, was a missing PREREQUISITE: | |
| 32 | +# no oracle source at /home/user/.cache/aom-oracle/src/av1/decoder/decodeframe.c | |
| 33 | +# $ ls ~/.cache/aom-oracle/ | |
| 34 | +# build <- binaries only, no src/ tree | |
| 35 | +# 0 GREEN every assertion below held. | |
| 36 | +# 3 NOTRUN a PREREQUISITE is absent (no oracle source tree, or the base ref | |
| 37 | +# is not in it). Nothing was asserted: this is NOT a pass and NOT a | |
| 38 | +# defect. scripts/av1-suite-preflight.sh maps it to `not-run` and | |
| 39 | +# BLOCKS the suite unless a waiver names the host. | |
| 40 | +# 1 FAIL a derived file violates the rung contract, or the instrument | |
| 41 | +# script errored / was not idempotent. | |
| 42 | + | |
| 23 | 43 | # |
| 24 | 44 | # Usage: |
| 25 | 45 | # scripts/check-aom-oracle-rungs.sh [SRC_DIR] [BASE_REF] |
| @@ -32,14 +52,21 @@ BASE="${2:-${AOM_ORACLE_BASE_REF:-v3.13.3}}" | ||
| 32 | 52 | HERE="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" |
| 33 | 53 | DERIVED="$SRC/av1/decoder/decodeframe.c" |
| 34 | 54 | RECONINTRA="$SRC/av1/common/reconintra.c" |
| 55 | +die_prereq() { echo "PREREQ-ABSENT: $*" >&2; exit 3; } | |
| 35 | 56 | |
| 36 | -[ -f "$DERIVED" ] || { echo "no oracle source at $DERIVED" >&2; exit 1; } | |
| 37 | -[ -f "$RECONINTRA" ] || { echo "no oracle source at $RECONINTRA" >&2; exit 1; } | |
| 57 | + | |
| 58 | +[ -f "$DERIVED" ] || die_prereq "no oracle source at $DERIVED (provision it: git clone -b v3.13.3 --depth 1 aom at $SRC)" | |
| 59 | +[ -f "$RECONINTRA" ] || die_prereq "no oracle source at $RECONINTRA (provision it: git clone -b v3.13.3 --depth 1 aom at $SRC)" | |
| 38 | 60 | git -C "$SRC" rev-parse --verify "$BASE^{commit}" >/dev/null 2>&1 || { |
| 39 | - echo "base ref '$BASE' is not a commit in $SRC" >&2 | |
| 40 | - exit 1 | |
| 61 | + die_prereq "base ref '$BASE' is not a commit in $SRC" | |
| 41 | 62 | } |
| 42 | 63 | |
| 64 | +# systemd-run's --setenv=TMPDIR points at a per-suite dir; if staging created | |
| 65 | +# the unit but not the dir, mktemp fails with an error that reads like a | |
| 66 | +# checker bug. It is the same class as a missing oracle tree: not asserted. | |
| 67 | +probe="$(mktemp -d "${TMPDIR:-$HOME/.cache/tmp}/aom-rung-check.XXXXXX" 2>/dev/null)" || | |
| 68 | + die_prereq "scratch dir ${TMPDIR:-$HOME/.cache/tmp} does not exist (staging must mkdir it)" | |
| 69 | +rmdir "$probe" | |
| 43 | 70 | WORK="$(mktemp -d "${TMPDIR:-$HOME/.cache/tmp}/aom-rung-check.XXXXXX")" |
| 44 | 71 | trap 'rm -rf "$WORK"' EXIT |
| 45 | 72 | cp -a "$SRC" "$WORK/src" |