Skip to content

Commit

Permalink
Review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
alexcrichton committed Jan 6, 2025
1 parent a9f8d3c commit c512743
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions cranelift/filetests/src/test_run.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,12 +50,12 @@ fn build_host_isa(
/// Checks if the host's ISA is compatible with the one requested by the test.
fn is_isa_compatible(
file_path: &str,
host: &anyhow::Result<OwnedTargetIsa>,
host: Option<&dyn TargetIsa>,
requested: &dyn TargetIsa,
) -> Result<(), String> {
let host_triple = match host {
Ok(host) => host.triple().clone(),
Err(_) => target_lexicon::Triple::host(),
Some(host) => host.triple().clone(),
None => target_lexicon::Triple::host(),
};
// If this test requests to run on a completely different
// architecture than the host platform then we skip it entirely,
Expand Down Expand Up @@ -101,8 +101,12 @@ fn is_isa_compatible(
None => unimplemented!("ISA flag {} of kind {:?}", req_value.name, req_value.kind()),
};
let host_isa_flags = match host {
Ok(host) => host.isa_flags(),
Err(e) => return Err(format!("{e:?}")),
Some(host) => host.isa_flags(),
None => {
return Err(format!(
"host not available on this platform for isa-specific flag"
))
}
};
let available_in_host = host_isa_flags
.iter()
Expand Down Expand Up @@ -229,8 +233,8 @@ impl SubTest for TestRun {
}

// Check that the host machine can run this test case (i.e. has all extensions)
let host_isa = build_host_isa(true, flags.clone(), vec![]);
if let Err(e) = is_isa_compatible(file_path, &host_isa, isa.unwrap()) {
let host_isa = build_host_isa(true, flags.clone(), vec![]).ok();
if let Err(e) = is_isa_compatible(file_path, host_isa.as_deref(), isa.unwrap()) {
log::info!("{}", e);
return Ok(());
}
Expand Down

0 comments on commit c512743

Please sign in to comment.