Don't disable all parallelism when EMCC_DEBUG is set (#13404)

This enables certain parallel phases such as running llvm-nm in parallel
when calculating system libraries to link.  Developers who what to
disable even that can continue to use `EMCC_CORES=1`.

Continue to disable parallelism in debug mode in these two cases:

1. When building system libraries/ports at link time.
2. In the test runner

While the risk using parallelism and debug mode is diminished due to
recent changes (#13329 #13370) it is still possible for emscripten
processed in debug mode to interfere with each other due to sharing
a temp directory.

See https://bugs.chromium.org/p/chromium/issues/detail?id=1171844
This commit is contained in:
Sam Clegg 2021-02-02 17:05:39 -08:00 коммит произвёл GitHub
Родитель 9fc7f41b9b
Коммит 2bdbaf3670
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
3 изменённых файлов: 3 добавлений и 7 удалений

4
tests/runner.py поставляемый
Просмотреть файл

@ -462,7 +462,7 @@ class RunnerCore(unittest.TestCase, metaclass=RunnerMeta):
os.chdir(os.path.dirname(self.get_dir()))
try_delete(self.get_dir())
if EMTEST_DETECT_TEMPFILE_LEAKS and not os.environ.get('EMCC_DEBUG'):
if EMTEST_DETECT_TEMPFILE_LEAKS and not DEBUG:
temp_files_after_run = []
for root, dirnames, filenames in os.walk(self.temp_dir):
for dirname in dirnames:
@ -1841,7 +1841,7 @@ def flattened_tests(loaded_tests):
def suite_for_module(module, tests):
suite_supported = module.__name__ in ('test_core', 'test_other', 'test_posixtest')
if not EMTEST_SAVE_DIR:
if not EMTEST_SAVE_DIR and not DEBUG:
has_multiple_tests = len(tests) > 1
has_multiple_cores = parallel_testsuite.num_cores() > 1
if suite_supported and has_multiple_tests and has_multiple_cores:

Просмотреть файл

@ -158,10 +158,6 @@ def clear():
def get_num_cores():
if DEBUG:
# When in EMCC_DEBUG mode, only use a single core to avoid interleaving
# logging output and keeps things more deterministic.
return 1
return int(os.environ.get('EMCC_CORES', multiprocessing.cpu_count()))

Просмотреть файл

@ -88,7 +88,7 @@ def run_build_commands(commands):
# to setup the sysroot itself.
ensure_sysroot()
cores = min(len(commands), building.get_num_cores())
if cores <= 1:
if cores <= 1 or shared.DEBUG:
for command in commands:
run_one_command(command)
else: