(args: argparse.Namespace)
| 357 | |
| 358 | |
| 359 | def run_wave(args: argparse.Namespace) -> None: |
| 360 | suites = read_suites(args.suite_file) |
| 361 | args.log_dir.mkdir(parents=True, exist_ok=True) |
| 362 | args.results_file.parent.mkdir(parents=True, exist_ok=True) |
| 363 | args.results_file.touch(exist_ok=True) |
| 364 | pending = list(suites) |
| 365 | active: dict[str, ActiveSuite] = {} |
| 366 | try: |
| 367 | while pending or active: |
| 368 | while pending and len(active) < args.jobs: |
| 369 | suite = pending.pop(0) |
| 370 | timeout = ( |
| 371 | args.slow_timeout if suite in SLOW_SUITES else args.timeout |
| 372 | ) |
| 373 | started = start_suite( |
| 374 | suite, |
| 375 | list(args.runner_command), |
| 376 | args.log_dir, |
| 377 | timeout, |
| 378 | ) |
| 379 | if started is None: |
| 380 | record_start_failure(suite, args.log_dir, args.results_file) |
| 381 | else: |
| 382 | active[suite] = started |
| 383 | |
| 384 | made_progress = False |
| 385 | now = time.monotonic() |
| 386 | for suite, running in list(active.items()): |
| 387 | returncode = running.process.poll() |
| 388 | timed_out = returncode is None and now - running.started >= running.timeout |
| 389 | if returncode is None and not timed_out: |
| 390 | continue |
| 391 | if timed_out: |
| 392 | wait_for_test_pre_terminate_barrier( |
| 393 | args.test_pre_terminate_barrier_dir, |
| 394 | running, |
| 395 | ) |
| 396 | terminate_process_tree(running, args.kill_grace) |
| 397 | returncode = running.process.returncode |
| 398 | wait_for_test_post_exit_barrier( |
| 399 | args.test_post_exit_barrier_dir, |
| 400 | suite, |
| 401 | ) |
| 402 | record_result( |
| 403 | running, |
| 404 | int(returncode if returncode is not None else 124), |
| 405 | args.results_file, |
| 406 | timed_out, |
| 407 | ) |
| 408 | del active[suite] |
| 409 | made_progress = True |
| 410 | if active and not made_progress: |
| 411 | time.sleep(POLL_SECONDS) |
| 412 | finally: |
| 413 | cleanup_errors: list[str] = [] |
| 414 | for running in active.values(): |
| 415 | try: |
| 416 | terminate_process_tree(running, args.kill_grace) |
no test coverage detected