Openembedded Core Discussions
 help / color / mirror / Atom feed
From: "Trevor Gamblin" <tgamblin@baylibre.com>
To: <tim.orling@konsulko.com>, <openembedded-core@lists.openembedded.org>
Subject: Re: [PATCH v2 2/5] python3-uvloop: enable ptest
Date: Tue, 03 Nov 2026 15:50:18 -0500	[thread overview]
Message-ID: <DMLVEXD46FYX.3D2U16C6F63AY@baylibre.com> (raw)
In-Reply-To: <20261103193829.1806542-4-tim.orling@konsulko.com>

On Tue Nov 3, 2026 at 2:38 PM EST, tim.orling wrote:
> From: Tim Orling <tim.orling@konsulko.com>
>
> The sdist ships the test suite. run-ptest deselects:
> * tests that conflict with pytest's output capture;
> * tests broken by libuv 1.53.0 spawning with posix_spawn() on Linux,
>   which bypasses uvloop's preexec_fn fork hook;
> * DNS tests that wait for resolver timeouts without network access,
>   which took the suite from 1 to 10 minutes over tap without NAT;
> * on riscv64 only, TLS stress tests, the issue39 deadlock check and a
>   socket cancellation test, whose fixed timeouts are too short for qemu
>   without KVM.
>
> .flake8 and mypy.ini let test_sourcecode skip cleanly when flake8 and
> mypy are missing.
>
> Tested with core-image-ptest-python3-uvloop on qemux86-64. It takes
> over 30 seconds, so add it to PTESTS_SLOW.
>
> AI-Generated: Uses Claude Code (Claude Opus 5.5)
> Signed-off-by: Tim Orling <tim.orling@konsulko.com>
> ---
> Changes in v2:
> - Skip 13 timing sensitive tests on riscv64 only, covering the
>   qemuriscv64 AutoBuilder failures plus their counterparts in the other
>   event loop class and test_socket_cancel_sock_sendall, found in 10 runs
>   under load (stress-ng)
> - Build the -k expression in a loop to fix patchtest's line length check
> - Drop the test counts from the commit message
>
>  .../distro/include/ptest-packagelists.inc     |  1 +
>  .../python/python3-uvloop/run-ptest           | 50 +++++++++++++++++++
>  .../python/python3-uvloop_0.22.1.bb           | 27 +++++++++-
>  3 files changed, 76 insertions(+), 2 deletions(-)
>  create mode 100755 meta/recipes-devtools/python/python3-uvloop/run-ptest
>
> diff --git a/meta/conf/distro/include/ptest-packagelists.inc b/meta/conf/distro/include/ptest-packagelists.inc
> index bef45bb4d5..50b971bace 100644
> --- a/meta/conf/distro/include/ptest-packagelists.inc
> +++ b/meta/conf/distro/include/ptest-packagelists.inc
> @@ -154,6 +154,7 @@ PTESTS_SLOW = "\
>      python3-click \
>      python3-cryptography \
>      python3-numpy \
> +    python3-uvloop \
>      python3-xmltodict \
>      strace \
>      tar \
> diff --git a/meta/recipes-devtools/python/python3-uvloop/run-ptest b/meta/recipes-devtools/python/python3-uvloop/run-ptest
> new file mode 100755
> index 0000000000..0cb9a26b88
> --- /dev/null
> +++ b/meta/recipes-devtools/python/python3-uvloop/run-ptest
> @@ -0,0 +1,50 @@
> +#!/bin/sh
> +# test_process_streams_redirect: replaces the stdout/stderr fds, which
> +# conflicts with pytest's output capture.
> +# test_process_preexec_fn_{1,2}, Test_UV_DNS test_getaddrinfo_{8,9}: libuv
> +# 1.53.0 spawns with posix_spawn(), so preexec_fn never runs, and an empty
> +# host gives EAI_NODATA.
> +# test_getaddrinfo_{1,2,3,5,6,11}, Test_AIO_DNS test_getaddrinfo_{8,9}: each
> +# DNS lookup waits for the resolver timeout without network access.
> +# --deselect matches a node id prefix, so -k handles 1, 2 and 11.
> +# riscv64: qemu runs without KVM there, too slow for the fixed timeouts in
> +# the TLS stress tests, the issue39 deadlock check (signal.alarm(5)) and
> +# test_socket_cancel_sock_sendall, which must cancel within 0.2s.
> +SLOW=""
> +if [ "$(uname -m)" = "riscv64" ]; then
> +    SLOW="
> +        --deselect=tests/test_tcp.py::Test_UV_TCPSSL::test_create_connection_ssl_1
> +        --deselect=tests/test_tcp.py::Test_UV_TCPSSL::test_create_server_ssl_over_ssl
> +        --deselect=tests/test_tcp.py::Test_UV_TCPSSL::test_renegotiation
> +        --deselect=tests/test_tcp.py::Test_AIO_TCPSSL::test_create_connection_ssl_1
> +        --deselect=tests/test_tcp.py::Test_AIO_TCPSSL::test_create_server_ssl_over_ssl
> +        --deselect=tests/test_tcp.py::Test_AIO_TCPSSL::test_renegotiation
> +        --deselect=tests/test_unix.py::Test_UV_UnixSSL::test_create_unix_connection_ssl_1
> +        --deselect=tests/test_unix.py::Test_UV_UnixSSL::test_create_unix_server_ssl_1
> +        --deselect=tests/test_unix.py::Test_AIO_UnixSSL::test_create_unix_connection_ssl_1
> +        --deselect=tests/test_unix.py::Test_AIO_UnixSSL::test_create_unix_server_ssl_1
> +        --deselect=tests/test_regr1.py::TestIssue39Regr::test_issue39_regression
> +        --deselect=tests/test_sockets.py::TestUVSockets::test_socket_cancel_sock_sendall
> +        --deselect=tests/test_sockets.py::TestAIOSockets::test_socket_cancel_sock_sendall
> +    "
> +fi
> +KEEP="not (test_getaddrinfo_1 or test_getaddrinfo_2)"

