Patchwork D8270: run-tests: restrict Rust thread pool to 3 threads during tests

login
register
mail settings
Submitter phabricator
Date March 11, 2020, 4:23 p.m.
Message ID <0f1d348b60ef865a6ceb9d4de96121fb@localhost.localdomain>
Download mbox | patch
Permalink /patch/45719/
State Not Applicable
Headers show

Comments

phabricator - March 11, 2020, 4:23 p.m.
Closed by commit rHGb2e41723f886: run-tests: restrict Rust thread pool to 3 threads during tests (authored by Alphare).
This revision was automatically updated to reflect the committed changes.
This revision was not accepted when it landed; it landed in state "Needs Review".

CHANGED PRIOR TO COMMIT
  https://phab.mercurial-scm.org/D8270?vs=20663&id=20711#toc

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D8270?vs=20663&id=20711

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D8270/new/

REVISION DETAIL
  https://phab.mercurial-scm.org/D8270

AFFECTED FILES
  tests/run-tests.py

CHANGE DETAILS




To: Alphare, #hg-reviewers, durin42, marmoute
Cc: marmoute, durin42, pulkit, mercurial-devel

Patch

diff --git a/tests/run-tests.py b/tests/run-tests.py
--- a/tests/run-tests.py
+++ b/tests/run-tests.py
@@ -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)