From c71d61037e5375af02b022917f2fc6d130f41313 Mon Sep 17 00:00:00 2001 From: Gyorgy Sarvari Date: Mon, 27 Oct 2025 21:10:14 +0100 Subject: [PATCH] python3-scapy: fix ptests 1. Enable network access during tests by setting a nameserver 2. Add missing tshark dependency 3. Install missing test files Signed-off-by: Gyorgy Sarvari --- .../recipes-devtools/python/python3-scapy/run-ptest | 7 +++++++ .../recipes-devtools/python/python3-scapy_2.4.5.bb | 13 +++++++++++++ 2 files changed, 20 insertions(+) diff --git a/meta-networking/recipes-devtools/python/python3-scapy/run-ptest b/meta-networking/recipes-devtools/python/python3-scapy/run-ptest index 797d8ecf78..847b69af94 100644 --- a/meta-networking/recipes-devtools/python/python3-scapy/run-ptest +++ b/meta-networking/recipes-devtools/python/python3-scapy/run-ptest @@ -1,4 +1,11 @@ #!/bin/sh + +if ! nslookup example.com; then + mv /etc/resolv.conf /etc/resolv.conf.bak + echo "nameserver 8.8.8.8" > /etc/resolv.conf + trap "mv /etc/resolv.conf.bak /etc/resolv.conf" INT EXIT +fi + UTscapy3 -t regression.uts -f text -l -C \ -o @PTEST_PATH@/scapy_ptest_$(date +%Y%m%d-%H%M%S).log \ 2>&1 | sed -e 's/^passed None/PASS:/' -e 's/^failed None/FAIL:/' diff --git a/meta-networking/recipes-devtools/python/python3-scapy_2.4.5.bb b/meta-networking/recipes-devtools/python/python3-scapy_2.4.5.bb index 0f66dfd784..83f6a6026a 100644 --- a/meta-networking/recipes-devtools/python/python3-scapy_2.4.5.bb +++ b/meta-networking/recipes-devtools/python/python3-scapy_2.4.5.bb @@ -34,8 +34,21 @@ do_install:append() { do_install_ptest() { install -m 0644 ${S}/test/regression.uts ${D}${PTEST_PATH} sed -i 's,@PTEST_PATH@,${PTEST_PATH},' ${D}${PTEST_PATH}/run-ptest + install -D -m 0644 ${S}/test/pcaps/bad_rsn_parsing_overrides_ssid.pcap ${D}${PYTHON_SITEPACKAGES_DIR}/test/pcaps/bad_rsn_parsing_overrides_ssid.pcap + install -m 0644 ${S}/test/pcaps/macos.pcapng.gz ${D}${PYTHON_SITEPACKAGES_DIR}/test/pcaps/ + + # note1: if ipv6 isn't enabled, skip the related test (add '-K ipv6' argument) + # note2: to make this test work, your ISP also must support ipv6 - the test is trying + # to ping google.com through ipv6. + if [ "${@oe.utils.all_distro_features(d, 'ipv6', 'true', 'false')}" = "false" ]; then + sed -i 's/UTscapy3/UTscapy3 -K ipv6/g' ${D}${PTEST_PATH}/run-ptest + fi } RDEPENDS:${PN} = "tcpdump ${PYTHON_PN}-compression ${PYTHON_PN}-cryptography ${PYTHON_PN}-netclient \ ${PYTHON_PN}-netserver ${PYTHON_PN}-pydoc ${PYTHON_PN}-pkgutil ${PYTHON_PN}-shell \ ${PYTHON_PN}-threading ${PYTHON_PN}-numbers" + +RDEPENDS:${PN}-ptest += "tshark" + +FILES:${PN}-ptest += "${PYTHON_SITEPACKAGES_DIR}/test/pcaps"