mirror of
https://github.com/fish-shell/fish-shell.git
synced 2026-05-30 11:21:15 -03:00
test_driver: reduce default concurrency to reduce flakiness
Unlimited concurrency frequently makes system tests fail when when run as "tests/test_driver.py" or "cargo xtask check". Add a workaround until we fix them. Use $(nproc), which is already the default for RUST_TEST_THREADS and CARGO_BUILD_JOBS, and it works pretty reliably on my laptop. It's possible that we can increase it a bit to make it faster, but until the tests are improved, we can't increase it much without risking failures. Ref: https://github.com/fish-shell/fish-shell/pull/12292#discussion_r2713370474 Tracking issue: #11815
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
#!/usr/bin/env python3
|
||||
import argparse
|
||||
import asyncio
|
||||
import multiprocessing
|
||||
import os
|
||||
import resource
|
||||
import shutil
|
||||
@@ -122,8 +123,10 @@ async def main():
|
||||
argparser.add_argument(
|
||||
"--max-concurrency",
|
||||
type=int,
|
||||
help="Maximum number of tests to run concurrently. The default is to run all tests concurrently.",
|
||||
default=os.environ.get("FISH_TEST_MAX_CONCURRENCY"),
|
||||
help="Maximum number of tests to run concurrently. The default is the number of logical CPUs.",
|
||||
default=os.environ.get(
|
||||
"FISH_TEST_MAX_CONCURRENCY", multiprocessing.cpu_count()
|
||||
),
|
||||
)
|
||||
argparser.add_argument(
|
||||
"fish",
|
||||
@@ -134,7 +137,7 @@ async def main():
|
||||
args = argparser.parse_args()
|
||||
|
||||
max_concurrency = args.max_concurrency
|
||||
if max_concurrency is not None and max_concurrency < 1:
|
||||
if max_concurrency < 1:
|
||||
print("--max-concurrency must be at least 1")
|
||||
sys.exit(1)
|
||||
|
||||
@@ -208,7 +211,7 @@ async def main():
|
||||
tmp_root / "fish_test_helper",
|
||||
)
|
||||
|
||||
semaphore = asyncio.Semaphore(max_concurrency) if max_concurrency else None
|
||||
semaphore = asyncio.Semaphore(max_concurrency)
|
||||
|
||||
async def run(f, arg) -> TestResult:
|
||||
# TODO(python>3.8): use "async with"
|
||||
|
||||
Reference in New Issue
Block a user