Interplane page as plain text, for reading tools and agents. English is the reference text: translate it with your own tool. Text in backticks and in ``` blocks (commands, fingerprints, file names) and link targets in <...> are exact: copy them, never translate them. Page: /drakestapleton/spark-rsi-mv/blob/main/tests/canary_fixture/mod.rs # spark-rsi-mv Native Rust recursive self-improvement engine with paired bootstrap evaluation and cryptographic ledger Brought by drakestapleton Sign in to star 0 stars 0 watching About Files History Releases Proposed changes Issues For developers branch `main` Branches Tags History `spark-rsi-mv / tests / canary_fixture / mod.rs` 39 lines ยท 1438 bytes Raw Blame History 1 //! Builds the canary fixture crate once per test binary and hands back its executable. 2 3 use std::path::{Path, PathBuf}; 4 use std::process::Command; 5 use std::sync::OnceLock; 6 7 pub fn fixture_dir() -> PathBuf { 8 Path::new(env!("CARGO_MANIFEST_DIR")).join("fixtures/canary-target") 9 } 10 11 /// `cargo build --release --offline --locked --manifest-path fixtures/canary-target/Cargo.toml`, 12 /// run once, returning `fixtures/canary-target/target/release/canary-target`. 13 pub fn fixture_executable() -> &'static Path { 14 static BUILT: OnceLock = OnceLock::new(); 15 BUILT.get_or_init(|| { 16 let manifest = fixture_dir().join("Cargo.toml"); 17 let cargo = std::env::var("CARGO").unwrap_or_else(|_| "cargo".to_string()); 18 let out = Command::new(cargo) 19 .args([ 20 "build", 21 "--release", 22 "--offline", 23 "--locked", 24 "--manifest-path", 25 ]) 26 .arg(&manifest) 27 .env_remove("CARGO_TARGET_DIR") 28 .output() 29 .expect("cannot run cargo to build the canary fixture"); 30 assert!( 31 out.status.success(), 32 "canary fixture build failed:\n{}", 33 String::from_utf8_lossy(&out.stderr) 34 ); 35 let exe = fixture_dir().join("target/release/canary-target"); 36 assert!(exe.is_file(), "fixture executable missing at {:?}", exe); 37 exe 38 }) 39 }