/// Launches Scrutiny and performs the capability route analysis. The
/// results are then filtered based on the provided allowlist and any
/// errors that are not allowlisted cause the verification to fail listing
/// all non-allowlisted errors.
Launches Scrutiny and performs the capability route analysis. The
results are then filtered based on the provided allowlist and any
errors that are not allowlisted cause the verification to fail listing
all non-allowlisted errors.
Launches Scrutiny and performs the capability route analysis . The results are then filtered based on the provided allowlist and any errors that are not allowlisted cause the verification to fail listing all non - allowlisted errors .
fn verify(&self) -> Result<()> {
        let mut config = Config::run_command_with_plugins(
            CommandBuilder::new("verify.capability_routes")
                .param("capability_types", self.capability_types.join(" "))
                .param("response_level", &self.response_level)
                .build(),
            vec!["DevmgrConfigPlugin", "StaticPkgsPlugin", "CorePlugin", "VerifyPlugin"],
        );
        config.runtime.model.build_path = self.build_path.clone().into();
        config.runtime.model.repository_path = self.repository_path.clone().into();
        config.runtime.model.component_tree_config_path = self
            .component_tree_config_path
            .clone()
            .map(|component_tree_config_path| component_tree_config_path.into());
        config.runtime.logging.silent_mode = true;
        let results = launcher::launch_from_config(config).context("Failed to launch scrutiny")?;
        let route_analysis: CapabilityRouteResults = serde_json5::from_str(&results)
            .context(format!("Failed to deserialize verify routes results: {}", results))?;
        let allowlist_filter = load_allowlist(&self.allowlist_paths)
            .context("Failed to parse all allowlist fragments from supported format")?;
        let filtered_analysis = allowlist_filter.filter_analysis(route_analysis.results);
        for entry in filtered_analysis.iter() {
            if !entry.results.errors.is_empty() {
                bail!(
                    "
Static Capability Flow Analysis Error:
The route verifier failed to verify all capability routes in this build.
See https://fuchsia.dev/fuchsia-src/development/components/v2/troubleshooting#static-analyzer
If the broken route is required for a transition it can be temporarily added
to the allowlist located at: {:?}
Verification Errors:
{}",
                    self.allowlist_paths,
                    serde_json::to_string_pretty(&filtered_analysis).unwrap()
                );
            }
        }
        // Write out the depfile.
        if let Some(depfile_path) = self.depfile_path.as_ref() {
            let stamp_path = self
                .stamp_path
                .as_ref()
                .ok_or(anyhow!("Cannot specify depfile without specifying stamp"))?;
            let deps: Vec<String> = route_analysis.deps.into_iter().collect();
            let mut depfile =
                fs::File::create(depfile_path).context("Failed to create dep file")?;
            write!(depfile, "{}: {}", stamp_path, deps.join(" "))
                .context("Failed to write to dep file")?;
            fs::write(stamp_path, "Verified\n").context("Failed to write stamp file")?;
        }
        Ok(())
    }
fn verify ( & self ) -> Result < ( ) > { let mut config = Config :: run_command_with_plugins ( CommandBuilder :: new ( " " ) . param ( " " , self . capability_types . join ( " " ) ) . param ( " " , & self . response_level ) . build ( ) , vec ! [ " " " " " " " " ] , ) ; config . runtime . model . build_path = self . build_path . clone ( ) . into ( ) ; config . runtime . model . repository_path = self . repository_path . clone ( ) . into ( ) ; config . runtime . model . component_tree_config_path = self . component_tree_config_path . clone ( ) . map ( | component_tree_config_path | component_tree_config_path . into ( ) ) ; config . runtime . logging . silent_mode = true ; let results = launcher :: launch_from_config ( config ) . context ( " " ) ? ; let route_analysis : CapabilityRouteResults = serde_json5 :: from_str ( & results ) . context ( format ! ( " " results ) ) ? ; let allowlist_filter = load_allowlist ( & self . allowlist_paths ) . context ( " " ) ? ; let filtered_analysis = allowlist_filter . filter_analysis ( route_analysis . results ) ; for entry in filtered_analysis . iter ( ) { if ! entry . results . errors . is_empty ( ) { bail ! ( " " self allowlist_paths serde_json to_string_pretty ( filtered_analysis ) unwrap ( ) ) ; } } // Write out the depfile. if let Some ( depfile_path ) = self . depfile_path . as_ref ( ) { let stamp_path = self . stamp_path . as_ref ( ) . ok_or ( anyhow ! ( " " ) ) ? ; let deps : Vec < String > = route_analysis . deps . into_iter ( ) . collect ( ) ; let mut depfile = fs :: File :: create ( depfile_path ) . context ( " " ) ? ; write ! ( depfile " " stamp_path deps join ( " " ) ) . context ( " " ) ? ; fs :: write ( stamp_path , " \n " ) . context ( " " ) ? ; } Ok ( ( ) ) }
Launches Scrutiny and performs the capability route analysis.
Launches Scrutiny and performs the capability route analysis .
&self