Rename subtest's Result to SubtestResult.
This avoids naming confusion with the standard `Result`, which is included in the prelude.
This commit is contained in:
@@ -79,7 +79,7 @@ pub fn run(verbose: bool, files: &[String]) -> TestResult {
|
|||||||
///
|
///
|
||||||
/// This function knows how to create all of the possible `test <foo>` commands that can appear in
|
/// This function knows how to create all of the possible `test <foo>` commands that can appear in
|
||||||
/// a `.cton` test file.
|
/// a `.cton` test file.
|
||||||
fn new_subtest(parsed: &TestCommand) -> subtest::Result<Box<subtest::SubTest>> {
|
fn new_subtest(parsed: &TestCommand) -> subtest::SubtestResult<Box<subtest::SubTest>> {
|
||||||
match parsed.command {
|
match parsed.command {
|
||||||
"binemit" => test_binemit::subtest(parsed),
|
"binemit" => test_binemit::subtest(parsed),
|
||||||
"cat" => test_cat::subtest(parsed),
|
"cat" => test_cat::subtest(parsed),
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ use std::fs;
|
|||||||
use std::io::{self, Read};
|
use std::io::{self, Read};
|
||||||
use std::path::Path;
|
use std::path::Path;
|
||||||
use std::time;
|
use std::time;
|
||||||
use subtest::{Context, Result, SubTest};
|
use subtest::{Context, SubTest, SubtestResult};
|
||||||
use {new_subtest, TestResult};
|
use {new_subtest, TestResult};
|
||||||
|
|
||||||
/// Read an entire file into a string.
|
/// Read an entire file into a string.
|
||||||
@@ -42,7 +42,7 @@ pub fn run(path: &Path) -> TestResult {
|
|||||||
.commands
|
.commands
|
||||||
.iter()
|
.iter()
|
||||||
.map(new_subtest)
|
.map(new_subtest)
|
||||||
.collect::<Result<Vec<_>>>()?;
|
.collect::<SubtestResult<Vec<_>>>()?;
|
||||||
|
|
||||||
// Flags to use for those tests that don't need an ISA.
|
// Flags to use for those tests that don't need an ISA.
|
||||||
// This is the cumulative effect of all the `set` commands in the file.
|
// This is the cumulative effect of all the `set` commands in the file.
|
||||||
@@ -90,7 +90,7 @@ fn test_tuples<'a>(
|
|||||||
tests: &'a [Box<SubTest>],
|
tests: &'a [Box<SubTest>],
|
||||||
isa_spec: &'a IsaSpec,
|
isa_spec: &'a IsaSpec,
|
||||||
no_isa_flags: &'a Flags,
|
no_isa_flags: &'a Flags,
|
||||||
) -> Result<Vec<(&'a SubTest, &'a Flags, Option<&'a TargetIsa>)>> {
|
) -> SubtestResult<Vec<(&'a SubTest, &'a Flags, Option<&'a TargetIsa>)>> {
|
||||||
let mut out = Vec::new();
|
let mut out = Vec::new();
|
||||||
for test in tests {
|
for test in tests {
|
||||||
if test.needs_isa() {
|
if test.needs_isa() {
|
||||||
@@ -119,7 +119,7 @@ fn run_one_test<'a>(
|
|||||||
tuple: (&'a SubTest, &'a Flags, Option<&'a TargetIsa>),
|
tuple: (&'a SubTest, &'a Flags, Option<&'a TargetIsa>),
|
||||||
func: Cow<Function>,
|
func: Cow<Function>,
|
||||||
context: &mut Context<'a>,
|
context: &mut Context<'a>,
|
||||||
) -> Result<()> {
|
) -> SubtestResult<()> {
|
||||||
let (test, flags, isa) = tuple;
|
let (test, flags, isa) = tuple;
|
||||||
let name = format!("{}({})", test.name(), func.name);
|
let name = format!("{}({})", test.name(), func.name);
|
||||||
dbg!("Test: {} {}", name, isa.map_or("-", TargetIsa::name));
|
dbg!("Test: {} {}", name, isa.map_or("-", TargetIsa::name));
|
||||||
|
|||||||
@@ -6,9 +6,8 @@ use cretonne_codegen::settings::{Flags, FlagsOrIsa};
|
|||||||
use cretonne_reader::{Comment, Details};
|
use cretonne_reader::{Comment, Details};
|
||||||
use filecheck::{Checker, CheckerBuilder, NO_VARIABLES};
|
use filecheck::{Checker, CheckerBuilder, NO_VARIABLES};
|
||||||
use std::borrow::Cow;
|
use std::borrow::Cow;
|
||||||
use std::result;
|
|
||||||
|
|
||||||
pub type Result<T> = result::Result<T, String>;
|
pub type SubtestResult<T> = Result<T, String>;
|
||||||
|
|
||||||
/// Context for running a test on a single function.
|
/// Context for running a test on a single function.
|
||||||
pub struct Context<'a> {
|
pub struct Context<'a> {
|
||||||
@@ -64,11 +63,11 @@ pub trait SubTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Run this test on `func`.
|
/// Run this test on `func`.
|
||||||
fn run(&self, func: Cow<Function>, context: &Context) -> Result<()>;
|
fn run(&self, func: Cow<Function>, context: &Context) -> SubtestResult<()>;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Run filecheck on `text`, using directives extracted from `context`.
|
/// Run filecheck on `text`, using directives extracted from `context`.
|
||||||
pub fn run_filecheck(text: &str, context: &Context) -> Result<()> {
|
pub fn run_filecheck(text: &str, context: &Context) -> SubtestResult<()> {
|
||||||
let checker = build_filechecker(context)?;
|
let checker = build_filechecker(context)?;
|
||||||
if checker
|
if checker
|
||||||
.check(text, NO_VARIABLES)
|
.check(text, NO_VARIABLES)
|
||||||
@@ -85,7 +84,7 @@ pub fn run_filecheck(text: &str, context: &Context) -> Result<()> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Build a filechecker using the directives in the file preamble and the function's comments.
|
/// Build a filechecker using the directives in the file preamble and the function's comments.
|
||||||
pub fn build_filechecker(context: &Context) -> Result<Checker> {
|
pub fn build_filechecker(context: &Context) -> SubtestResult<Checker> {
|
||||||
let mut builder = CheckerBuilder::new();
|
let mut builder = CheckerBuilder::new();
|
||||||
// Preamble comments apply to all functions.
|
// Preamble comments apply to all functions.
|
||||||
for comment in context.preamble_comments {
|
for comment in context.preamble_comments {
|
||||||
|
|||||||
@@ -15,11 +15,11 @@ use match_directive::match_directive;
|
|||||||
use std::borrow::Cow;
|
use std::borrow::Cow;
|
||||||
use std::collections::HashMap;
|
use std::collections::HashMap;
|
||||||
use std::fmt::Write;
|
use std::fmt::Write;
|
||||||
use subtest::{Context, Result, SubTest};
|
use subtest::{Context, SubTest, SubtestResult};
|
||||||
|
|
||||||
struct TestBinEmit;
|
struct TestBinEmit;
|
||||||
|
|
||||||
pub fn subtest(parsed: &TestCommand) -> Result<Box<SubTest>> {
|
pub fn subtest(parsed: &TestCommand) -> SubtestResult<Box<SubTest>> {
|
||||||
assert_eq!(parsed.command, "binemit");
|
assert_eq!(parsed.command, "binemit");
|
||||||
if !parsed.options.is_empty() {
|
if !parsed.options.is_empty() {
|
||||||
Err(format!("No options allowed on {}", parsed))
|
Err(format!("No options allowed on {}", parsed))
|
||||||
@@ -108,7 +108,7 @@ impl SubTest for TestBinEmit {
|
|||||||
true
|
true
|
||||||
}
|
}
|
||||||
|
|
||||||
fn run(&self, func: Cow<ir::Function>, context: &Context) -> Result<()> {
|
fn run(&self, func: Cow<ir::Function>, context: &Context) -> SubtestResult<()> {
|
||||||
let isa = context.isa.expect("binemit needs an ISA");
|
let isa = context.isa.expect("binemit needs an ISA");
|
||||||
let encinfo = isa.encoding_info();
|
let encinfo = isa.encoding_info();
|
||||||
// TODO: Run a verifier pass over the code first to detect any bad encodings or missing/bad
|
// TODO: Run a verifier pass over the code first to detect any bad encodings or missing/bad
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
use cretonne_codegen::ir::Function;
|
use cretonne_codegen::ir::Function;
|
||||||
use cretonne_reader::TestCommand;
|
use cretonne_reader::TestCommand;
|
||||||
use std::borrow::Cow;
|
use std::borrow::Cow;
|
||||||
use subtest::{self, Context, Result as STResult, SubTest};
|
use subtest::{self, Context, SubTest, SubtestResult as STResult};
|
||||||
|
|
||||||
/// Object implementing the `test cat` sub-test.
|
/// Object implementing the `test cat` sub-test.
|
||||||
///
|
///
|
||||||
|
|||||||
@@ -7,11 +7,11 @@ use cretonne_codegen::print_errors::pretty_error;
|
|||||||
use cretonne_codegen::{binemit, ir};
|
use cretonne_codegen::{binemit, ir};
|
||||||
use cretonne_reader::TestCommand;
|
use cretonne_reader::TestCommand;
|
||||||
use std::borrow::Cow;
|
use std::borrow::Cow;
|
||||||
use subtest::{run_filecheck, Context, Result, SubTest};
|
use subtest::{run_filecheck, Context, SubTest, SubtestResult};
|
||||||
|
|
||||||
struct TestCompile;
|
struct TestCompile;
|
||||||
|
|
||||||
pub fn subtest(parsed: &TestCommand) -> Result<Box<SubTest>> {
|
pub fn subtest(parsed: &TestCommand) -> SubtestResult<Box<SubTest>> {
|
||||||
assert_eq!(parsed.command, "compile");
|
assert_eq!(parsed.command, "compile");
|
||||||
if !parsed.options.is_empty() {
|
if !parsed.options.is_empty() {
|
||||||
Err(format!("No options allowed on {}", parsed))
|
Err(format!("No options allowed on {}", parsed))
|
||||||
@@ -33,7 +33,7 @@ impl SubTest for TestCompile {
|
|||||||
true
|
true
|
||||||
}
|
}
|
||||||
|
|
||||||
fn run(&self, func: Cow<ir::Function>, context: &Context) -> Result<()> {
|
fn run(&self, func: Cow<ir::Function>, context: &Context) -> SubtestResult<()> {
|
||||||
let isa = context.isa.expect("compile needs an ISA");
|
let isa = context.isa.expect("compile needs an ISA");
|
||||||
let mut comp_ctx = cretonne_codegen::Context::for_function(func.into_owned());
|
let mut comp_ctx = cretonne_codegen::Context::for_function(func.into_owned());
|
||||||
|
|
||||||
|
|||||||
@@ -10,11 +10,11 @@ use cretonne_codegen::ir::Function;
|
|||||||
use cretonne_codegen::print_errors::pretty_error;
|
use cretonne_codegen::print_errors::pretty_error;
|
||||||
use cretonne_reader::TestCommand;
|
use cretonne_reader::TestCommand;
|
||||||
use std::borrow::Cow;
|
use std::borrow::Cow;
|
||||||
use subtest::{run_filecheck, Context, Result, SubTest};
|
use subtest::{run_filecheck, Context, SubTest, SubtestResult};
|
||||||
|
|
||||||
struct TestDCE;
|
struct TestDCE;
|
||||||
|
|
||||||
pub fn subtest(parsed: &TestCommand) -> Result<Box<SubTest>> {
|
pub fn subtest(parsed: &TestCommand) -> SubtestResult<Box<SubTest>> {
|
||||||
assert_eq!(parsed.command, "dce");
|
assert_eq!(parsed.command, "dce");
|
||||||
if !parsed.options.is_empty() {
|
if !parsed.options.is_empty() {
|
||||||
Err(format!("No options allowed on {}", parsed))
|
Err(format!("No options allowed on {}", parsed))
|
||||||
@@ -32,7 +32,7 @@ impl SubTest for TestDCE {
|
|||||||
true
|
true
|
||||||
}
|
}
|
||||||
|
|
||||||
fn run(&self, func: Cow<Function>, context: &Context) -> Result<()> {
|
fn run(&self, func: Cow<Function>, context: &Context) -> SubtestResult<()> {
|
||||||
let mut comp_ctx = cretonne_codegen::Context::for_function(func.into_owned());
|
let mut comp_ctx = cretonne_codegen::Context::for_function(func.into_owned());
|
||||||
|
|
||||||
comp_ctx.flowgraph();
|
comp_ctx.flowgraph();
|
||||||
|
|||||||
@@ -21,12 +21,11 @@ use match_directive::match_directive;
|
|||||||
use std::borrow::{Borrow, Cow};
|
use std::borrow::{Borrow, Cow};
|
||||||
use std::collections::HashMap;
|
use std::collections::HashMap;
|
||||||
use std::fmt::{self, Write};
|
use std::fmt::{self, Write};
|
||||||
use std::result;
|
use subtest::{run_filecheck, Context, SubTest, SubtestResult};
|
||||||
use subtest::{run_filecheck, Context, Result, SubTest};
|
|
||||||
|
|
||||||
struct TestDomtree;
|
struct TestDomtree;
|
||||||
|
|
||||||
pub fn subtest(parsed: &TestCommand) -> Result<Box<SubTest>> {
|
pub fn subtest(parsed: &TestCommand) -> SubtestResult<Box<SubTest>> {
|
||||||
assert_eq!(parsed.command, "domtree");
|
assert_eq!(parsed.command, "domtree");
|
||||||
if !parsed.options.is_empty() {
|
if !parsed.options.is_empty() {
|
||||||
Err(format!("No options allowed on {}", parsed))
|
Err(format!("No options allowed on {}", parsed))
|
||||||
@@ -41,7 +40,7 @@ impl SubTest for TestDomtree {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Extract our own dominator tree from
|
// Extract our own dominator tree from
|
||||||
fn run(&self, func: Cow<Function>, context: &Context) -> Result<()> {
|
fn run(&self, func: Cow<Function>, context: &Context) -> SubtestResult<()> {
|
||||||
let func = func.borrow();
|
let func = func.borrow();
|
||||||
let cfg = ControlFlowGraph::with_function(func);
|
let cfg = ControlFlowGraph::with_function(func);
|
||||||
let domtree = DominatorTree::with_function(func, &cfg);
|
let domtree = DominatorTree::with_function(func, &cfg);
|
||||||
@@ -114,7 +113,7 @@ impl SubTest for TestDomtree {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Generate some output for filecheck testing
|
// Generate some output for filecheck testing
|
||||||
fn filecheck_text(func: &Function, domtree: &DominatorTree) -> result::Result<String, fmt::Error> {
|
fn filecheck_text(func: &Function, domtree: &DominatorTree) -> Result<String, fmt::Error> {
|
||||||
let mut s = String::new();
|
let mut s = String::new();
|
||||||
|
|
||||||
write!(s, "cfg_postorder:")?;
|
write!(s, "cfg_postorder:")?;
|
||||||
|
|||||||
@@ -8,11 +8,11 @@ use cretonne_codegen::ir::Function;
|
|||||||
use cretonne_codegen::print_errors::pretty_error;
|
use cretonne_codegen::print_errors::pretty_error;
|
||||||
use cretonne_reader::TestCommand;
|
use cretonne_reader::TestCommand;
|
||||||
use std::borrow::Cow;
|
use std::borrow::Cow;
|
||||||
use subtest::{run_filecheck, Context, Result, SubTest};
|
use subtest::{run_filecheck, Context, SubTest, SubtestResult};
|
||||||
|
|
||||||
struct TestLegalizer;
|
struct TestLegalizer;
|
||||||
|
|
||||||
pub fn subtest(parsed: &TestCommand) -> Result<Box<SubTest>> {
|
pub fn subtest(parsed: &TestCommand) -> SubtestResult<Box<SubTest>> {
|
||||||
assert_eq!(parsed.command, "legalizer");
|
assert_eq!(parsed.command, "legalizer");
|
||||||
if !parsed.options.is_empty() {
|
if !parsed.options.is_empty() {
|
||||||
Err(format!("No options allowed on {}", parsed))
|
Err(format!("No options allowed on {}", parsed))
|
||||||
@@ -34,7 +34,7 @@ impl SubTest for TestLegalizer {
|
|||||||
true
|
true
|
||||||
}
|
}
|
||||||
|
|
||||||
fn run(&self, func: Cow<Function>, context: &Context) -> Result<()> {
|
fn run(&self, func: Cow<Function>, context: &Context) -> SubtestResult<()> {
|
||||||
let mut comp_ctx = cretonne_codegen::Context::for_function(func.into_owned());
|
let mut comp_ctx = cretonne_codegen::Context::for_function(func.into_owned());
|
||||||
let isa = context.isa.expect("legalizer needs an ISA");
|
let isa = context.isa.expect("legalizer needs an ISA");
|
||||||
|
|
||||||
|
|||||||
@@ -10,11 +10,11 @@ use cretonne_codegen::ir::Function;
|
|||||||
use cretonne_codegen::print_errors::pretty_error;
|
use cretonne_codegen::print_errors::pretty_error;
|
||||||
use cretonne_reader::TestCommand;
|
use cretonne_reader::TestCommand;
|
||||||
use std::borrow::Cow;
|
use std::borrow::Cow;
|
||||||
use subtest::{run_filecheck, Context, Result, SubTest};
|
use subtest::{run_filecheck, Context, SubTest, SubtestResult};
|
||||||
|
|
||||||
struct TestLICM;
|
struct TestLICM;
|
||||||
|
|
||||||
pub fn subtest(parsed: &TestCommand) -> Result<Box<SubTest>> {
|
pub fn subtest(parsed: &TestCommand) -> SubtestResult<Box<SubTest>> {
|
||||||
assert_eq!(parsed.command, "licm");
|
assert_eq!(parsed.command, "licm");
|
||||||
if !parsed.options.is_empty() {
|
if !parsed.options.is_empty() {
|
||||||
Err(format!("No options allowed on {}", parsed))
|
Err(format!("No options allowed on {}", parsed))
|
||||||
@@ -32,7 +32,7 @@ impl SubTest for TestLICM {
|
|||||||
true
|
true
|
||||||
}
|
}
|
||||||
|
|
||||||
fn run(&self, func: Cow<Function>, context: &Context) -> Result<()> {
|
fn run(&self, func: Cow<Function>, context: &Context) -> SubtestResult<()> {
|
||||||
let mut comp_ctx = cretonne_codegen::Context::for_function(func.into_owned());
|
let mut comp_ctx = cretonne_codegen::Context::for_function(func.into_owned());
|
||||||
|
|
||||||
comp_ctx.flowgraph();
|
comp_ctx.flowgraph();
|
||||||
|
|||||||
@@ -7,11 +7,11 @@ use cretonne_codegen::ir::Function;
|
|||||||
use cretonne_codegen::print_errors::pretty_error;
|
use cretonne_codegen::print_errors::pretty_error;
|
||||||
use cretonne_reader::TestCommand;
|
use cretonne_reader::TestCommand;
|
||||||
use std::borrow::Cow;
|
use std::borrow::Cow;
|
||||||
use subtest::{run_filecheck, Context, Result, SubTest};
|
use subtest::{run_filecheck, Context, SubTest, SubtestResult};
|
||||||
|
|
||||||
struct TestPostopt;
|
struct TestPostopt;
|
||||||
|
|
||||||
pub fn subtest(parsed: &TestCommand) -> Result<Box<SubTest>> {
|
pub fn subtest(parsed: &TestCommand) -> SubtestResult<Box<SubTest>> {
|
||||||
assert_eq!(parsed.command, "postopt");
|
assert_eq!(parsed.command, "postopt");
|
||||||
if !parsed.options.is_empty() {
|
if !parsed.options.is_empty() {
|
||||||
Err(format!("No options allowed on {}", parsed))
|
Err(format!("No options allowed on {}", parsed))
|
||||||
@@ -29,7 +29,7 @@ impl SubTest for TestPostopt {
|
|||||||
true
|
true
|
||||||
}
|
}
|
||||||
|
|
||||||
fn run(&self, func: Cow<Function>, context: &Context) -> Result<()> {
|
fn run(&self, func: Cow<Function>, context: &Context) -> SubtestResult<()> {
|
||||||
let mut comp_ctx = cretonne_codegen::Context::for_function(func.into_owned());
|
let mut comp_ctx = cretonne_codegen::Context::for_function(func.into_owned());
|
||||||
let isa = context.isa.expect("postopt needs an ISA");
|
let isa = context.isa.expect("postopt needs an ISA");
|
||||||
|
|
||||||
|
|||||||
@@ -7,11 +7,11 @@ use cretonne_codegen::ir::Function;
|
|||||||
use cretonne_codegen::print_errors::pretty_error;
|
use cretonne_codegen::print_errors::pretty_error;
|
||||||
use cretonne_reader::TestCommand;
|
use cretonne_reader::TestCommand;
|
||||||
use std::borrow::Cow;
|
use std::borrow::Cow;
|
||||||
use subtest::{run_filecheck, Context, Result, SubTest};
|
use subtest::{run_filecheck, Context, SubTest, SubtestResult};
|
||||||
|
|
||||||
struct TestPreopt;
|
struct TestPreopt;
|
||||||
|
|
||||||
pub fn subtest(parsed: &TestCommand) -> Result<Box<SubTest>> {
|
pub fn subtest(parsed: &TestCommand) -> SubtestResult<Box<SubTest>> {
|
||||||
assert_eq!(parsed.command, "preopt");
|
assert_eq!(parsed.command, "preopt");
|
||||||
if !parsed.options.is_empty() {
|
if !parsed.options.is_empty() {
|
||||||
Err(format!("No options allowed on {}", parsed))
|
Err(format!("No options allowed on {}", parsed))
|
||||||
@@ -29,7 +29,7 @@ impl SubTest for TestPreopt {
|
|||||||
true
|
true
|
||||||
}
|
}
|
||||||
|
|
||||||
fn run(&self, func: Cow<Function>, context: &Context) -> Result<()> {
|
fn run(&self, func: Cow<Function>, context: &Context) -> SubtestResult<()> {
|
||||||
let mut comp_ctx = cretonne_codegen::Context::for_function(func.into_owned());
|
let mut comp_ctx = cretonne_codegen::Context::for_function(func.into_owned());
|
||||||
let isa = context.isa.expect("preopt needs an ISA");
|
let isa = context.isa.expect("preopt needs an ISA");
|
||||||
|
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ use std::borrow::Cow;
|
|||||||
use cretonne_codegen::cfg_printer::CFGPrinter;
|
use cretonne_codegen::cfg_printer::CFGPrinter;
|
||||||
use cretonne_codegen::ir::Function;
|
use cretonne_codegen::ir::Function;
|
||||||
use cretonne_reader::TestCommand;
|
use cretonne_reader::TestCommand;
|
||||||
use subtest::{self, Context, Result as STResult, SubTest};
|
use subtest::{self, Context, SubTest, SubtestResult as STResult};
|
||||||
|
|
||||||
/// Object implementing the `test print-cfg` sub-test.
|
/// Object implementing the `test print-cfg` sub-test.
|
||||||
struct TestPrintCfg;
|
struct TestPrintCfg;
|
||||||
|
|||||||
@@ -10,11 +10,11 @@ use cretonne_codegen::ir::Function;
|
|||||||
use cretonne_codegen::print_errors::pretty_error;
|
use cretonne_codegen::print_errors::pretty_error;
|
||||||
use cretonne_reader::TestCommand;
|
use cretonne_reader::TestCommand;
|
||||||
use std::borrow::Cow;
|
use std::borrow::Cow;
|
||||||
use subtest::{run_filecheck, Context, Result, SubTest};
|
use subtest::{run_filecheck, Context, SubTest, SubtestResult};
|
||||||
|
|
||||||
struct TestRegalloc;
|
struct TestRegalloc;
|
||||||
|
|
||||||
pub fn subtest(parsed: &TestCommand) -> Result<Box<SubTest>> {
|
pub fn subtest(parsed: &TestCommand) -> SubtestResult<Box<SubTest>> {
|
||||||
assert_eq!(parsed.command, "regalloc");
|
assert_eq!(parsed.command, "regalloc");
|
||||||
if !parsed.options.is_empty() {
|
if !parsed.options.is_empty() {
|
||||||
Err(format!("No options allowed on {}", parsed))
|
Err(format!("No options allowed on {}", parsed))
|
||||||
@@ -36,7 +36,7 @@ impl SubTest for TestRegalloc {
|
|||||||
true
|
true
|
||||||
}
|
}
|
||||||
|
|
||||||
fn run(&self, func: Cow<Function>, context: &Context) -> Result<()> {
|
fn run(&self, func: Cow<Function>, context: &Context) -> SubtestResult<()> {
|
||||||
let isa = context.isa.expect("register allocator needs an ISA");
|
let isa = context.isa.expect("register allocator needs an ISA");
|
||||||
let mut comp_ctx = cretonne_codegen::Context::for_function(func.into_owned());
|
let mut comp_ctx = cretonne_codegen::Context::for_function(func.into_owned());
|
||||||
|
|
||||||
|
|||||||
@@ -10,11 +10,11 @@ use cretonne_codegen::ir::Function;
|
|||||||
use cretonne_codegen::print_errors::pretty_error;
|
use cretonne_codegen::print_errors::pretty_error;
|
||||||
use cretonne_reader::TestCommand;
|
use cretonne_reader::TestCommand;
|
||||||
use std::borrow::Cow;
|
use std::borrow::Cow;
|
||||||
use subtest::{run_filecheck, Context, Result, SubTest};
|
use subtest::{run_filecheck, Context, SubTest, SubtestResult};
|
||||||
|
|
||||||
struct TestSimpleGVN;
|
struct TestSimpleGVN;
|
||||||
|
|
||||||
pub fn subtest(parsed: &TestCommand) -> Result<Box<SubTest>> {
|
pub fn subtest(parsed: &TestCommand) -> SubtestResult<Box<SubTest>> {
|
||||||
assert_eq!(parsed.command, "simple-gvn");
|
assert_eq!(parsed.command, "simple-gvn");
|
||||||
if !parsed.options.is_empty() {
|
if !parsed.options.is_empty() {
|
||||||
Err(format!("No options allowed on {}", parsed))
|
Err(format!("No options allowed on {}", parsed))
|
||||||
@@ -32,7 +32,7 @@ impl SubTest for TestSimpleGVN {
|
|||||||
true
|
true
|
||||||
}
|
}
|
||||||
|
|
||||||
fn run(&self, func: Cow<Function>, context: &Context) -> Result<()> {
|
fn run(&self, func: Cow<Function>, context: &Context) -> SubtestResult<()> {
|
||||||
let mut comp_ctx = cretonne_codegen::Context::for_function(func.into_owned());
|
let mut comp_ctx = cretonne_codegen::Context::for_function(func.into_owned());
|
||||||
|
|
||||||
comp_ctx.flowgraph();
|
comp_ctx.flowgraph();
|
||||||
|
|||||||
@@ -14,11 +14,11 @@ use cretonne_codegen::verify_function;
|
|||||||
use cretonne_reader::TestCommand;
|
use cretonne_reader::TestCommand;
|
||||||
use match_directive::match_directive;
|
use match_directive::match_directive;
|
||||||
use std::borrow::{Borrow, Cow};
|
use std::borrow::{Borrow, Cow};
|
||||||
use subtest::{Context, Result, SubTest};
|
use subtest::{Context, SubTest, SubtestResult};
|
||||||
|
|
||||||
struct TestVerifier;
|
struct TestVerifier;
|
||||||
|
|
||||||
pub fn subtest(parsed: &TestCommand) -> Result<Box<SubTest>> {
|
pub fn subtest(parsed: &TestCommand) -> SubtestResult<Box<SubTest>> {
|
||||||
assert_eq!(parsed.command, "verifier");
|
assert_eq!(parsed.command, "verifier");
|
||||||
if !parsed.options.is_empty() {
|
if !parsed.options.is_empty() {
|
||||||
Err(format!("No options allowed on {}", parsed))
|
Err(format!("No options allowed on {}", parsed))
|
||||||
@@ -37,7 +37,7 @@ impl SubTest for TestVerifier {
|
|||||||
false
|
false
|
||||||
}
|
}
|
||||||
|
|
||||||
fn run(&self, func: Cow<Function>, context: &Context) -> Result<()> {
|
fn run(&self, func: Cow<Function>, context: &Context) -> SubtestResult<()> {
|
||||||
let func = func.borrow();
|
let func = func.borrow();
|
||||||
|
|
||||||
// Scan source annotations for "error:" directives.
|
// Scan source annotations for "error:" directives.
|
||||||
|
|||||||
Reference in New Issue
Block a user