Add test run to cranelift-filetests to allow executing CLIF (#890)
* Add ability to run CLIF IR using `clif-util run [-v] {file}` and add `test run` to cranelift-filetests to allow executing CLIF
This re-factors the compile/execute parts to a FunctionRunner that is shared between cranelift-filetests and clif-util. CLIF can be now be run using `clif-util run` as well as during `clif-util test` for files with a `test run` header. As before, only functions suffixed with a `run` comment are executed. The `run: fn(...) == ...` expression syntax is left for a subsequent change.
This commit is contained in:
committed by
Benjamin Bouvier
parent
276bb5e26d
commit
ff3c44385c
@@ -33,6 +33,7 @@ mod cat;
|
||||
mod compile;
|
||||
mod disasm;
|
||||
mod print_cfg;
|
||||
mod run;
|
||||
mod utils;
|
||||
|
||||
/// A command either succeeds or fails with an error message.
|
||||
@@ -162,6 +163,13 @@ fn main() {
|
||||
.arg(add_input_file_arg())
|
||||
.arg(add_debug_flag()),
|
||||
)
|
||||
.subcommand(
|
||||
SubCommand::with_name("run")
|
||||
.about("Execute CLIF code and verify with test expressions")
|
||||
.arg(add_verbose_flag())
|
||||
.arg(add_input_file_arg())
|
||||
.arg(add_debug_flag()),
|
||||
)
|
||||
.subcommand(
|
||||
SubCommand::with_name("cat")
|
||||
.about("Outputs .clif file")
|
||||
@@ -224,6 +232,14 @@ fn main() {
|
||||
)
|
||||
.map(|_time| ())
|
||||
}
|
||||
("run", Some(rest_cmd)) => {
|
||||
handle_debug_flag(rest_cmd.is_present("debug"));
|
||||
run::run(
|
||||
get_vec(rest_cmd.values_of("file")),
|
||||
rest_cmd.is_present("verbose"),
|
||||
)
|
||||
.map(|_time| ())
|
||||
}
|
||||
("pass", Some(rest_cmd)) => {
|
||||
handle_debug_flag(rest_cmd.is_present("debug"));
|
||||
|
||||
|
||||
Reference in New Issue
Block a user