@@ -154,6 +154,7 @@ PTESTS_SLOW = "\
python3-click \
python3-cryptography \
python3-numpy \
+ python3-uvloop \
python3-xmltodict \
strace \
tar \
new file mode 100755
@@ -0,0 +1,11 @@
+#!/bin/sh
+# The recipe fills in SKIPPED_TESTS.
+SKIPPED_TESTS=
+# test_getaddrinfo_{1,2} wait for the resolver timeout without network access.
+# --deselect and -k would also drop test_getaddrinfo_1x and _2x, so exclude
+# 1 and 2 with -k and add the rest back.
+DNS_FILTER="not (test_getaddrinfo_1 or test_getaddrinfo_2)"
+for n in 10 11 12 13 14 15 16 17 18 19 20 21 22; do
+ DNS_FILTER="$DNS_FILTER or test_getaddrinfo_$n"
+done
+pytest --automake $SKIPPED_TESTS -k "$DNS_FILTER"
@@ -7,11 +7,85 @@ 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 \
+"
+
+# These replace the stdout/stderr fds, which conflicts with pytest's output
+# capture
+SKIPPED_TESTS = "\
+ --deselect=tests/test_process.py::Test_UV_Process::test_process_streams_redirect \
+ --deselect=tests/test_process.py::Test_AIO_Process::test_process_streams_redirect \
+"
+
+# libuv 1.53.0 spawns with posix_spawn(), so preexec_fn never runs, and an
+# empty host gives EAI_NODATA
+SKIPPED_TESTS += "\
+ --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_8 \
+ --deselect=tests/test_dns.py::Test_UV_DNS::test_getaddrinfo_9 \
+"
+
+# Each DNS lookup waits for the resolver timeout without network access.
+# run-ptest handles test_getaddrinfo_{1,2}.
+SKIPPED_TESTS += "\
+ --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_11 \
+ --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 \
+ --deselect=tests/test_dns.py::Test_AIO_DNS::test_getaddrinfo_11 \
+"
+
+# qemu runs without KVM on riscv64, 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
+SKIPPED_TESTS:append:riscv64 = " \
+ --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 \
+"
+
+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}/
+ sed -i -e "s|^SKIPPED_TESTS=$|SKIPPED_TESTS=\"${SKIPPED_TESTS}\"|" ${D}${PTEST_PATH}/run-ptest
+}
+
BBCLASSEXTEND = "native nativesdk"