Execute processes in parallel (based on test_runner._run_processes_parallel).
(self)
| 200 | raise ValueError(f"Unknown execution mode: {self.config.execution_mode}") |
| 201 | |
| 202 | def _run_parallel(self) -> list[ProcessTiming]: |
| 203 | """Execute processes in parallel (based on test_runner._run_processes_parallel).""" |
| 204 | if not self.processes: |
| 205 | return [] |
| 206 | |
| 207 | # Create a shared output handler for formatting |
| 208 | ProcessOutputHandler(verbose=self.config.verbose) |
| 209 | |
| 210 | # Configure Windows console for UTF-8 output if needed |
| 211 | if os.name == "nt": # Windows |
| 212 | if hasattr(sys.stdout, "reconfigure"): |
| 213 | sys.stdout.reconfigure(encoding="utf-8", errors="replace") # type: ignore |
| 214 | if hasattr(sys.stderr, "reconfigure"): |
| 215 | sys.stderr.reconfigure(encoding="utf-8", errors="replace") # type: ignore |
| 216 | |
| 217 | # Track start times and enable status monitoring |
| 218 | self._status_monitoring_active = True |
| 219 | for proc in self.processes: |
| 220 | self._track_process_start(proc) |
| 221 | |
| 222 | # Start processes that aren't already running |
| 223 | for proc in self.processes: |
| 224 | cmd_str = proc.get_command_str() |
| 225 | if proc.proc is None: # Only start if not already running |
| 226 | proc.start() |
| 227 | # Create user-friendly display message |
| 228 | display_msg = cmd_str |
| 229 | if "meson_example_runner" in cmd_str: |
| 230 | # Extract example names from command (after the .py script) |
| 231 | parts = cmd_str.split() |
| 232 | examples: list[str] = [] |
| 233 | found_script = False |
| 234 | for p in parts: |
| 235 | if "meson_example_runner" in p: |
| 236 | found_script = True |
| 237 | continue |
| 238 | if not found_script: |
| 239 | continue |
| 240 | # Skip flags |
| 241 | if p.startswith("-"): |
| 242 | continue |
| 243 | examples.append(p) |
| 244 | if examples: |
| 245 | display_msg = f"Compiling: {', '.join(examples)}" |
| 246 | else: |
| 247 | display_msg = "Compiling examples" |
| 248 | elif "ci/util/" in cmd_str: |
| 249 | display_msg = cmd_str.split("ci/util/")[-1] |
| 250 | elif "ci\\" in cmd_str or "ci/" in cmd_str: |
| 251 | # Extract just the script name |
| 252 | parts = cmd_str.replace("\\", "/").split("/") |
| 253 | for i, part in enumerate(parts): |
| 254 | if part in ("ci", "util") and i + 1 < len(parts): |
| 255 | display_msg = "/".join(parts[i:]) |
| 256 | break |
| 257 | print(f"{display_msg}", flush=True) |
| 258 | else: |
| 259 | print(f" Already running: {cmd_str}", flush=True) |
no test coverage detected