diff options
| author | Gyorgy Sarvari <skandigraun@gmail.com> | 2025-10-27 21:10:14 +0100 |
|---|---|---|
| committer | Gyorgy Sarvari <skandigraun@gmail.com> | 2025-10-27 21:13:18 +0100 |
| commit | c71d61037e5375af02b022917f2fc6d130f41313 (patch) | |
| tree | 48cd9ada84695ee4dbcac45e4612116c289ce480 /meta-networking | |
| parent | 13af8f750688127d5412eae10120dfa83f176c2e (diff) | |
| download | meta-openembedded-c71d61037e5375af02b022917f2fc6d130f41313.tar.gz | |
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 <skandigraun@gmail.com>
Diffstat (limited to 'meta-networking')
| -rw-r--r-- | meta-networking/recipes-devtools/python/python3-scapy/run-ptest | 7 | ||||
| -rw-r--r-- | meta-networking/recipes-devtools/python/python3-scapy_2.4.5.bb | 13 |
2 files changed, 20 insertions, 0 deletions
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 @@ | |||
| 1 | #!/bin/sh | 1 | #!/bin/sh |
| 2 | |||
| 3 | if ! nslookup example.com; then | ||
| 4 | mv /etc/resolv.conf /etc/resolv.conf.bak | ||
| 5 | echo "nameserver 8.8.8.8" > /etc/resolv.conf | ||
| 6 | trap "mv /etc/resolv.conf.bak /etc/resolv.conf" INT EXIT | ||
| 7 | fi | ||
| 8 | |||
| 2 | UTscapy3 -t regression.uts -f text -l -C \ | 9 | UTscapy3 -t regression.uts -f text -l -C \ |
| 3 | -o @PTEST_PATH@/scapy_ptest_$(date +%Y%m%d-%H%M%S).log \ | 10 | -o @PTEST_PATH@/scapy_ptest_$(date +%Y%m%d-%H%M%S).log \ |
| 4 | 2>&1 | sed -e 's/^passed None/PASS:/' -e 's/^failed None/FAIL:/' | 11 | 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() { | |||
| 34 | do_install_ptest() { | 34 | do_install_ptest() { |
| 35 | install -m 0644 ${S}/test/regression.uts ${D}${PTEST_PATH} | 35 | install -m 0644 ${S}/test/regression.uts ${D}${PTEST_PATH} |
| 36 | sed -i 's,@PTEST_PATH@,${PTEST_PATH},' ${D}${PTEST_PATH}/run-ptest | 36 | sed -i 's,@PTEST_PATH@,${PTEST_PATH},' ${D}${PTEST_PATH}/run-ptest |
| 37 | 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 | ||
| 38 | install -m 0644 ${S}/test/pcaps/macos.pcapng.gz ${D}${PYTHON_SITEPACKAGES_DIR}/test/pcaps/ | ||
| 39 | |||
| 40 | # note1: if ipv6 isn't enabled, skip the related test (add '-K ipv6' argument) | ||
| 41 | # note2: to make this test work, your ISP also must support ipv6 - the test is trying | ||
| 42 | # to ping google.com through ipv6. | ||
| 43 | if [ "${@oe.utils.all_distro_features(d, 'ipv6', 'true', 'false')}" = "false" ]; then | ||
| 44 | sed -i 's/UTscapy3/UTscapy3 -K ipv6/g' ${D}${PTEST_PATH}/run-ptest | ||
| 45 | fi | ||
| 37 | } | 46 | } |
| 38 | 47 | ||
| 39 | RDEPENDS:${PN} = "tcpdump ${PYTHON_PN}-compression ${PYTHON_PN}-cryptography ${PYTHON_PN}-netclient \ | 48 | RDEPENDS:${PN} = "tcpdump ${PYTHON_PN}-compression ${PYTHON_PN}-cryptography ${PYTHON_PN}-netclient \ |
| 40 | ${PYTHON_PN}-netserver ${PYTHON_PN}-pydoc ${PYTHON_PN}-pkgutil ${PYTHON_PN}-shell \ | 49 | ${PYTHON_PN}-netserver ${PYTHON_PN}-pydoc ${PYTHON_PN}-pkgutil ${PYTHON_PN}-shell \ |
| 41 | ${PYTHON_PN}-threading ${PYTHON_PN}-numbers" | 50 | ${PYTHON_PN}-threading ${PYTHON_PN}-numbers" |
| 51 | |||
| 52 | RDEPENDS:${PN}-ptest += "tshark" | ||
| 53 | |||
| 54 | FILES:${PN}-ptest += "${PYTHON_SITEPACKAGES_DIR}/test/pcaps" | ||
