Oracle lives in ~/.cache, not reaped /tmp -- 20 gates were silently vacuous
Browse files at this commit1fc2eb056032d9fbea203ad9a05691941e9474ccParent: f03f2a3- fix
- oracle lives in ~/.cache, not reaped /tmp -- 20 gates were silently vacuous
2 changed files +63 -4
- crates/ec-av1/src/stream.rs +29 -4
- scripts/build-aom-oracle.sh +34 -0
crates/ec-av1/src/stream.rsmodified+29 -4
| @@ -1111,13 +1111,38 @@ mod tests { | |||
| 1111 | /// default dev-build path; the test skips (not fails) when neither this | 1111 | /// default dev-build path; the test skips (not fails) when neither this |
| 1112 | /// nor `ffmpeg` is present. | 1112 | /// nor `ffmpeg` is present. |
| 1113 | fn aomenc_path() -> std::path::PathBuf { | 1113 | fn aomenc_path() -> std::path::PathBuf { |
| 1114 | - std::env::var_os("EC_AV1_AOMENC") | 1114 | + if let Some(p) = std::env::var_os("EC_AV1_AOMENC") { |
| 1115 | - .map(std::path::PathBuf::from) | 1115 | + return std::path::PathBuf::from(p); |
| 1116 | - .unwrap_or_else(|| "/tmp/libaom-src/build/encoder/aomenc".into()) | 1116 | + } |
| 1117 | + // The oracle used to live only under `/tmp`, which this box's tmpfs | ||
| 1118 | + // guard reclaims -- when it did, all 20 aomenc gates below went | ||
| 1119 | + // silently vacuous (SKIP, suite still green). The durable location | ||
| 1120 | + // is provisioned by `scripts/build-aom-oracle.sh`; the `/tmp` path | ||
| 1121 | + // stays last as a legacy fallback. | ||
| 1122 | + let mut candidates = Vec::new(); | ||
| 1123 | + if let Some(home) = std::env::var_os("HOME") { | ||
| 1124 | + candidates.push(std::path::PathBuf::from(&home).join(".cache/aom-oracle/build/aomenc")); | ||
| 1125 | + } | ||
| 1126 | + candidates.push("/tmp/libaom-src/build/encoder/aomenc".into()); | ||
| 1127 | + candidates | ||
| 1128 | + .iter() | ||
| 1129 | + .find(|p| p.is_file()) | ||
| 1130 | + .cloned() | ||
| 1131 | + .unwrap_or_else(|| candidates.remove(0)) | ||
| 1117 | } | 1132 | } |
| 1118 | 1133 | ||
| 1134 | + /// Whether the aomenc oracle is present. Absence normally SKIPs (a | ||
| 1135 | + /// checkout without the oracle should still run the rest of the suite), | ||
| 1136 | + /// but `EC_AV1_REQUIRE_AOMENC=1` turns it into a hard failure so a batch | ||
| 1137 | + /// run cannot report green off 20 skipped gates. | ||
| 1119 | fn have_aomenc() -> bool { | 1138 | fn have_aomenc() -> bool { |
| 1120 | - aomenc_path().is_file() | 1139 | + let present = aomenc_path().is_file(); |
| 1140 | + assert!( | ||
| 1141 | + present || std::env::var_os("EC_AV1_REQUIRE_AOMENC").is_none(), | ||
| 1142 | + "EC_AV1_REQUIRE_AOMENC is set but no aomenc at {} -- run scripts/build-aom-oracle.sh", | ||
| 1143 | + aomenc_path().display() | ||
| 1144 | + ); | ||
| 1145 | + present | ||
| 1121 | } | 1146 | } |
| 1122 | 1147 | ||
| 1123 | /// A real `aomenc` filter-intra fixture: every other intra mode disabled | 1148 | /// A real `aomenc` filter-intra fixture: every other intra mode disabled |
scripts/build-aom-oracle.shadded+34 -0
| @@ -0,0 +1,34 @@ | |||
| 1 | +#!/usr/bin/env bash | ||
| 2 | +# Provision the libaom oracle the ec-av1 gates and every decode-verification | ||
| 3 | +# claim depend on: the C source (read as ground truth) plus aomenc/aomdec. | ||
| 4 | +# | ||
| 5 | +# It lives under ~/.cache, NOT /tmp: on 2026-08-30 a tmpfs reclaim wiped | ||
| 6 | +# /tmp/libaom-src and all 20 aomenc gates in crates/ec-av1/src/stream.rs | ||
| 7 | +# started SKIPping, leaving a green-but-vacuous suite. Re-run this whenever | ||
| 8 | +# `cargo test -p ec-av1` prints "SKIP ...: no aomenc at ...". | ||
| 9 | +# | ||
| 10 | +# nasm/yasm are absent on this box, so the build uses AOM_TARGET_CPU=generic | ||
| 11 | +# (C only). Decode is normative, so aomdec stays bit-exact; encode is slower. | ||
| 12 | +# Install nasm and drop that flag for a faster oracle. | ||
| 13 | +set -euo pipefail | ||
| 14 | + | ||
| 15 | +VERSION="${AOM_VERSION:-v3.13.3}" | ||
| 16 | +ROOT="${AOM_ORACLE_ROOT:-$HOME/.cache/aom-oracle}" | ||
| 17 | +SRC="$ROOT/src" | ||
| 18 | +BUILD="$ROOT/build" | ||
| 19 | + | ||
| 20 | +if [ ! -d "$SRC/.git" ]; then | ||
| 21 | + git clone --depth 1 --branch "$VERSION" https://aomedia.googlesource.com/aom "$SRC" | ||
| 22 | +fi | ||
| 23 | + | ||
| 24 | +cmake -S "$SRC" -B "$BUILD" -G Ninja \ | ||
| 25 | + -DCMAKE_BUILD_TYPE=Release \ | ||
| 26 | + -DENABLE_TESTS=0 -DENABLE_DOCS=0 -DENABLE_EXAMPLES=1 \ | ||
| 27 | + -DCONFIG_INSPECTION=1 \ | ||
| 28 | + -DAOM_TARGET_CPU="${AOM_TARGET_CPU:-generic}" | ||
| 29 | +ninja -C "$BUILD" aomenc aomdec | ||
| 30 | + | ||
| 31 | +echo "oracle ready:" | ||
| 32 | +echo " source $SRC" | ||
| 33 | +echo " aomenc $BUILD/aomenc" | ||
| 34 | +echo " aomdec $BUILD/aomdec" | ||