MCPcopy Index your code
hub / github.com/nodejs/node / GetConfiguration

Function GetConfiguration

test/sea/testcfg.py:5–28  ·  view source on GitHub ↗
(context, root)

Source from the content-addressed store, hash-verified

3import testpy
4
5def GetConfiguration(context, root):
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 try:
9 vm = context.GetVm('none', 'none')
10 except ValueError:
11 # In debug only builds, we are getting an exception because none/none
12 # results in taking the release flavor that is missing in that case. Try to
13 # recover by using the first mode passed explicitly to the test.py.
14 preferred_mode = getattr(context, 'default_mode', 'none') or 'none'
15 vm = context.GetVm('none', preferred_mode)
16
17 if not os.path.isfile(vm):
18 return testpy.SimpleTestConfiguration(context, root, 'sea')
19
20 # Get the size of the executable to decide whether we can run tests in parallel.
21 executable_size = os.path.getsize(vm)
22 num_cpus = multiprocessing.cpu_count()
23 remaining_disk_space = shutil.disk_usage('.').free
24 # Give it a bit of leeway by multiplying by 3.
25 if (executable_size * num_cpus * 3 > remaining_disk_space):
26 return testpy.SimpleTestConfiguration(context, root, 'sea')
27
28 return testpy.ParallelTestConfiguration(context, root, 'sea')

Callers

nothing calls this directly

Calls 1

GetVmMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…