I tried to run 'make check' with PyPy (PyPy3 and PyPy 7.3), but
it failed by "To many open files", even if "ulimit -n" returns
175833. I don't think test processes used descriptor so much and
I couldn't find what makes the limit so smaller.
However I could reduce max number of descriptors simultaneously used,
by looking over the source of the test suite.
(attached source test-suite-care-resources-patch.txt)
Ensure close file descriptors by using context manager in test suite.
Generally, it is true that as file descriptors are closed when their
underlying objects are deleted, we don't need close them explicitly.
However if a Python language implementation that uses other strategy
than reference count model, there is no warranty it will happen
immediately after when those objects lose the last reference. So we
use context manager to ensure close() is called immediately after
those objects to be unnecessary. This helps us to run 'make check'
with PyPy even smaler limit of number of open files, although we
don't recommend use it because it is much slower than CPython for
(TestHarness._init_c_tests): Use context manager to write file.
Use context manager for Popen object.
(load_repo, load_dumpfile): Use context manager to read file contents.
(trust_ssl_cert): Use context manager to read file contents.
(Sandbox._ensure_authz get_content): New function.
(Sandbox._ensure_authz): Use it.
(get_text): Use context manager to read file contents.
(State.from_wc): Use context manager to read file contents.
I don't think we support to run tests on PyPy but also I don't think
it is worthless.
Yasuhito FUTATSUKI <futatuki_at_yf.bsclub.org>
Received on 2020-11-11 08:15:23 CET