(args: argparse.Namespace)
| 486 | |
| 487 | |
| 488 | def run_wave(args: argparse.Namespace) -> None: |
| 489 | suites = read_suites(args.suite_file) |
| 490 | args.log_dir.mkdir(parents=True, exist_ok=True) |
| 491 | args.results_file.parent.mkdir(parents=True, exist_ok=True) |
| 492 | args.results_file.touch(exist_ok=True) |
| 493 | pending = list(suites) |
| 494 | active: dict[str, ActiveSuite] = {} |
| 495 | try: |
| 496 | while pending or active: |
| 497 | while pending and len(active) < args.jobs: |
| 498 | suite = pending.pop(0) |
| 499 | timeout = ( |
| 500 | args.slow_timeout if suite in SLOW_SUITES else args.timeout |
| 501 | ) |
| 502 | started = start_suite( |
| 503 | suite, |
| 504 | list(args.runner_command), |
| 505 | args.log_dir, |
| 506 | timeout, |
| 507 | ) |
| 508 | if started is None: |
| 509 | record_start_failure(suite, args.log_dir, args.results_file) |
| 510 | else: |
| 511 | active[suite] = started |
| 512 | |
| 513 | made_progress = False |
| 514 | now = time.monotonic() |
| 515 | for suite, running in list(active.items()): |
| 516 | returncode = running.process.poll() |
| 517 | timed_out = returncode is None and now - running.started >= running.timeout |
| 518 | if returncode is None and not timed_out: |
| 519 | continue |
| 520 | if timed_out: |
| 521 | wait_for_test_pre_terminate_barrier( |
| 522 | args.test_pre_terminate_barrier_dir, |
| 523 | running, |
| 524 | ) |
| 525 | terminate_process_tree(running, args.kill_grace) |
| 526 | returncode = running.process.returncode |
| 527 | wait_for_test_post_exit_barrier( |
| 528 | args.test_post_exit_barrier_dir, |
| 529 | suite, |
| 530 | ) |
| 531 | record_result( |
| 532 | running, |
| 533 | int(returncode if returncode is not None else 124), |
| 534 | args.results_file, |
| 535 | timed_out, |
| 536 | ) |
| 537 | del active[suite] |
| 538 | made_progress = True |
| 539 | if active and not made_progress: |
| 540 | time.sleep(POLL_SECONDS) |
| 541 | finally: |
| 542 | cleanup_errors: list[str] = [] |
| 543 | for running in active.values(): |
| 544 | try: |
| 545 | terminate_process_tree(running, args.kill_grace) |
no test coverage detected