mirror of
https://github.com/zebrajr/node.git
synced 2026-01-15 12:15:26 +00:00
PR-URL: https://github.com/nodejs/node/pull/60807 Reviewed-By: Stefan Stojanovic <stefan.stojanovic@janeasystems.com> Reviewed-By: Chengzhong Wu <legendecas@gmail.com>
29 lines
1.2 KiB
Python
29 lines
1.2 KiB
Python
import sys, os, multiprocessing, shutil
|
|
sys.path.append(os.path.join(os.path.dirname(__file__), '..'))
|
|
import testpy
|
|
|
|
def GetConfiguration(context, root):
|
|
# 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.
|
|
try:
|
|
vm = context.GetVm('none', 'none')
|
|
except ValueError:
|
|
# In debug only builds, we are getting an exception because none/none
|
|
# results in taking the release flavor that is missing in that case. Try to
|
|
# recover by using the first mode passed explicitly to the test.py.
|
|
preferred_mode = getattr(context, 'default_mode', 'none') or 'none'
|
|
vm = context.GetVm('none', preferred_mode)
|
|
|
|
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')
|