Print failure details and write logs after the streaming path failed.
(
ctx: StreamingContext,
sr,
failed_outputs: dict[str, str],
failed_outputs_lock: threading.Lock,
duration: float,
num_tests_run: int,
)
| 198 | |
| 199 | |
| 200 | def _handle_streaming_failure( |
| 201 | ctx: StreamingContext, |
| 202 | sr, |
| 203 | failed_outputs: dict[str, str], |
| 204 | failed_outputs_lock: threading.Lock, |
| 205 | duration: float, |
| 206 | num_tests_run: int, |
| 207 | ) -> MesonTestResult: |
| 208 | """Print failure details and write logs after the streaming path failed.""" |
| 209 | print_error( |
| 210 | f"[MESON] ❌ Some tests failed ({sr.num_passed}/{num_tests_run} tests in {duration:.2f}s)" |
| 211 | ) |
| 212 | # Snapshot under lock — workers may still be running after shutdown(wait=False). |
| 213 | with failed_outputs_lock: |
| 214 | failed_snapshot = dict(failed_outputs) |
| 215 | |
| 216 | if failed_snapshot: |
| 217 | print_error(f"\n{'=' * 80}") |
| 218 | print_error(f"[MESON] Test failure details ({len(failed_snapshot)} tests):") |
| 219 | print_error(f"{'=' * 80}") |
| 220 | for tname, output in failed_snapshot.items(): |
| 221 | print_error(f"\n--- {tname} ---") |
| 222 | for line in output.splitlines()[-30:]: |
| 223 | print_error(f" {line}") |
| 224 | print_error(f"{'=' * 80}") |
| 225 | |
| 226 | if ctx.log_failures is not None: |
| 227 | if num_tests_run == 0: |
| 228 | per_target = _extract_compile_failures(sr.compile_output) |
| 229 | if per_target: |
| 230 | for tname, output in per_target.items(): |
| 231 | _write_failure_log(ctx.log_failures, tname, "compile", output) |
| 232 | else: |
| 233 | _write_failure_log( |
| 234 | ctx.log_failures, |
| 235 | "compile", |
| 236 | "compile", |
| 237 | sr.compile_output, |
| 238 | ) |
| 239 | else: |
| 240 | for tname, output in failed_snapshot.items(): |
| 241 | _write_failure_log(ctx.log_failures, tname, "run", output) |
| 242 | |
| 243 | return MesonTestResult( |
| 244 | success=False, |
| 245 | duration=duration, |
| 246 | num_tests_run=num_tests_run, |
| 247 | num_tests_passed=sr.num_passed, |
| 248 | num_tests_failed=sr.num_failed, |
| 249 | failed_test_names=sr.failed_names, |
| 250 | ) |
| 251 | |
| 252 | |
| 253 | def run_streaming_path(ctx: StreamingContext) -> MesonTestResult: |
no test coverage detected