mirror of
https://github.com/nodejs/node.git
synced 2026-10-14 10:26:26 -04:00
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: https://github.com/nodejs/node/pull/60604 Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com> Reviewed-By: Darshan Sen <raisinten@gmail.com>
This commit is contained in:
1 parent
53ee03868f
commit
d137969789
1 file changed
+16
-2
+16
-2
@@ -1,6 +1,20 @@
|
||||
import sys, os
|
||||
import sys, os, multiprocessing, shutil
|
||||
sys.path.append(os.path.join(os.path.dirname(__file__), '..'))
|
||||
import testpy
|
||||
|
||||
def GetConfiguration(context, root):
|
||||
return testpy.SimpleTestConfiguration(context, root, 'sea')
|
||||
# We don't use arch-specific out folder in Node.js; use none/none to auto
|
||||
# detect release mode from GetVm and get the path to the executable.
|
||||
vm = context.GetVm('none', 'none')
|
||||
if not os.path.isfile(vm):
|
||||
return testpy.SimpleTestConfiguration(context, root, 'sea')
|
||||
|
||||
# Get the size of the executable to decide whether we can run tests in parallel.
|
||||
executable_size = os.path.getsize(vm)
|
||||
num_cpus = multiprocessing.cpu_count()
|
||||
remaining_disk_space = shutil.disk_usage('.').free
|
||||
# Give it a bit of leeway by multiplying by 3.
|
||||
if (executable_size * num_cpus * 3 > remaining_disk_space):
|
||||
return testpy.SimpleTestConfiguration(context, root, 'sea')
|
||||
|
||||
return testpy.ParallelTestConfiguration(context, root, 'sea')
|
||||
Reference in new issue
Block a user