Build examples with one batched ``fbuild`` invocation.
(
self,
examples: list[str],
command_label: str,
run_batch: Any,
)
| 545 | ) |
| 546 | |
| 547 | def _build_fbuild_batch( |
| 548 | self, |
| 549 | examples: list[str], |
| 550 | command_label: str, |
| 551 | run_batch: Any, |
| 552 | ) -> list[Future[SketchResult]]: |
| 553 | """Build examples with one batched ``fbuild`` invocation.""" |
| 554 | |
| 555 | futures: list[Future[SketchResult]] = [] |
| 556 | |
| 557 | try: |
| 558 | staged_projects = self._stage_fbuild_compile_many_projects(examples) |
| 559 | except KeyboardInterrupt as ki: |
| 560 | handle_keyboard_interrupt(ki) |
| 561 | raise |
| 562 | except Exception as e: |
| 563 | for example in examples: |
| 564 | future: Future[SketchResult] = Future() |
| 565 | future.set_result( |
| 566 | SketchResult( |
| 567 | success=False, |
| 568 | output=f"Failed to stage fbuild {command_label} project: {e}", |
| 569 | build_dir=self.build_dir, |
| 570 | example=example, |
| 571 | ) |
| 572 | ) |
| 573 | futures.append(future) |
| 574 | print(f"Releasing platform lock: {self.platform_lock.lock_file_path}\n") |
| 575 | self.platform_lock.release() |
| 576 | return futures |
| 577 | |
| 578 | import time |
| 579 | |
| 580 | from ci.util.fbuild_runner import _parse_size_info_from_log |
| 581 | |
| 582 | batch_start = time.monotonic() |
| 583 | try: |
| 584 | compile_many_result = run_batch( |
| 585 | board=self.board.board_name, |
| 586 | sketch_project_dirs=[project_dir for _, project_dir in staged_projects], |
| 587 | verbose=self.verbose, |
| 588 | timeout=1800, |
| 589 | quiet=False, |
| 590 | log_file=None, |
| 591 | ) |
| 592 | reported = { |
| 593 | sketch_result.sketch_dir.resolve(): sketch_result |
| 594 | for sketch_result in compile_many_result.sketch_results |
| 595 | } |
| 596 | |
| 597 | success_count = 0 |
| 598 | fail_count = 0 |
| 599 | per_sketch_secs: list[float] = [] |
| 600 | for example, project_dir in staged_projects: |
| 601 | sketch_result = reported.get(project_dir.resolve()) |
| 602 | if sketch_result is None: |
| 603 | output = ( |
| 604 | f"fbuild {command_label} did not report a result for " |
no test coverage detected