Page MenuHomePhabricator

Better port collision management for the functional tests
AcceptedPublic

Authored by Fabien on Wed, Feb 12, 22:20.

Details

Reviewers
roqqit
PiRK
Group Reviewers
Restricted Project
Summary

On a machine with lots of CPUs, it's is very possible to generate port collision by simply running to many tests. The port computation will wrap up and collide with a test which is still running. To avoid this, we change to strategy to use port skips by range depending on the CPU count.
While at it, I also removed the global and renamed it for clarity, wrapping it into a class to make mypy happy (function attributes are not supported but class attributes are).

Test Plan

On a 32 core machine:

./test/functional/test_runner.py

Diff Detail

Repository
rABC Bitcoin ABC
Branch
avoid_port_collision
Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 32389
Build 64267: Build Diffbuild-clang-tidy · build-debug · build-clang · build-without-wallet · build-diff
Build 64266: arc lint + arc unit

Event Timeline

Fabien requested review of this revision.Wed, Feb 12, 22:20
This revision is now accepted and ready to land.Wed, Feb 12, 23:01
PiRK added a subscriber: PiRK.
PiRK added inline comments.
test/functional/test_framework/util.py
336

That a python 3.10 union syntax https://peps.python.org/pep-0604/

378

but as of python 3.9 you can now use dict[PortName, int] https://peps.python.org/pep-0585/

Fix type hints for compatibility with python >= 3.9