This 'KEEP' variable name seems misleading given that it's using 'not' to avoid
running those two test cases, but then gets built up in a loop. I think it'd be
better to just add them with --deselect like the others, even if it ends up
being more verbose.

> +for n in 10 12 13 14 15 16 17 18 19 20 21 22; do
> +    KEEP="$KEEP or test_getaddrinfo_$n"
> +done
> +pytest --automake $SLOW \
> +    -k "$KEEP" \
> +    --deselect=tests/test_process.py::Test_UV_Process::test_process_streams_redirect \
> +    --deselect=tests/test_process.py::Test_AIO_Process::test_process_streams_redirect \
> +    --deselect=tests/test_process.py::Test_UV_Process::test_process_preexec_fn_1 \
> +    --deselect=tests/test_process.py::Test_UV_Process::test_process_preexec_fn_2 \
> +    --deselect=tests/test_dns.py::Test_UV_DNS::test_getaddrinfo_3 \
> +    --deselect=tests/test_dns.py::Test_UV_DNS::test_getaddrinfo_5 \
> +    --deselect=tests/test_dns.py::Test_UV_DNS::test_getaddrinfo_6 \
> +    --deselect=tests/test_dns.py::Test_UV_DNS::test_getaddrinfo_8 \
> +    --deselect=tests/test_dns.py::Test_UV_DNS::test_getaddrinfo_9 \
> +    --deselect=tests/test_dns.py::Test_AIO_DNS::test_getaddrinfo_3 \
> +    --deselect=tests/test_dns.py::Test_AIO_DNS::test_getaddrinfo_5 \
> +    --deselect=tests/test_dns.py::Test_AIO_DNS::test_getaddrinfo_6 \
> +    --deselect=tests/test_dns.py::Test_AIO_DNS::test_getaddrinfo_8 \
> +    --deselect=tests/test_dns.py::Test_AIO_DNS::test_getaddrinfo_9

I wonder if we could keep this list inside the recipe file itself, similar to
how python3's recipe uses SKIPPED_TESTS with various appends? That example uses
unittest instead of pytest, but it should be possible to pass the list. Maybe
I'm wrong.

Trevor

