test: improve functional tests compatibility with BSD/macOS#19368
test: improve functional tests compatibility with BSD/macOS#19368laanwj merged 2 commits intobitcoin:masterfrom
Conversation
pidof is not available on BSD system, while pgrep is present on BSD, Linux and macOS
If the socket is tearing down macOS will return EPROTOTYPE instead of EPIPE. Because python doesn't handle this internally we have to do a workaround and retry the request. See https://bugs.python.org/issue33450
|
Oh nice. Does that mean we can enable the tests again? bitcoin/ci/test/00_setup_env_mac_host.sh Line 14 in 67881de |
|
@MarcoFalke oh, I didn't even know we had already experienced this problem, I thought it's just me 😄 I've looked at the comment and related travis logs and indeed the error is the same as in my stacktrace. From what I understood the behaviour we see on macOS is similar to I think we can try to enable the tests again. Would you suggest to have some prior discussion on IRC maybe or just re-enable the tests in this PR and let reviewers decide? |
That seems fine |
|
ACK 3a7e794 |
There are various edge cases where a connection reset can happen. For example at shutdown it's not guaranteed that |
Summary: > test: use pgrep for better compatibility > > pidof is not available on BSD system, while pgrep is present on BSD, Linux and macOS > test: retry when write to a socket fails on macOS > > If the socket is tearing down macOS will return EPROTOTYPE instead of EPIPE. > Because python doesn't handle this internally we have to do a workaround and retry the request. > See https://bugs.python.org/issue33450 This is a backport of [[bitcoin/bitcoin#19368 | core#19368]] Test Plan: ``` test/functional/test_runner.py ``` Run it with and without `bitcoind` already running to check that it still detects it. Reviewers: #bitcoin_abc, majcosta Reviewed By: #bitcoin_abc, majcosta Differential Revision: https://reviews.bitcoinabc.org/D9968
Rationale: a few minor changes to make experience of running tests on macOS a bit better
1.
pidofis not available on BSD/macOS, whilepgrepis present on BSD, Linux and macOS2. Add retry as a workaround for a weird behavior when writing to a socket (https://bugs.python.org/issue33450). Stacktrace attached
Man pages:
https://www.freebsd.org/cgi/man.cgi?query=pgrep&apropos=0&sektion=1&manpath=FreeBSD+6.0-RELEASE&arch=default&format=html
https://man7.org/linux/man-pages/man1/pgrep.1.html
Related to #19281
Stacktrace example: