Skip to content

Commit c9e4f40

Browse files
committed
Add a test
1 parent 1935344 commit c9e4f40

File tree

2 files changed

+32
-0
lines changed

2 files changed

+32
-0
lines changed

llvm/utils/lit/lit/run.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,9 +82,14 @@ def _execute(self, deadline):
8282

8383
# Windows has a limit of 60 workers per pool, so we need to use multiple pools
8484
# if we have more workers requested than the limit.
85+
# Also, allow to override the limit with the LIT_WINDOWS_MAX_WORKERS_PER_POOL environment variable.
8586
max_workers_per_pool = (
8687
WINDOWS_MAX_WORKERS_PER_POOL if os.name == "nt" else self.workers
8788
)
89+
max_workers_per_pool = int(
90+
os.getenv("LIT_WINDOWS_MAX_WORKERS_PER_POOL", max_workers_per_pool)
91+
)
92+
8893
num_pools = max(1, _ceilDiv(self.workers, max_workers_per_pool))
8994

9095
# Distribute self.workers across num_pools as evenly as possible
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# Create a directory with 20 files and check the number of pools and workers per pool that lit will use.
2+
3+
# RUN: rm -Rf %t.dir && mkdir -p %t.dir
4+
# RUN: python -c "for i in range(20): open(f'%t.dir/file{i}.txt', 'w').write('RUN:')"
5+
6+
# RUN: echo "import lit.formats" > %t.dir/lit.cfg
7+
# RUN: echo "config.name = \"top-level-suite\"" >> %t.dir/lit.cfg
8+
# RUN: echo "config.suffixes = [\".txt\"]" >> %t.dir/lit.cfg
9+
# RUN: echo "config.test_format = lit.formats.ShTest()" >> %t.dir/lit.cfg
10+
11+
12+
# 15 workers per pool max, 100 workers total max: we expect lit to cap the workers to the number of files
13+
# RUN: env "LIT_WINDOWS_MAX_WORKERS_PER_POOL=15" %{lit} -s %t.dir/ -j100 > %t.out 2>&1
14+
# CHECK: Using 2 pools balancing 20 workers total distributed as [10, 10]
15+
# CHECK: Passed: 20
16+
17+
# 5 workers per pool max, 17 workers total max
18+
# RUN: env "LIT_WINDOWS_MAX_WORKERS_PER_POOL=5" %{lit} -s %t.dir/ -j17 >> %t.out 2>&1
19+
# CHECK: Using 4 pools balancing 17 workers total distributed as [5, 4, 4, 4]
20+
# CHECK: Passed: 20
21+
22+
# 19 workers per pool max, 19 workers total max
23+
# RUN: env "LIT_WINDOWS_MAX_WORKERS_PER_POOL=19" %{lit} -s %t.dir/ -j19 >> %t.out 2>&1
24+
# CHECK-NOT: workers total distributed as
25+
# CHECK: Passed: 20
26+
27+
# RUN: cat %t.out | FileCheck %s

0 commit comments

Comments
 (0)