From eda78597eb4edef4f8cd842bbe3eb110fb2fb1b0 Mon Sep 17 00:00:00 2001 From: Julien Olivain Date: Tue, 22 Oct 2024 19:43:45 +0200 Subject: [PATCH] support/testing: add iputils runtime test Signed-off-by: Julien Olivain Signed-off-by: Thomas Petazzoni --- DEVELOPERS | 1 + support/testing/tests/package/test_iputils.py | 48 +++++++++++++++++++ 2 files changed, 49 insertions(+) create mode 100644 support/testing/tests/package/test_iputils.py diff --git a/DEVELOPERS b/DEVELOPERS index 136b82ce14..386b4ef38f 100644 --- a/DEVELOPERS +++ b/DEVELOPERS @@ -1911,6 +1911,7 @@ F: support/testing/tests/package/test_iperf.py F: support/testing/tests/package/test_iperf3.py F: support/testing/tests/package/test_iproute2.py F: support/testing/tests/package/test_iptables.py +F: support/testing/tests/package/test_iputils.py F: support/testing/tests/package/test_jailhouse.py F: support/testing/tests/package/test_jq.py F: support/testing/tests/package/test_jq/ diff --git a/support/testing/tests/package/test_iputils.py b/support/testing/tests/package/test_iputils.py new file mode 100644 index 0000000000..5f4ba9873b --- /dev/null +++ b/support/testing/tests/package/test_iputils.py @@ -0,0 +1,48 @@ +import os + +import infra.basetest + + +class TestIputils(infra.basetest.BRTest): + config = infra.basetest.BASIC_TOOLCHAIN_CONFIG + \ + """ + BR2_PACKAGE_IPUTILS=y + BR2_SYSTEM_DHCP="eth0" + BR2_TARGET_ROOTFS_CPIO=y + # BR2_TARGET_ROOTFS_TAR is not set + """ + + def test_run(self): + cpio_file = os.path.join(self.builddir, "images", "rootfs.cpio") + self.emulator.boot(arch="armv7", + kernel="builtin", + options=["-initrd", cpio_file]) + self.emulator.login() + + # We check all the main programs of iputils can execute and + # report their version. Note the "-V" option is not accepted + # and fails if the "ping" applet of BusyBox is used instead. + iputils_progs = ["arping", "clockdiff", "ping", "tracepath"] + for prog in iputils_progs: + self.assertRunOk(f"{prog} -V") + + # Qemu host IP, See: + # https://wiki.qemu.org/Documentation/Networking#User_Networking_(SLIRP) + qemu_host = "10.0.2.2" + + # We test the "arping" program, with 3 pings. + self.assertRunOk(f"arping -c 3 {qemu_host}", timeout=10) + + # We test the "ping" program. We use the option "-D" which + # shows a timestamp and is also not supported by the "ping" + # BusyBox applet. + self.assertRunOk(f"ping -D -c 3 {qemu_host}", timeout=10) + + # We test the "tracepath" program. We set the max hops to 2, + # since there is no intermediate routers. + self.assertRunOk(f"tracepath -m 2 {qemu_host}", timeout=10) + + # We test the "clockdiff" program. We cannot use the Qemu host + # IP for this program as the ICMP TIMESTAMP is used and is not + # responded. We use the local host instead. + self.assertRunOk("clockdiff 127.0.0.1", timeout=10)