Implement pure Rust visual snapshots (#132)
This commit is contained in:
@@ -2,10 +2,14 @@ use std::collections::BTreeSet;
|
||||
use std::fs;
|
||||
use std::path::{Path, PathBuf};
|
||||
|
||||
const ALLOWED_DEPENDENCIES: [&str; 13] = [
|
||||
const ALLOWED_DEPENDENCIES: [&str; 17] = [
|
||||
"base64",
|
||||
"crossterm",
|
||||
"libremetaverse",
|
||||
"libremetaverse-imaging",
|
||||
"libremetaverse-rendering-simple",
|
||||
"metacrate-lsl-tools",
|
||||
"png",
|
||||
"libremetaverse-types",
|
||||
"reqwest",
|
||||
"rustls",
|
||||
@@ -48,10 +52,10 @@ fn package_has_only_reviewed_rust_dependencies_and_no_build_script() {
|
||||
#[test]
|
||||
fn runtime_source_has_no_subprocess_or_native_abi_escape_hatch() {
|
||||
let source = PathBuf::from(env!("CARGO_MANIFEST_DIR")).join("src");
|
||||
let mut files = Vec::with_capacity(34);
|
||||
let mut files = Vec::with_capacity(36);
|
||||
collect_rust_files(&source, &mut files);
|
||||
assert!(
|
||||
files.len() <= 34,
|
||||
files.len() <= 36,
|
||||
"source-file count needs a reviewed bound update"
|
||||
);
|
||||
for path in files {
|
||||
@@ -82,6 +86,27 @@ fn runtime_source_has_no_subprocess_or_native_abi_escape_hatch() {
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn vision_path_selects_only_the_pure_rust_renderer_and_codec() {
|
||||
let root = PathBuf::from(env!("CARGO_MANIFEST_DIR"));
|
||||
let manifest = fs::read_to_string(root.join("Cargo.toml")).expect("agent manifest");
|
||||
assert!(manifest.contains("default-features = false, features = [\"rust-j2k\"]"));
|
||||
for forbidden in ["imaging-skia", "openjpeg", "skia-safe"] {
|
||||
assert!(!manifest.contains(forbidden), "vision enables {forbidden}");
|
||||
}
|
||||
let renderer = fs::read_to_string(root.join("../libremetaverse-rendering-simple/Cargo.toml"))
|
||||
.expect("simple renderer manifest");
|
||||
assert!(!renderer.contains("imaging-skia"));
|
||||
assert!(!renderer.contains("openjpeg"));
|
||||
let vision = fs::read_to_string(root.join("src/vision.rs")).expect("vision source");
|
||||
for forbidden in ["screenshot crate", "gpu adapter", "std::process"] {
|
||||
assert!(
|
||||
!vision.to_ascii_lowercase().contains(forbidden),
|
||||
"vision must remain synthetic and pure Rust: {forbidden}"
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn compatibility_crates_never_depend_on_or_reexport_metacrate_crates() {
|
||||
let workspace = PathBuf::from(env!("CARGO_MANIFEST_DIR"))
|
||||
|
||||
Reference in New Issue
Block a user