fix(tests): make the platform-specific suites portable and deterministic

Four independent CI failures the first real cross-platform run surfaced:

- macOS SIGSEGV: the real-GL unit tests in gl_bridge ran wherever CGL is
  available, including the headless CI runner. Gate them with the same
  OAK_GPU_TESTS switch the integration GL tests already use (skip on CI,
  opt in on a real Mac).
- Windows build: examples compile under `cargo test`, and bench_playback
  used libc::getrusage unconditionally. Keep the Unix CPU accounting
  behind #[cfg(unix)] and report zero CPU seconds elsewhere.
- openKylin arm64: engine_without_a_project_hits_the_guard_paths assumed
  the library backend was unconfigured while a parallel config test
  transiently set Storage/Backend=sqlite. Take the shared config lock and
  pin the key off for the test's duration.
- openKylin x64: the prefetch smoke test asserted an exact decode count,
  but the hand-off LRU holds only DECODE_LRU_CAP (2) frames, so a request
  can miss the prefetched copy under scheduling pressure and re-run the
  producer (the eval cache still serves the pixels). Bound the count
  instead of pinning it; the deterministic sibling test pins read-ahead
  usage.
This commit is contained in:
2026-09-24 14:45:12 +08:00
parent 21dbde8435
commit b13ef477a8
4 changed files with 45 additions and 4 deletions
+11 -1
View File
@@ -66,7 +66,10 @@ fn worker_bin() -> PathBuf {
PathBuf::from("oak-worker")
}
/// `(user, system)` CPU seconds of this process and its children.
/// `(user, system)` CPU seconds of this process and its children (Unix
/// `getrusage`; the benchmark's CPU accounting is Unix-only, the rest of
/// the harness runs everywhere).
#[cfg(unix)]
fn cpu_times() -> (f64, f64) {
fn rusage(who: i32) -> (f64, f64) {
let mut usage: libc::rusage = unsafe { std::mem::zeroed() };
@@ -81,6 +84,13 @@ fn cpu_times() -> (f64, f64) {
(self_times.0 + children.0, self_times.1 + children.1)
}
/// Windows has no `getrusage`; the harness still builds and runs, it just
/// reports zero CPU seconds (`cargo test` compiles examples on every OS).
#[cfg(not(unix))]
fn cpu_times() -> (f64, f64) {
(0.0, 0.0)
}
/// One footage ticket over the whole timeline.
fn footage_params(media: &str, time: Rational, width: i32, height: i32) -> VideoTicketParams {
VideoTicketParams {