Add options for parsing test files (#942)
* Add options for parsing test files This change allows adding parsing parameters more easily; e.g. a parameter is needed for setting the default calling convention for functions parsed as a part of the `run` test feature. * Set default calling convention that of the host for `test run` file tests Previously `test run` used the parser's hard-coded CallConv::Fast as the default calling convention but with this change any test being `run` will use the default calling convention of the machine running the test. `test run` will now throw an error if the calling convention of the function does not match the host's.
This commit is contained in:
committed by
Till Schneidereit
parent
e4702d695e
commit
6fdc69ff2e
@@ -8,8 +8,8 @@ use cranelift_codegen::print_errors::pretty_verifier_error;
|
||||
use cranelift_codegen::settings::Flags;
|
||||
use cranelift_codegen::timing;
|
||||
use cranelift_codegen::verify_function;
|
||||
use cranelift_reader::parse_test;
|
||||
use cranelift_reader::IsaSpec;
|
||||
use cranelift_reader::{parse_test, ParseOptions};
|
||||
use log::info;
|
||||
use std::borrow::Cow;
|
||||
use std::fs;
|
||||
@@ -33,8 +33,13 @@ pub fn run(path: &Path, passes: Option<&[String]>, target: Option<&str>) -> Test
|
||||
info!("---\nFile: {}", path.to_string_lossy());
|
||||
let started = time::Instant::now();
|
||||
let buffer = read_to_string(path).map_err(|e| e.to_string())?;
|
||||
let options = ParseOptions {
|
||||
target,
|
||||
passes,
|
||||
..ParseOptions::default()
|
||||
};
|
||||
|
||||
let testfile = match parse_test(&buffer, passes, target) {
|
||||
let testfile = match parse_test(&buffer, options) {
|
||||
Ok(testfile) => testfile,
|
||||
Err(e) => {
|
||||
if e.is_warning {
|
||||
|
||||
Reference in New Issue
Block a user