cranelift-filetests: tell when a run test is skipped (fixes #1558);
This commit is contained in:
committed by
Andrew Brown
parent
f84903fa43
commit
4f6a002f70
@@ -75,6 +75,7 @@ pub fn run(path: &Path, passes: Option<&[String]>, target: Option<&str>) -> Test
|
||||
Some(t) => t,
|
||||
};
|
||||
|
||||
let file_path = path.to_string_lossy();
|
||||
for (func, details) in testfile.functions {
|
||||
let mut context = Context {
|
||||
preamble_comments: &testfile.preamble_comments,
|
||||
@@ -82,6 +83,7 @@ pub fn run(path: &Path, passes: Option<&[String]>, target: Option<&str>) -> Test
|
||||
verified: false,
|
||||
flags,
|
||||
isa: None,
|
||||
file_path: file_path.as_ref(),
|
||||
};
|
||||
|
||||
for tuple in &tuples {
|
||||
|
||||
@@ -26,6 +26,9 @@ pub struct Context<'a> {
|
||||
/// Target ISA to test against. Only guaranteed to be present for sub-tests whose `needs_isa`
|
||||
/// method returned `true`. For other sub-tests, this is set if the test file has a unique ISA.
|
||||
pub isa: Option<&'a dyn TargetIsa>,
|
||||
|
||||
/// Full path to the file containing the test.
|
||||
pub file_path: &'a str,
|
||||
}
|
||||
|
||||
impl<'a> Context<'a> {
|
||||
|
||||
@@ -36,6 +36,18 @@ impl SubTest for TestRun {
|
||||
}
|
||||
|
||||
fn run(&self, func: Cow<ir::Function>, context: &Context) -> SubtestResult<()> {
|
||||
// If this test requests to run on a completely different
|
||||
// architecture than the host platform then we skip it entirely,
|
||||
// since we won't be able to natively execute machine code.
|
||||
let requested_arch = context.isa.unwrap().triple().architecture;
|
||||
if requested_arch != Architecture::host() {
|
||||
println!(
|
||||
"skipped {}: host can't run {:?} programs",
|
||||
context.file_path, requested_arch
|
||||
);
|
||||
return Ok(());
|
||||
}
|
||||
|
||||
let mut compiler = SingleFunctionCompiler::with_host_isa(context.flags.clone());
|
||||
for comment in context.details.comments.iter() {
|
||||
if let Some(command) =
|
||||
@@ -43,14 +55,6 @@ impl SubTest for TestRun {
|
||||
{
|
||||
trace!("Parsed run command: {}", command);
|
||||
|
||||
// If this test requests to run on a completely different
|
||||
// architecture than the host platform then we skip it entirely,
|
||||
// since we won't be able to natively execute machine code.
|
||||
let requested_arch = context.isa.unwrap().triple().architecture;
|
||||
if requested_arch != Architecture::host() {
|
||||
return Ok(());
|
||||
}
|
||||
|
||||
// Note that here we're also explicitly ignoring `context.isa`,
|
||||
// regardless of what's requested. We want to use the native
|
||||
// host ISA no matter what here, so the ISA listed in the file
|
||||
|
||||
Reference in New Issue
Block a user