(options: &Options)
| 37 | } |
| 38 | |
| 39 | pub fn run(options: &Options) -> Result<()> { |
| 40 | let parsed = parse_sets_and_triple(&options.settings, &options.target)?; |
| 41 | let fisa = parsed.as_fisa(); |
| 42 | |
| 43 | let buffer = read_to_string(&options.file)?; |
| 44 | let test_file = parse_test(&buffer, ParseOptions::default()) |
| 45 | .with_context(|| format!("failed to parse {}", options.file.display()))?; |
| 46 | |
| 47 | // If we have an isa from the command-line, use that. Otherwise if the |
| 48 | // file contains a unique isa, use that. |
| 49 | let isa = if let Some(isa) = fisa.isa { |
| 50 | isa |
| 51 | } else if let Some(isa) = test_file.isa_spec.unique_isa() { |
| 52 | isa |
| 53 | } else { |
| 54 | anyhow::bail!("compilation requires a target isa"); |
| 55 | }; |
| 56 | |
| 57 | unsafe { |
| 58 | std::env::set_var("RUST_BACKTRACE", "0"); // Disable backtraces to reduce verbosity |
| 59 | } |
| 60 | |
| 61 | for (func, _) in test_file.functions { |
| 62 | let (orig_block_count, orig_inst_count) = (block_count(&func), inst_count(&func)); |
| 63 | |
| 64 | match reduce(isa, func, options.verbose) { |
| 65 | Ok((func, crash_msg)) => { |
| 66 | println!("Crash message: {crash_msg}"); |
| 67 | println!("\n{func}"); |
| 68 | println!( |
| 69 | "{} blocks {} insts -> {} blocks {} insts", |
| 70 | orig_block_count, |
| 71 | orig_inst_count, |
| 72 | block_count(&func), |
| 73 | inst_count(&func) |
| 74 | ); |
| 75 | } |
| 76 | Err(err) => println!("Warning: {err}"), |
| 77 | } |
| 78 | } |
| 79 | |
| 80 | Ok(()) |
| 81 | } |
| 82 | |
| 83 | enum ProgressStatus { |
| 84 | /// The mutation raised or reduced the amount of instructions or blocks. |
nothing calls this directly
no test coverage detected