From 4e10b9e9c142debc0ec3041096c9ab9c734baa2d Mon Sep 17 00:00:00 2001 From: sim Date: Thu, 17 Sep 2026 22:18:59 +0200 Subject: [PATCH] test: one disc resolver, no machine-specific defaults, all three corpora in the container MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Finishes #16 in the three places its earlier remedies missed. `tests/`: the last four local `disc_root()` copies now use `tests/common`, and with them goes the one real hardcoded fallback — `ui_keyframe_record_disc.rs` fell back to an absolute path on one machine, which made `unset SYLPHEED_DISC` a no-op there. Control: with the corpus absent that suite now finishes in 0.00s instead of 57.55s, so it skips rather than finding a disc of its own. `examples/`: seventeen examples defaulted to `/disc`, the mount point inside the CI container. Redundant there — `docker/ci/run` sets `SYLPHEED_DISC=/disc` — and wrong everywhere else, where a missing corpus turned into a file-not-found against a path that has never existed on the host. They now name the variable to set, like the other hundred examples already did. `docker/ci/run`: mount `$SYLPHEED_RES3D` and `$SYLPHEED_ISO` alongside the disc. Only the disc was mounted, so an in-container run sat out the res3d and iso suites while looking like a full one — the defect this issue is about, in the runner itself. Measured in the container on this desktop with all three corpora present: 45 suites / 377 passed / 0 failed / 14 ignored, and `sylpheed-corpus-report.txt` now reports PRESENT for all three rather than for the disc alone. Refs #16. Co-Authored-By: Claude Opus 5 (1M context) --- crates/sylpheed-export/examples/bank_chunks.rs | 3 ++- .../sylpheed-export/examples/bgm_size_census.rs | 3 ++- crates/sylpheed-export/examples/dialog_pairs.rs | 3 ++- crates/sylpheed-export/examples/dialog_rows.rs | 3 ++- crates/sylpheed-export/examples/rat_leaf.rs | 3 ++- .../examples/record_loop_control.rs | 3 ++- .../examples/record_population.rs | 3 ++- .../examples/static_with_cycle.rs | 3 ++- crates/sylpheed-export/examples/voice_chunks.rs | 3 ++- crates/sylpheed-formats/examples/_pbafc.rs | 3 ++- .../examples/correlate_capture.rs | 3 +-- .../examples/focus_alpha_census.rs | 3 ++- .../examples/prm_alpha_census.rs | 3 ++- .../examples/prm_colour_census.rs | 3 ++- .../examples/prm_forced_first.rs | 3 ++- .../examples/prm_occlusion_check.rs | 3 ++- .../examples/prm_span_sensitivity.rs | 3 ++- .../examples/record_loop_length.rs | 3 ++- .../tests/ui_forced_backdrop_disc.rs | 6 ++---- .../tests/ui_keyframe_record_disc.rs | 17 ++--------------- .../tests/ui_record_loop_length_disc.rs | 6 ++---- .../tests/ui_settle_time_disc.rs | 11 ++--------- docker/ci/run | 14 +++++++++++++- 23 files changed, 56 insertions(+), 52 deletions(-) diff --git a/crates/sylpheed-export/examples/bank_chunks.rs b/crates/sylpheed-export/examples/bank_chunks.rs index d24f687c..9a5cad5e 100644 --- a/crates/sylpheed-export/examples/bank_chunks.rs +++ b/crates/sylpheed-export/examples/bank_chunks.rs @@ -7,7 +7,8 @@ use std::process::Command; use sylpheed_formats::media; fn main() { - let disc = std::env::var("SYLPHEED_DISC").unwrap_or_else(|_| "/disc".into()); + let disc = + std::env::var("SYLPHEED_DISC").expect("set SYLPHEED_DISC to the extracted disc root"); let src = media::DirectorySource::new(&disc); for bank in ["BGM_103.slb", "BGM_102.slb", "BGM_001.slb"] { match media::sound_bank_riffs(&src, bank) { diff --git a/crates/sylpheed-export/examples/bgm_size_census.rs b/crates/sylpheed-export/examples/bgm_size_census.rs index bb93187f..b4f7388f 100644 --- a/crates/sylpheed-export/examples/bgm_size_census.rs +++ b/crates/sylpheed-export/examples/bgm_size_census.rs @@ -18,7 +18,8 @@ use sylpheed_formats::media; fn main() { - let root = std::env::var("SYLPHEED_DISC").unwrap_or_else(|_| "/disc".into()); + let root = + std::env::var("SYLPHEED_DISC").expect("set SYLPHEED_DISC to the extracted disc root"); let src = media::DirectorySource::new(&root); const WANT: [usize; 2] = [3_876_864, 3_930_112]; let (mut found, mut matches) = (0usize, Vec::new()); diff --git a/crates/sylpheed-export/examples/dialog_pairs.rs b/crates/sylpheed-export/examples/dialog_pairs.rs index 22d5b056..467fdc98 100644 --- a/crates/sylpheed-export/examples/dialog_pairs.rs +++ b/crates/sylpheed-export/examples/dialog_pairs.rs @@ -20,7 +20,8 @@ use std::collections::BTreeSet; use sylpheed_formats::{pak, ratc, ui_layout}; fn main() { - let root = std::env::var("SYLPHEED_DISC").unwrap_or_else(|_| "/disc".into()); + let root = + std::env::var("SYLPHEED_DISC").expect("set SYLPHEED_DISC to the extracted disc root"); let ar = pak::PakArchive::open(format!("{root}/dat/GP_DIALOG.pak")).expect("GP_DIALOG.pak"); let sets: Vec>> = ar .entries() diff --git a/crates/sylpheed-export/examples/dialog_rows.rs b/crates/sylpheed-export/examples/dialog_rows.rs index 8e28f014..49c33bec 100644 --- a/crates/sylpheed-export/examples/dialog_rows.rs +++ b/crates/sylpheed-export/examples/dialog_rows.rs @@ -17,7 +17,8 @@ use sylpheed_formats::{pak, ratc, ui_layout}; fn main() { - let root = std::env::var("SYLPHEED_DISC").unwrap_or_else(|_| "/disc".into()); + let root = + std::env::var("SYLPHEED_DISC").expect("set SYLPHEED_DISC to the extracted disc root"); // 🔴 WIDENED 2026-08-31 to every pak, to check the Decoder's rival search // independently. They report zero four-button builds within 6 px of // 259/329/399/469 anywhere on the disc, which turns "another dialog with diff --git a/crates/sylpheed-export/examples/rat_leaf.rs b/crates/sylpheed-export/examples/rat_leaf.rs index 7bfc7eef..3f1000f2 100644 --- a/crates/sylpheed-export/examples/rat_leaf.rs +++ b/crates/sylpheed-export/examples/rat_leaf.rs @@ -8,7 +8,8 @@ use sylpheed_formats::{pak::PakArchive, ui_layout}; fn main() { - let disc = std::env::var("SYLPHEED_DISC").unwrap_or_else(|_| "/disc".into()); + let disc = + std::env::var("SYLPHEED_DISC").expect("set SYLPHEED_DISC to the extracted disc root"); let ar = PakArchive::open(format!("{disc}/dat/GP_TITLE.pak")).expect("open"); let e = &ar.entries()[4]; // entry 4 = the English title let bundle = ar.read(e).expect("read"); diff --git a/crates/sylpheed-export/examples/record_loop_control.rs b/crates/sylpheed-export/examples/record_loop_control.rs index 87d177d7..2d2866e7 100644 --- a/crates/sylpheed-export/examples/record_loop_control.rs +++ b/crates/sylpheed-export/examples/record_loop_control.rs @@ -48,7 +48,8 @@ fn main() { .unwrap_or(8); unsafe { OFFSET = off }; println!(" reading the loop length at header +0x{off:02x}"); - let root = std::env::var("SYLPHEED_DISC").unwrap_or_else(|_| "/disc".into()); + let root = + std::env::var("SYLPHEED_DISC").expect("set SYLPHEED_DISC to the extracted disc root"); let mut paks: Vec<_> = std::fs::read_dir(format!("{root}/dat")) .expect("dat/") .flatten() diff --git a/crates/sylpheed-export/examples/record_population.rs b/crates/sylpheed-export/examples/record_population.rs index 644676b8..0148dc64 100644 --- a/crates/sylpheed-export/examples/record_population.rs +++ b/crates/sylpheed-export/examples/record_population.rs @@ -11,7 +11,8 @@ use sylpheed_formats::{pak, ratc, ui_layout}; fn main() { - let root = std::env::var("SYLPHEED_DISC").unwrap_or_else(|_| "/disc".into()); + let root = + std::env::var("SYLPHEED_DISC").expect("set SYLPHEED_DISC to the extracted disc root"); let mut paks: Vec<_> = std::fs::read_dir(format!("{root}/dat")) .expect("dat/") .flatten() diff --git a/crates/sylpheed-export/examples/static_with_cycle.rs b/crates/sylpheed-export/examples/static_with_cycle.rs index 6ca5d394..8add1a8d 100644 --- a/crates/sylpheed-export/examples/static_with_cycle.rs +++ b/crates/sylpheed-export/examples/static_with_cycle.rs @@ -11,7 +11,8 @@ use sylpheed_formats::{pak, ratc, ui_layout}; fn main() { - let root = std::env::var("SYLPHEED_DISC").unwrap_or_else(|_| "/disc".into()); + let root = + std::env::var("SYLPHEED_DISC").expect("set SYLPHEED_DISC to the extracted disc root"); let ar = pak::PakArchive::open(format!("{root}/dat/GP_TITLE.pak")).expect("GP_TITLE.pak"); let (mut total, mut hits, mut multipose) = (0usize, 0usize, 0usize); for (i, e) in ar.entries().iter().enumerate() { diff --git a/crates/sylpheed-export/examples/voice_chunks.rs b/crates/sylpheed-export/examples/voice_chunks.rs index 998bcb34..18bbc4b5 100644 --- a/crates/sylpheed-export/examples/voice_chunks.rs +++ b/crates/sylpheed-export/examples/voice_chunks.rs @@ -7,7 +7,8 @@ use std::process::Command; use sylpheed_formats::{media, slb::VoiceLang}; fn main() { - let disc = std::env::var("SYLPHEED_DISC").unwrap_or_else(|_| "/disc".into()); + let disc = + std::env::var("SYLPHEED_DISC").expect("set SYLPHEED_DISC to the extracted disc root"); let src = media::DirectorySource::new(&disc); for movie in ["ADV", "S00A", "RT01A"] { let Some((s, e)) = media::resolve_movie_voice_region(&src, movie, VoiceLang::English) diff --git a/crates/sylpheed-formats/examples/_pbafc.rs b/crates/sylpheed-formats/examples/_pbafc.rs index 0222a668..7e6c892c 100644 --- a/crates/sylpheed-formats/examples/_pbafc.rs +++ b/crates/sylpheed-formats/examples/_pbafc.rs @@ -1,6 +1,7 @@ use sylpheed_formats::{pak, ratc, ui_layout}; fn main() { - let root = std::env::var("SYLPHEED_DISC").unwrap_or_else(|_| "/disc".into()); + let root = + std::env::var("SYLPHEED_DISC").expect("set SYLPHEED_DISC to the extracted disc root"); let ar = pak::PakArchive::open(format!("{root}/dat/GP_READY_ROOM.pak")).unwrap(); for (i, e) in ar.entries().iter().enumerate() { let Ok(by) = ar.read(e) else { continue }; diff --git a/crates/sylpheed-formats/examples/correlate_capture.rs b/crates/sylpheed-formats/examples/correlate_capture.rs index e9771878..2eb1001a 100644 --- a/crates/sylpheed-formats/examples/correlate_capture.rs +++ b/crates/sylpheed-formats/examples/correlate_capture.rs @@ -16,8 +16,7 @@ //! Usage: //! SYLPHEED_ISO=... cargo run --release --example correlate_capture -- \ //! [ref_part_substr] [--emit] -//! e.g. SYLPHEED_ISO="/home/fabi/RE - Project Sylpheed/Project Sylpheed - Arc of -//! Deception (USA, Europe) (En,Ja).iso" \ +//! e.g. SYLPHEED_ISO="/path/to/Project Sylpheed - Arc of Deception (USA, Europe) (En,Ja).iso" \ //! cargo run --release --example correlate_capture -- \ //! xenia_ship_capture.log Stage_S01 e106 bdy_04 --emit diff --git a/crates/sylpheed-formats/examples/focus_alpha_census.rs b/crates/sylpheed-formats/examples/focus_alpha_census.rs index 18e164f4..ec1c271d 100644 --- a/crates/sylpheed-formats/examples/focus_alpha_census.rs +++ b/crates/sylpheed-formats/examples/focus_alpha_census.rs @@ -11,7 +11,8 @@ use sylpheed_formats::{pak, ratc, ui_layout}; fn main() { - let root = std::env::var("SYLPHEED_DISC").unwrap_or_else(|_| "/disc".into()); + let root = + std::env::var("SYLPHEED_DISC").expect("set SYLPHEED_DISC to the extracted disc root"); let mut paks: Vec<_> = std::fs::read_dir(format!("{root}/dat")) .expect("dat/") .flatten() diff --git a/crates/sylpheed-formats/examples/prm_alpha_census.rs b/crates/sylpheed-formats/examples/prm_alpha_census.rs index aca2bbe1..240c0ded 100644 --- a/crates/sylpheed-formats/examples/prm_alpha_census.rs +++ b/crates/sylpheed-formats/examples/prm_alpha_census.rs @@ -15,7 +15,8 @@ use std::collections::BTreeMap; use sylpheed_formats::{pak, ratc, ui_layout}; fn main() { - let root = std::env::var("SYLPHEED_DISC").unwrap_or_else(|_| "/disc".into()); + let root = + std::env::var("SYLPHEED_DISC").expect("set SYLPHEED_DISC to the extracted disc root"); let mut paks: Vec<_> = std::fs::read_dir(format!("{root}/dat")) .expect("dat/") .flatten() diff --git a/crates/sylpheed-formats/examples/prm_colour_census.rs b/crates/sylpheed-formats/examples/prm_colour_census.rs index db984ad4..83a5266c 100644 --- a/crates/sylpheed-formats/examples/prm_colour_census.rs +++ b/crates/sylpheed-formats/examples/prm_colour_census.rs @@ -6,7 +6,8 @@ use std::collections::BTreeMap; use sylpheed_formats::{pak, ratc, ui_layout}; fn main() { - let root = std::env::var("SYLPHEED_DISC").unwrap_or_else(|_| "/disc".into()); + let root = + std::env::var("SYLPHEED_DISC").expect("set SYLPHEED_DISC to the extracted disc root"); let mut paks: Vec<_> = std::fs::read_dir(format!("{root}/dat")) .expect("dat/") .flatten() diff --git a/crates/sylpheed-formats/examples/prm_forced_first.rs b/crates/sylpheed-formats/examples/prm_forced_first.rs index f84b2092..39034831 100644 --- a/crates/sylpheed-formats/examples/prm_forced_first.rs +++ b/crates/sylpheed-formats/examples/prm_forced_first.rs @@ -14,7 +14,8 @@ use sylpheed_formats::{pak, ratc, ui_layout}; fn main() { - let root = std::env::var("SYLPHEED_DISC").unwrap_or_else(|_| "/disc".into()); + let root = + std::env::var("SYLPHEED_DISC").expect("set SYLPHEED_DISC to the extracted disc root"); let mut paks: Vec<_> = std::fs::read_dir(format!("{root}/dat")) .expect("dat/") .flatten() diff --git a/crates/sylpheed-formats/examples/prm_occlusion_check.rs b/crates/sylpheed-formats/examples/prm_occlusion_check.rs index 8672ad60..72afaa7d 100644 --- a/crates/sylpheed-formats/examples/prm_occlusion_check.rs +++ b/crates/sylpheed-formats/examples/prm_occlusion_check.rs @@ -33,7 +33,8 @@ fn opaque_span(el: &ui_layout::Element, thr: u32, tmax: u32) -> Vec<(f64, f64)> } fn main() { - let root = std::env::var("SYLPHEED_DISC").unwrap_or_else(|_| "/disc".into()); + let root = + std::env::var("SYLPHEED_DISC").expect("set SYLPHEED_DISC to the extracted disc root"); let mut paks: Vec<_> = std::fs::read_dir(format!("{root}/dat")) .expect("dat/") .flatten() diff --git a/crates/sylpheed-formats/examples/prm_span_sensitivity.rs b/crates/sylpheed-formats/examples/prm_span_sensitivity.rs index c47987a5..0b213e1b 100644 --- a/crates/sylpheed-formats/examples/prm_span_sensitivity.rs +++ b/crates/sylpheed-formats/examples/prm_span_sensitivity.rs @@ -58,7 +58,8 @@ fn forced(b: &ui_layout::UiBuild, el: &ui_layout::Element, tmax: u32, hold: bool } fn main() { - let root = std::env::var("SYLPHEED_DISC").unwrap_or_else(|_| "/disc".into()); + let root = + std::env::var("SYLPHEED_DISC").expect("set SYLPHEED_DISC to the extracted disc root"); let mut paks: Vec<_> = std::fs::read_dir(format!("{root}/dat")) .expect("dat/") .flatten() diff --git a/crates/sylpheed-formats/examples/record_loop_length.rs b/crates/sylpheed-formats/examples/record_loop_length.rs index 3d9bcfa8..8f18b166 100644 --- a/crates/sylpheed-formats/examples/record_loop_length.rs +++ b/crates/sylpheed-formats/examples/record_loop_length.rs @@ -20,7 +20,8 @@ use std::collections::BTreeMap; use sylpheed_formats::{pak, ratc, ui_layout}; fn main() { - let root = std::env::var("SYLPHEED_DISC").unwrap_or_else(|_| "/disc".into()); + let root = + std::env::var("SYLPHEED_DISC").expect("set SYLPHEED_DISC to the extracted disc root"); let mut paks: Vec<_> = std::fs::read_dir(format!("{root}/dat")) .expect("dat/") .flatten() diff --git a/crates/sylpheed-formats/tests/ui_forced_backdrop_disc.rs b/crates/sylpheed-formats/tests/ui_forced_backdrop_disc.rs index a6f99b58..c9cb0e35 100644 --- a/crates/sylpheed-formats/tests/ui_forced_backdrop_disc.rs +++ b/crates/sylpheed-formats/tests/ui_forced_backdrop_disc.rs @@ -16,10 +16,8 @@ use std::path::PathBuf; use sylpheed_formats::{pak::PakArchive, ratc, ui_layout}; -fn disc_root() -> Option { - let p = PathBuf::from(std::env::var("SYLPHEED_DISC").ok()?); - p.join("dat").is_dir().then_some(p) -} +mod common; +use common::disc_root; fn build(ar: &PakArchive, i: usize) -> (Vec, ui_layout::UiBuild) { let by = ar.read(&ar.entries()[i]).expect("entry"); diff --git a/crates/sylpheed-formats/tests/ui_keyframe_record_disc.rs b/crates/sylpheed-formats/tests/ui_keyframe_record_disc.rs index bade337a..4e184f8d 100644 --- a/crates/sylpheed-formats/tests/ui_keyframe_record_disc.rs +++ b/crates/sylpheed-formats/tests/ui_keyframe_record_disc.rs @@ -26,21 +26,8 @@ use std::path::{Path, PathBuf}; use sylpheed_formats::{pak::PakArchive, ratc, ui_layout}; -fn disc_root() -> Option { - if let Ok(p) = std::env::var("SYLPHEED_DISC") { - let p = PathBuf::from(p); - if p.join("dat").is_dir() { - return Some(p); - } - } - let default = Path::new( - "/home/fabi/RE - Project Sylpheed/Project Sylpheed - Arc of Deception (USA, Europe) (En,Ja)", - ); - if default.join("dat").is_dir() { - return Some(default.to_path_buf()); - } - None -} +mod common; +use common::disc_root; fn for_each_build(root: &Path, mut f: impl FnMut(&str, &[u8])) { let mut paks: Vec = std::fs::read_dir(root.join("dat")) diff --git a/crates/sylpheed-formats/tests/ui_record_loop_length_disc.rs b/crates/sylpheed-formats/tests/ui_record_loop_length_disc.rs index 71868eb8..fdecca2c 100644 --- a/crates/sylpheed-formats/tests/ui_record_loop_length_disc.rs +++ b/crates/sylpheed-formats/tests/ui_record_loop_length_disc.rs @@ -22,10 +22,8 @@ use std::path::PathBuf; use sylpheed_formats::{pak::PakArchive, ratc, ui_layout}; -fn disc_root() -> Option { - let p = PathBuf::from(std::env::var("SYLPHEED_DISC").ok()?); - p.join("dat").is_dir().then_some(p) -} +mod common; +use common::disc_root; /// Read a nested record's declared length and its largest keyframe time. fn record_len_and_maxt(bundle: &[u8], off: usize, size: usize) -> Option<(i64, i64)> { diff --git a/crates/sylpheed-formats/tests/ui_settle_time_disc.rs b/crates/sylpheed-formats/tests/ui_settle_time_disc.rs index cde311f5..3631f0df 100644 --- a/crates/sylpheed-formats/tests/ui_settle_time_disc.rs +++ b/crates/sylpheed-formats/tests/ui_settle_time_disc.rs @@ -25,15 +25,8 @@ use std::path::PathBuf; use sylpheed_formats::{pak::PakArchive, ratc, ui_layout}; -fn disc_root() -> Option { - if let Ok(p) = std::env::var("SYLPHEED_DISC") { - let p = PathBuf::from(p); - if p.join("dat").is_dir() { - return Some(p); - } - } - None -} +mod common; +use common::disc_root; /// The case that found the bug, asserted end to end. #[test] diff --git a/docker/ci/run b/docker/ci/run index bd7c007c..fee66d0e 100755 --- a/docker/ci/run +++ b/docker/ci/run @@ -36,8 +36,20 @@ args=( -w /work ) -# The disc, read-only, when a disc-backed test or the exporter needs it. +# The corpora, read-only, when a disc-backed test or the exporter needs them. +# +# All three, not just the disc: a suite whose corpus is absent self-skips and +# still counts as passed, so mounting one of three made an in-container run look +# like a full one while `res3d` and `iso` suites silently sat out (#16). Each is +# mounted only when it exists, and `target/sylpheed-corpus-report.txt` says which +# ones the run actually had. DISC="${SYLPHEED_DISC:-$REPO/../sylph_extract}" [ -d "$DISC" ] && args+=(-v "$DISC:/disc:ro" -e SYLPHEED_DISC=/disc) +RES3D="${SYLPHEED_RES3D:-}" +[ -n "$RES3D" ] && [ -d "$RES3D" ] && args+=(-v "$RES3D:/res3d:ro" -e SYLPHEED_RES3D=/res3d) + +ISO="${SYLPHEED_ISO:-}" +[ -n "$ISO" ] && [ -f "$ISO" ] && args+=(-v "$ISO:/disc.iso:ro" -e SYLPHEED_ISO=/disc.iso) + exec docker run "${args[@]}" "$IMAGE" "$@" -- 2.49.1