()
| 98 | |
| 99 | #[tokio::main] |
| 100 | async fn main() -> Result<()> { |
| 101 | env_logger::init(); |
| 102 | |
| 103 | check_rustc_version(); |
| 104 | |
| 105 | let Command { |
| 106 | workspace_root, |
| 107 | package_cfgs, |
| 108 | output, |
| 109 | package_name, |
| 110 | sub_command, |
| 111 | } = Command::from_args(); |
| 112 | |
| 113 | let workspace_root = workspace_root.trim_end_matches('/'); |
| 114 | let producer = create_streamer(&output) |
| 115 | .await |
| 116 | .context("Fail to create streamer")?; |
| 117 | |
| 118 | let mut files = vec![Default::default()]; |
| 119 | let mut breakpoints = vec![Default::default()]; |
| 120 | let mut id = 1; |
| 121 | |
| 122 | let get_map_file = |src_file: &PathBuf| { |
| 123 | let src_rel_path = &src_file.to_str().expect("path to str")[(workspace_root.len() + 1)..]; |
| 124 | format!("{workspace_root}/firedbg/{src_rel_path}.firedbg.map") |
| 125 | }; |
| 126 | |
| 127 | let mut set_file_breakpoint = |file: File| { |
| 128 | let File { |
| 129 | path, |
| 130 | functions, |
| 131 | crate_name, |
| 132 | modified, |
| 133 | } = file; |
| 134 | let path = if path.starts_with(workspace_root) { |
| 135 | // We want to strip the workspace root and the `/` at the starts |
| 136 | path[(workspace_root.len() + 1)..].to_string() |
| 137 | } else { |
| 138 | path |
| 139 | }; |
| 140 | files.push(SourceFile { |
| 141 | id, |
| 142 | path, |
| 143 | crate_name, |
| 144 | modified, |
| 145 | }); |
| 146 | for func in functions { |
| 147 | breakpoints.push(new_breakpoint(breakpoints.len() as u32, id, &func)); |
| 148 | } |
| 149 | id += 1; |
| 150 | }; |
| 151 | |
| 152 | let get_arguments = |testcase: String| vec!["--exact".into(), testcase]; |
| 153 | |
| 154 | let (binary, src_dirs, arguments) = match sub_command { |
| 155 | SubCommand::Run { |
| 156 | binary_executable, |
| 157 | args, |
nothing calls this directly
no test coverage detected