(args: argparse.Namespace)
| 428 | |
| 429 | |
| 430 | def run_wave(args: argparse.Namespace) -> None: |
| 431 | suites = read_suites(args.suite_file) |
| 432 | args.log_dir.mkdir(parents=True, exist_ok=True) |
| 433 | args.results_file.parent.mkdir(parents=True, exist_ok=True) |
| 434 | args.results_file.touch(exist_ok=True) |
| 435 | pending = list(suites) |
| 436 | active: dict[str, ActiveSuite] = {} |
| 437 | try: |
| 438 | while pending or active: |
| 439 | while pending and len(active) < args.jobs: |
| 440 | suite = pending.pop(0) |
| 441 | timeout = ( |
| 442 | args.slow_timeout if suite in SLOW_SUITES else args.timeout |
| 443 | ) |
| 444 | started = start_suite( |
| 445 | suite, |
| 446 | list(args.runner_command), |
| 447 | args.log_dir, |
| 448 | timeout, |
| 449 | ) |
| 450 | if started is None: |
| 451 | record_start_failure(suite, args.log_dir, args.results_file) |
| 452 | else: |
| 453 | active[suite] = started |
| 454 | |
| 455 | made_progress = False |
| 456 | now = time.monotonic() |
| 457 | for suite, running in list(active.items()): |
| 458 | returncode = running.process.poll() |
| 459 | timed_out = returncode is None and now - running.started >= running.timeout |
| 460 | if returncode is None and not timed_out: |
| 461 | continue |
| 462 | if timed_out: |
| 463 | wait_for_test_pre_terminate_barrier( |
| 464 | args.test_pre_terminate_barrier_dir, |
| 465 | running, |
| 466 | ) |
| 467 | terminate_process_tree(running, args.kill_grace) |
| 468 | returncode = running.process.returncode |
| 469 | wait_for_test_post_exit_barrier( |
| 470 | args.test_post_exit_barrier_dir, |
| 471 | suite, |
| 472 | ) |
| 473 | record_result( |
| 474 | running, |
| 475 | int(returncode if returncode is not None else 124), |
| 476 | args.results_file, |
| 477 | timed_out, |
| 478 | ) |
| 479 | del active[suite] |
| 480 | made_progress = True |
| 481 | if active and not made_progress: |
| 482 | time.sleep(POLL_SECONDS) |
| 483 | finally: |
| 484 | cleanup_errors: list[str] = [] |
| 485 | for running in active.values(): |
| 486 | try: |
| 487 | terminate_process_tree(running, args.kill_grace) |
no test coverage detected