Skip to content

Commit c4eb9c3

Browse files
joyeecheungaduh95
authored andcommitted
test: parallelize sea tests when there's enough disk space
The sea tests are only run sequentially to avoid taking too much disk space. When there is enough disk space, however, it's better to run them in parallel, as these tests tend to be slow. PR-URL: #60604 Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com> Reviewed-By: Darshan Sen <raisinten@gmail.com>
1 parent d5158a0 commit c4eb9c3

File tree

1 file changed

+16
-2
lines changed

1 file changed

+16
-2
lines changed

test/sea/testcfg.py

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,20 @@
1-
import sys, os
1+
import sys, os, multiprocessing, shutil
22
sys.path.append(os.path.join(os.path.dirname(__file__), '..'))
33
import testpy
44

55
def GetConfiguration(context, root):
6-
return testpy.SimpleTestConfiguration(context, root, 'sea')
6+
# We don't use arch-specific out folder in Node.js; use none/none to auto
7+
# detect release mode from GetVm and get the path to the executable.
8+
vm = context.GetVm('none', 'none')
9+
if not os.path.isfile(vm):
10+
return testpy.SimpleTestConfiguration(context, root, 'sea')
11+
12+
# Get the size of the executable to decide whether we can run tests in parallel.
13+
executable_size = os.path.getsize(vm)
14+
num_cpus = multiprocessing.cpu_count()
15+
remaining_disk_space = shutil.disk_usage('.').free
16+
# Give it a bit of leeway by multiplying by 3.
17+
if (executable_size * num_cpus * 3 > remaining_disk_space):
18+
return testpy.SimpleTestConfiguration(context, root, 'sea')
19+
20+
return testpy.ParallelTestConfiguration(context, root, 'sea')

0 commit comments

Comments
 (0)