make sure roots are not deleted

This commit is contained in:
nora 2023-04-04 14:03:55 +02:00
parent 825870651f
commit af95ab5e10

View file

@ -1,6 +1,8 @@
use anyhow::{ensure, Context, Result}; use anyhow::{ensure, Context, Result};
use once_cell::sync::Lazy; use once_cell::sync::Lazy;
use regex::Regex; use regex::Regex;
use std::collections::hash_map::RandomState;
use std::collections::HashSet;
use std::fs::Permissions; use std::fs::Permissions;
use std::io::BufWriter; use std::io::BufWriter;
use std::os::unix::prelude::PermissionsExt; use std::os::unix::prelude::PermissionsExt;
@ -153,6 +155,16 @@ fn build(path: &Path) -> Result<()> {
"Some REQUIRE-DELETED have not been deleted: {required_deleted:?}" "Some REQUIRE-DELETED have not been deleted: {required_deleted:?}"
); );
let end_roots = HashSet::<_, RandomState>::from_iter(
get_roots(&proj_dir).context("getting final MINIMIZE-ROOTs")?,
);
for root in &start_roots {
ensure!(
end_roots.contains(root),
"{root} was not found after minimization"
);
}
Ok(()) Ok(())
} }