diff --git a/crates/ec-av1/src/stream.rs b/crates/ec-av1/src/stream.rs index ba2f3685..691c0267 100644 --- a/crates/ec-av1/src/stream.rs +++ b/crates/ec-av1/src/stream.rs @@ -1111,13 +1111,38 @@ mod tests { /// default dev-build path; the test skips (not fails) when neither this /// nor `ffmpeg` is present. fn aomenc_path() -> std::path::PathBuf { - std::env::var_os("EC_AV1_AOMENC") - .map(std::path::PathBuf::from) - .unwrap_or_else(|| "/tmp/libaom-src/build/encoder/aomenc".into()) + if let Some(p) = std::env::var_os("EC_AV1_AOMENC") { + return std::path::PathBuf::from(p); + } + // The oracle used to live only under `/tmp`, which this box's tmpfs + // guard reclaims -- when it did, all 20 aomenc gates below went + // silently vacuous (SKIP, suite still green). The durable location + // is provisioned by `scripts/build-aom-oracle.sh`; the `/tmp` path + // stays last as a legacy fallback. + let mut candidates = Vec::new(); + if let Some(home) = std::env::var_os("HOME") { + candidates.push(std::path::PathBuf::from(&home).join(".cache/aom-oracle/build/aomenc")); + } + candidates.push("/tmp/libaom-src/build/encoder/aomenc".into()); + candidates + .iter() + .find(|p| p.is_file()) + .cloned() + .unwrap_or_else(|| candidates.remove(0)) } + /// Whether the aomenc oracle is present. Absence normally SKIPs (a + /// checkout without the oracle should still run the rest of the suite), + /// but `EC_AV1_REQUIRE_AOMENC=1` turns it into a hard failure so a batch + /// run cannot report green off 20 skipped gates. fn have_aomenc() -> bool { - aomenc_path().is_file() + let present = aomenc_path().is_file(); + assert!( + present || std::env::var_os("EC_AV1_REQUIRE_AOMENC").is_none(), + "EC_AV1_REQUIRE_AOMENC is set but no aomenc at {} -- run scripts/build-aom-oracle.sh", + aomenc_path().display() + ); + present } /// A real `aomenc` filter-intra fixture: every other intra mode disabled diff --git a/scripts/build-aom-oracle.sh b/scripts/build-aom-oracle.sh new file mode 100755 index 00000000..098807e4 --- /dev/null +++ b/scripts/build-aom-oracle.sh @@ -0,0 +1,34 @@ +#!/usr/bin/env bash +# Provision the libaom oracle the ec-av1 gates and every decode-verification +# claim depend on: the C source (read as ground truth) plus aomenc/aomdec. +# +# It lives under ~/.cache, NOT /tmp: on 2026-08-30 a tmpfs reclaim wiped +# /tmp/libaom-src and all 20 aomenc gates in crates/ec-av1/src/stream.rs +# started SKIPping, leaving a green-but-vacuous suite. Re-run this whenever +# `cargo test -p ec-av1` prints "SKIP ...: no aomenc at ...". +# +# nasm/yasm are absent on this box, so the build uses AOM_TARGET_CPU=generic +# (C only). Decode is normative, so aomdec stays bit-exact; encode is slower. +# Install nasm and drop that flag for a faster oracle. +set -euo pipefail + +VERSION="${AOM_VERSION:-v3.13.3}" +ROOT="${AOM_ORACLE_ROOT:-$HOME/.cache/aom-oracle}" +SRC="$ROOT/src" +BUILD="$ROOT/build" + +if [ ! -d "$SRC/.git" ]; then + git clone --depth 1 --branch "$VERSION" https://aomedia.googlesource.com/aom "$SRC" +fi + +cmake -S "$SRC" -B "$BUILD" -G Ninja \ + -DCMAKE_BUILD_TYPE=Release \ + -DENABLE_TESTS=0 -DENABLE_DOCS=0 -DENABLE_EXAMPLES=1 \ + -DCONFIG_INSPECTION=1 \ + -DAOM_TARGET_CPU="${AOM_TARGET_CPU:-generic}" +ninja -C "$BUILD" aomenc aomdec + +echo "oracle ready:" +echo " source $SRC" +echo " aomenc $BUILD/aomenc" +echo " aomdec $BUILD/aomdec"