> diff --git a/meta/recipes-devtools/python/python3-uvloop_0.22.1.bb b/meta/recipes-devtools/python/python3-uvloop_0.22.1.bb
> index 887c262ae7..39b6a2602a 100644
> --- a/meta/recipes-devtools/python/python3-uvloop_0.22.1.bb
> +++ b/meta/recipes-devtools/python/python3-uvloop_0.22.1.bb
> @@ -7,11 +7,34 @@ LIC_FILES_CHKSUM = "file://LICENSE-APACHE;md5=bb92739ddad0a2811957bd98bdb90474 \
>  
>  DEPENDS += "libuv python3-wheel-native"
>  
> -SRC_URI += "file://0001-setup.cfg-use-system-libuv.patch"
> +SRC_URI += "\
> +    file://0001-setup.cfg-use-system-libuv.patch \
> +    file://run-ptest \
> +"
>  SRC_URI[sha256sum] = "6c84bae345b9147082b17371e3dd5d42775bddce91f885499017f4607fdaf39f"
>  
> -inherit pypi python_setuptools_build_meta cython
> +inherit pypi python_setuptools_build_meta cython ptest-python-pytest
>  
>  RDEPENDS:${PN} = "python3-asyncio"
>  
> +RDEPENDS:${PN}-ptest += "\
> +    python3-ctypes \
> +    python3-io \
> +    python3-logging \
> +    python3-math \
> +    python3-multiprocessing \
> +    python3-netclient \
> +    python3-numbers \
> +    python3-pickle \
> +    python3-pprint \
> +    python3-psutil \
> +    python3-pyopenssl \
> +    python3-threading \
> +"
> +
> +do_install_ptest:append() {
> +    # test_sourcecode needs these to skip cleanly when flake8 and mypy are missing
> +    install -m 0644 ${S}/.flake8 ${S}/mypy.ini ${D}${PTEST_PATH}/
> +}
> +
>  BBCLASSEXTEND = "native nativesdk"



  reply	other threads:[~2026-11-03 20:50 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-02  1:18 [PATCH 1/5] python3-uvloop: import 0.22.1 from meta-homeassistant tim.orling
2026-11-02  1:18 ` [PATCH 2/5] python3-uvloop: enable ptest tim.orling
2026-11-02  1:33   ` Patchtest results for " patchtest
2026-11-02 14:10   ` [OE-core] " Mathieu Dubois-Briand
2026-11-02 21:46     ` Tim Orling
2026-11-05 16:54     ` Joao Marcos Costa
2026-11-09  6:25       ` Tim Orling
2026-11-02  1:18 ` [PATCH 3/5] python3-uvloop: upgrade 0.22.1 -> 0.23.0 tim.orling
2026-11-02  1:18 ` [PATCH 4/5] python3-websockets: enable ptest; use git fetcher tim.orling
2026-11-02  1:18 ` [PATCH 5/5] python3-websockets: upgrade 17.1 -> 17.4 tim.orling
2026-11-03 19:38 ` [PATCH v2 1/5] python3-uvloop: import 0.22.1 from meta-homeassistant tim.orling
2026-11-04  0:06   ` [PATCH v3 " tim.orling
2026-11-04  0:06     ` [PATCH v3 2/5] python3-uvloop: enable ptest tim.orling
2026-11-04  0:06     ` [PATCH v3 3/5] python3-uvloop: upgrade 0.22.1 -> 0.23.0 tim.orling
2026-11-04  0:06     ` [PATCH v3 4/5] python3-websockets: enable ptest; use git fetcher tim.orling
2026-11-04  0:06     ` [PATCH v3 5/5] python3-websockets: upgrade 17.1 -> 17.4 tim.orling
2026-11-03 19:38 ` [PATCH v2 2/5] python3-uvloop: enable ptest tim.orling
2026-11-03 20:50   ` Trevor Gamblin [this message]
2026-11-03 21:18     ` [OE-core] " Tim Orling
2026-11-03 19:38 ` [PATCH v2 3/5] python3-uvloop: upgrade 0.22.1 -> 0.23.0 tim.orling
2026-11-03 19:38 ` [PATCH v2 4/5] python3-websockets: enable ptest; use git fetcher tim.orling
2026-11-05 14:41   ` [OE-core] " Ross Burton
2026-11-09  6:16     ` Tim Orling
2026-11-03 19:38 ` [PATCH v2 5/5] python3-websockets: upgrade 17.1 -> 17.4 tim.orling

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=DMLVEXD46FYX.3D2U16C6F63AY@baylibre.com \
    --to=tgamblin@baylibre.com \
    --cc=openembedded-core@lists.openembedded.org \
    --cc=tim.orling@konsulko.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox