Installs the mode's tools before any of its runs, which would otherwise race each other (and the package manager lock) on a fresh machine.
(mode: &'static str)
| 125 | /// Installs the mode's tools before any of its runs, which would otherwise race |
| 126 | /// each other (and the package manager lock) on a fresh machine. |
| 127 | fn setup(mode: &'static str) { |
| 128 | static DONE: Mutex<Vec<&str>> = Mutex::new(Vec::new()); |
| 129 | let mut done = DONE.lock().unwrap_or_else(PoisonError::into_inner); |
| 130 | if !done.contains(&mode) { |
| 131 | codspeed() |
| 132 | .args(["setup", "--mode", mode]) |
| 133 | .assert() |
| 134 | .success(); |
| 135 | done.push(mode); |
| 136 | } |
| 137 | } |
| 138 | |
| 139 | fn codspeed() -> Command { |
| 140 | let mut cmd = Command::new(env!("CARGO_BIN_EXE_codspeed")); |