//! QA A-35: no test-only feature may reach a normal (release) build through Cargo feature //! unification. Checks the normal-edge dependency graph that a consumer of Arcanum would get. //! //! `arcanum/hazmat` exposes the deterministic entry points; `ml-kem/hazmat` only un-hides docs in //! 0.3.4 (its `encapsulate_deterministic` is public either way), but is kept out on principle. use std::process::Command; fn tree(args: &[&str]) -> String { let out = Command::new(env!("CARGO")) .current_dir(env!("CARGO_MANIFEST_DIR")) .args(["tree", "--offline", "--locked", "-e", "features,normal", "--prefix", "none"]) .args(args) .output() .expect("run cargo tree"); assert!(out.status.success(), "cargo tree failed: {}", String::from_utf8_lossy(&out.stderr)); String::from_utf8(out.stdout).unwrap() } #[test] fn hazmat_is_not_in_the_normal_graph() { let t = tree(&["-p", "arcanum"]); assert!(t.contains("ml-kem"), "the tree must include ml-kem, or this test checks nothing:\n{t}"); for line in t.lines() { assert!(!line.contains("feature \"hazmat\""), "hazmat reached a normal build: {line}\n{t}"); } } #[test] fn no_os_rng_in_the_normal_graph() { // Randomness is a parameter (QA A-36): nothing in the normal graph may pull an OS RNG. let t = tree(&["-p", "arcanum"]); assert!(!t.contains("getrandom"), "getrandom reached a normal build:\n{t}"); }