//! M2: `ail build --emit=staticlib` is RC-only. `--alloc=gc`/`--alloc=bump` //! must fail the build (the shared Boehm collector / bench stub are not //! swarm-safe). RED until the Task-4 CLI guard lands: today the alloc //! strategy is passed straight through and the build SUCCEEDS. use std::process::Command; fn ail_bin() -> &'static str { env!("CARGO_BIN_EXE_ail") } fn build_staticlib_with_alloc(alloc: &str, outdir: &str) -> std::process::Output { Command::new(ail_bin()) .args([ "build", "examples/embed_backtest_step.ail", "--emit=staticlib", &format!("--alloc={alloc}"), "-o", outdir, ]) .current_dir(env!("CARGO_MANIFEST_DIR").to_string() + "/../..") .output() .expect("spawn ail build") } #[test] fn staticlib_gc_is_rejected() { let out = build_staticlib_with_alloc("gc", "/tmp/ail_m2_guard_gc"); assert!( !out.status.success(), "expected `--emit=staticlib --alloc=gc` to FAIL the build; exit was success" ); let stderr = String::from_utf8_lossy(&out.stderr); assert!( stderr.contains("staticlib (swarm) artefact is RC-only"), "expected the RC-only diagnostic; stderr was:\n{stderr}" ); } #[test] fn staticlib_bump_is_rejected() { let out = build_staticlib_with_alloc("bump", "/tmp/ail_m2_guard_bump"); assert!( !out.status.success(), "expected `--emit=staticlib --alloc=bump` to FAIL the build; exit was success" ); let stderr = String::from_utf8_lossy(&out.stderr); assert!( stderr.contains("staticlib (swarm) artefact is RC-only"), "expected the RC-only diagnostic; stderr was:\n{stderr}" ); }