(context, root)
| 3 | import testpy |
| 4 | |
| 5 | def 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') |
nothing calls this directly
no test coverage detected
searching dependent graphs…