MCPcopy Create free account
hub / github.com/bytecodealliance/wasmtime / run

Function run

cranelift/src/interpret.rs:26–60  ·  view source on GitHub ↗

Run files through the Cranelift interpreter, interpreting any functions with annotations.

(options: &Options)

Source from the content-addressed store, hash-verified

24
25/// Run files through the Cranelift interpreter, interpreting any functions with annotations.
26pub fn run(options: &Options) -> anyhow::Result<()> {
27 let mut total = 0;
28 let mut errors = 0;
29 for file in iterate_files(&options.files) {
30 total += 1;
31 let runner = FileInterpreter::from_path(file)?;
32 match runner.run() {
33 Ok(_) => {
34 if options.verbose {
35 println!("{}", runner.path());
36 }
37 }
38 Err(e) => {
39 if options.verbose {
40 println!("{}: {}", runner.path(), e.to_string());
41 }
42 errors += 1;
43 }
44 }
45 }
46
47 if options.verbose {
48 match total {
49 0 => println!("0 files"),
50 1 => println!("1 file"),
51 n => println!("{n} files"),
52 }
53 }
54
55 match errors {
56 0 => Ok(()),
57 1 => anyhow::bail!("1 failure"),
58 n => anyhow::bail!("{n} failures"),
59 }
60}
61
62/// Contains CLIF code that can be executed with [FileInterpreter::run].
63pub struct FileInterpreter {

Callers 1

filetestsFunction · 0.70

Calls 3

iterate_filesFunction · 0.85
OkFunction · 0.85
runMethod · 0.45

Tested by 1

filetestsFunction · 0.56