changeset 44518:b2e41723f886

run-tests: restrict Rust thread pool to 3 threads during tests Differential Revision: https://phab.mercurial-scm.org/D8270
author Raphaël Gomès <rgomes@octobus.net>
date Tue, 10 Mar 2020 16:04:30 +0100
parents 448d700e0d27
children 52d40f8fb82d
files tests/run-tests.py
diffstat 1 files changed, 6 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/tests/run-tests.py	Fri Feb 28 00:31:14 2020 +0100
+++ b/tests/run-tests.py	Tue Mar 10 16:04:30 2020 +0100
@@ -2995,6 +2995,12 @@
             # we do the randomness ourself to know what seed is used
             os.environ['PYTHONHASHSEED'] = str(random.getrandbits(32))
 
+        # Rayon (Rust crate for multi-threading) will use all logical CPU cores
+        # by default, causing thrashing on high-cpu-count systems.
+        # Setting its limit to 3 during tests should still let us uncover
+        # multi-threading bugs while keeping the thrashing reasonable.
+        os.environ.setdefault("RAYON_NUM_THREADS", "3")
+
         if self.options.tmpdir:
             self.options.keep_tmpdir = True
             tmpdir = _sys2bytes(self.options.tmpdir)